30 #if defined(__AVR__) || defined(DOXYGEN) // AVR only
32 #include <util/atomic.h>
44 PinIO() : bit_(0), mask_(0XFF) {}
45 explicit PinIO(uint8_t pin);
46 bool begin(uint8_t pin);
53 return *pinReg_ & bit_;
100 void modeI(uint8_t mode)
102 volatile uint8_t* ddrReg = pinReg_ + 1;
103 *ddrReg = mode == OUTPUT ? *ddrReg | bit_ : *ddrReg & mask_;
104 if (mode != OUTPUT) {
105 writeI(mode == INPUT_PULLUP);
118 void writeI(
bool level)
120 *portReg_ = level ? *portReg_ | bit_ : *portReg_ & mask_;
132 ATOMIC_BLOCK(ATOMIC_FORCEON) {
146 ATOMIC_BLOCK(ATOMIC_FORCEON) {
163 void mode(uint8_t mode)
165 ATOMIC_BLOCK(ATOMIC_FORCEON) {
179 void write(
bool level)
181 ATOMIC_BLOCK(ATOMIC_FORCEON) {
189 volatile uint8_t* pinReg_;
190 volatile uint8_t* portReg_;