Skip to content

Latest commit

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

OnePin logo OnePin

HAPI Compatibility: Works with new Check/Apply/ApplyPack API (2026-Q2)

HAPI pin/port API terminals. Hardware implementations are in OneChip. Bit selection is in OneBit.

Terminals

These are the outermost (user-facing) layer in the HAPI chain. All methods are silent stubs; hardware components below provide the real implementations.

InPin<U = unsigned char> — read-only

static U get() // read port value (port-width U)
static void act() // ISR propagation (silent)

OutPin<U = unsigned char> — write-only

staticvoidon() // set pin high (maskless; Mask<> below provides the mask)
static void off() // set pin low
static void put(U v) // write full port value
static void act()

IOPin<U = unsigned char> — bidirectional

static U get()
static void on()
static void off()
static void put(U v)
static void act()

Convenience aliases

AvrInPin = InPin<unsignedchar> // AVR 8-bit ports
AvrOutPin = OutPin<unsignedchar>
AvrIOPin = IOPin<unsignedchar>
Stm32InPin = InPin<unsignedint> // STM32 32-bit ports
Stm32OutPin = OutPin<unsignedint>
Stm32IOPin = IOPin<unsignedint>

Composition model

Terminal (InPin/OutPin/IOPin) ← outermost, user API
oneBit::Mask<Pins<N>> ← bit selection; provides maskBits()
HwPort (from OneChip) ← register access: get/set/rawSet/rawClear

on()/off() never take a mask argument — the mask is baked in by oneBit::Mask<> below. Idiomatic use is a single pin (Pins<5>); multi-bit masks (Pins<4,5,6,7>) work too — on() sets all selected bits. put()/get() operate at full port width (U).

Example

#include<onePin/onePin.h>
#include<chips/avr/avrPort.h>
#include<OneBit.h>usingnamespaceonePin;usingnamespacehw::avr;usingnamespaceoneBit;using Led = APIOf<AvrOutPin, Mask<Pins<5>>, chip::PortB>;
Led led;
led.on(); // PB5 high
led.off(); // PB5 low
led.put(0xFF); // full port high

About

pin level meta-framework

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages