27 _offset = pins[0].getOffset();
28 _PIN = pins[0].getPIN();
29 _PORT = pins[0].getPORT();
30 _DDR = pins[0].getDDR();
31 _numbers[0] = pins[0].getNumber();
34 for (
int i = 1; i < N; i++) {
35 if (_DDR != pins[i].
getDDR()) {
38 _offset |= pins[i].getOffset();
39 _numbers[i] = pins[i].getNumber();
52 uint8_t status = *_PIN;
53 if ((status & _offset) == _offset) {
54 return (value == HIGH);
55 }
else if ((status | _ioffset) == _ioffset) {
56 return (value == LOW);
70 uint8_t status = *_PIN;
71 if ((status & _offset) == _offset) {
72 return (value == LOW);
73 }
else if ((status | _ioffset) == _ioffset) {
74 return (value == HIGH);
86 uint8_t oldSREG = SREG;
158 uint8_t status = *_DDR;
159 if ((status & _offset) == _offset) {
161 }
else if ((status | _ioffset) == _ioffset) {
174 uint8_t status = *_PORT;
175 if ((status & _offset) == _offset) {
177 }
else if ((status | _ioffset) == _ioffset) {
190 uint8_t status = *_PIN;
191 if ((status & _offset) == _offset) {
193 }
else if ((status | _ioffset) == _ioffset) {
215 void set(uint8_t mode, uint8_t state) {
216 uint8_t oldSREG = SREG;
237 uint8_t oldSREG = SREG;
253 uint8_t oldSREG = SREG;
267 uint8_t oldSREG = SREG;
277 uint8_t oldSREG = SREG;
287 uint8_t oldSREG = SREG;
297 uint8_t oldSREG = SREG;
308 uint8_t oldSREG = SREG;
319 uint8_t oldSREG = SREG;
329 uint8_t oldSREG = SREG;
339 uint8_t oldSREG = SREG;
349 uint8_t oldSREG = SREG;
360 uint8_t oldSREG = SREG;
371 uint8_t oldSREG = SREG;
381 uint8_t oldSREG = SREG;
392 volatile uint8_t* _PIN;
393 volatile uint8_t* _PORT;
394 volatile uint8_t* _DDR;
void setInput()
Set the pin mode to input.
Class for fast operations on Arduino I/O pins.
uint8_t getOffset()
Get the pin offset.
void setState(uint8_t state)
Set the pin state.
uint8_t getState()
Get the state of the pin from the PORT register.
#define DDR_LOW
Set the DDR register to LOW for the pin.
void setInputPullupOff()
Set the pin mode to input and the pin pullup resistor to off.
uint8_t getInverseOffset()
Get the inverse pin offset.
bool isValid()
Check the group to ensure all pins use the same registers.
volatile uint8_t * getPORT()
Get a pointer to the PORT register.
void setOutput()
Set the pin mode to output.
#define PORT_TOGGLE
Set the PORT register to the inverse for the pin.
void setPullupOff()
Set the pin pullup resistor to off.
bool operator!=(uint8_t value)
Compare the value of the pin.
uint8_t getValue()
Get the value of the pin from the PIN register.
Fast operations on Arduino I/O pins.
void setLow()
Set the pin output to LOW.
#define DDR_HIGH
Set the DDR register to HIGH for the pin.
void setOutputHigh()
Set the pin mode to output and the pin output to HIGH.
void setMode(uint8_t mode)
Set the pin mode.
#define PORT_HIGH
Set the PORT register to HIGH for the pin.
void toggleMode()
Toggle the pin mode (OUTPUT -> INPUT, INPUT -> OUTPUT)
void setOutputLow()
Set the pin mode to output and the pin output to LOW.
PinGroup & operator=(uint8_t state)
Set the pin state.
#define PORT_LOW
Set the PORT register to LOW for the pin.
void setPullupOn()
Set the pin pullup resistor to on.
volatile uint8_t * getDDR()
Get a pointer to the DDR register.
Class for simultaneous operations on Arduino I/O pins.
PinGroup(Pin(&pins)[N])
Default constructor.
void setHigh()
Set the pin output to HIGH.
uint8_t getMode()
Get the mode of the pin from the DDR register.
bool operator==(uint8_t value)
Compare the value of the pin.
uint8_t * getNumbers()
Get the pin numbers.
volatile uint8_t * getPIN()
Get a pointer to the PIN register.
void toggleState()
Toggle the pin state (HIGH -> LOW, LOW -> HIGH)
#define DDR_TOGGLE
Set the DDR register to the inverse for the pin.
void setInputPullupOn()
Set the pin mode to input and the pin pullup resistor to on.