Class for simultaneous operations on Arduino I/O pins.
More...
#include <PinGroup.h>
|
template<size_t N> |
| PinGroup (Pin(&pins)[N]) |
| Default constructor.
|
|
bool | operator== (uint8_t value) |
| Compare the value of the pin.
|
|
bool | operator!= (uint8_t value) |
| Compare the value of the pin.
|
|
PinGroup & | operator= (uint8_t state) |
| Set the pin state.
|
|
uint8_t * | getNumbers () |
| Get the pin numbers.
|
|
uint8_t | getOffset () |
| Get the pin offset.
|
|
uint8_t | getInverseOffset () |
| Get the inverse pin offset.
|
|
volatile uint8_t * | getPIN () |
| Get a pointer to the PIN register.
|
|
volatile uint8_t * | getPORT () |
| Get a pointer to the PORT register.
|
|
volatile uint8_t * | getDDR () |
| Get a pointer to the DDR register.
|
|
uint8_t | getMode () |
| Get the mode of the pin from the DDR register.
|
|
uint8_t | getState () |
| Get the state of the pin from the PORT register.
|
|
uint8_t | getValue () |
| Get the value of the pin from the PIN register.
|
|
bool | isValid () |
| Check the group to ensure all pins use the same registers.
|
|
void | set (uint8_t mode, uint8_t state) |
| Set the pin mode and pin state.
|
|
void | setMode (uint8_t mode) |
| Set the pin mode.
|
|
void | setState (uint8_t state) |
| Set the pin state.
|
|
void | setInput () |
| Set the pin mode to input.
|
|
void | setPullupOn () |
| Set the pin pullup resistor to on.
|
|
void | setPullupOff () |
| Set the pin pullup resistor to off.
|
|
void | setInputPullupOn () |
| Set the pin mode to input and the pin pullup resistor to on.
|
|
void | setInputPullupOff () |
| Set the pin mode to input and the pin pullup resistor to off.
|
|
void | setOutput () |
| Set the pin mode to output.
|
|
void | setHigh () |
| Set the pin output to HIGH.
|
|
void | setLow () |
| Set the pin output to LOW.
|
|
void | setOutputHigh () |
| Set the pin mode to output and the pin output to HIGH.
|
|
void | setOutputLow () |
| Set the pin mode to output and the pin output to LOW.
|
|
void | toggleMode () |
| Toggle the pin mode (OUTPUT -> INPUT, INPUT -> OUTPUT)
|
|
void | toggleState () |
| Toggle the pin state (HIGH -> LOW, LOW -> HIGH)
|
|
Class for simultaneous operations on Arduino I/O pins.
- Author
- Alec Fenichel
- Examples
- Pin-Group.ino.
Definition at line 18 of file PinGroup.h.
◆ PinGroup()
template<size_t N>
PinGroup::PinGroup |
( |
Pin(&) |
pins[N] | ) |
|
|
inline |
Default constructor.
- Parameters
-
Definition at line 26 of file PinGroup.h.
◆ getDDR()
volatile uint8_t * PinGroup::getDDR |
( |
| ) |
|
|
inline |
Get a pointer to the DDR register.
- Returns
- pointer to the DDR register
Definition at line 148 of file PinGroup.h.
◆ getInverseOffset()
uint8_t PinGroup::getInverseOffset |
( |
| ) |
|
|
inline |
Get the inverse pin offset.
- Returns
- inverse pin offset
Definition at line 121 of file PinGroup.h.
◆ getMode()
uint8_t PinGroup::getMode |
( |
| ) |
|
|
inline |
Get the mode of the pin from the DDR register.
- Returns
- mode of the pin (OUTPUT, INPUT, -1)
Definition at line 157 of file PinGroup.h.
◆ getNumbers()
uint8_t * PinGroup::getNumbers |
( |
| ) |
|
|
inline |
Get the pin numbers.
- Returns
- array of pin numbers
Definition at line 103 of file PinGroup.h.
◆ getOffset()
uint8_t PinGroup::getOffset |
( |
| ) |
|
|
inline |
Get the pin offset.
- Returns
- pin offset
Definition at line 112 of file PinGroup.h.
◆ getPIN()
volatile uint8_t * PinGroup::getPIN |
( |
| ) |
|
|
inline |
Get a pointer to the PIN register.
- Returns
- pointer to the PIN register
Definition at line 130 of file PinGroup.h.
◆ getPORT()
volatile uint8_t * PinGroup::getPORT |
( |
| ) |
|
|
inline |
Get a pointer to the PORT register.
- Returns
- pointer to the PORT register
Definition at line 139 of file PinGroup.h.
◆ getState()
uint8_t PinGroup::getState |
( |
| ) |
|
|
inline |
Get the state of the pin from the PORT register.
- Returns
- state of the pin (HIGH, LOW, -1)
Definition at line 173 of file PinGroup.h.
◆ getValue()
uint8_t PinGroup::getValue |
( |
| ) |
|
|
inline |
Get the value of the pin from the PIN register.
- Returns
- value of the pin (HIGH, LOW, -1)
Definition at line 189 of file PinGroup.h.
◆ isValid()
bool PinGroup::isValid |
( |
| ) |
|
|
inline |
Check the group to ensure all pins use the same registers.
- Returns
- true if the pins in the group all use the same registers, false otherwise
- Examples
- Pin-Group.ino.
Definition at line 205 of file PinGroup.h.
◆ operator!=()
bool PinGroup::operator!= |
( |
uint8_t |
value | ) |
|
|
inline |
Compare the value of the pin.
- Parameters
-
value | the state of the pin (HIGH, LOW) |
- Returns
- true if the value of all of the pins are not equal to the value passed in, false otherwise
Definition at line 69 of file PinGroup.h.
◆ operator=()
PinGroup & PinGroup::operator= |
( |
uint8_t |
state | ) |
|
|
inline |
Set the pin state.
- Parameters
-
state | the state of the pin (HIGH, LOW) |
Definition at line 85 of file PinGroup.h.
◆ operator==()
bool PinGroup::operator== |
( |
uint8_t |
value | ) |
|
|
inline |
Compare the value of the pin.
- Parameters
-
value | the state of the pin (HIGH, LOW) |
- Returns
- true if the value of all of the pins are equal to the value passed in, false otherwise
Definition at line 51 of file PinGroup.h.
◆ set()
void PinGroup::set |
( |
uint8_t |
mode, |
|
|
uint8_t |
state |
|
) |
| |
|
inline |
Set the pin mode and pin state.
- Parameters
-
mode | the mode of the pin (OUTPUT, INPUT) |
state | the state of the pin (HIGH, LOW) |
Definition at line 215 of file PinGroup.h.
◆ setHigh()
void PinGroup::setHigh |
( |
| ) |
|
|
inline |
Set the pin output to HIGH.
Definition at line 328 of file PinGroup.h.
◆ setInput()
void PinGroup::setInput |
( |
| ) |
|
|
inline |
Set the pin mode to input.
Definition at line 266 of file PinGroup.h.
◆ setInputPullupOff()
void PinGroup::setInputPullupOff |
( |
| ) |
|
|
inline |
Set the pin mode to input and the pin pullup resistor to off.
Definition at line 307 of file PinGroup.h.
◆ setInputPullupOn()
void PinGroup::setInputPullupOn |
( |
| ) |
|
|
inline |
Set the pin mode to input and the pin pullup resistor to on.
Definition at line 296 of file PinGroup.h.
◆ setLow()
void PinGroup::setLow |
( |
| ) |
|
|
inline |
Set the pin output to LOW.
Definition at line 338 of file PinGroup.h.
◆ setMode()
void PinGroup::setMode |
( |
uint8_t |
mode | ) |
|
|
inline |
Set the pin mode.
- Parameters
-
mode | the mode of the pin (OUTPUT, INPUT) |
Definition at line 236 of file PinGroup.h.
◆ setOutput()
void PinGroup::setOutput |
( |
| ) |
|
|
inline |
◆ setOutputHigh()
void PinGroup::setOutputHigh |
( |
| ) |
|
|
inline |
Set the pin mode to output and the pin output to HIGH.
Definition at line 348 of file PinGroup.h.
◆ setOutputLow()
void PinGroup::setOutputLow |
( |
| ) |
|
|
inline |
Set the pin mode to output and the pin output to LOW.
Definition at line 359 of file PinGroup.h.
◆ setPullupOff()
void PinGroup::setPullupOff |
( |
| ) |
|
|
inline |
Set the pin pullup resistor to off.
Definition at line 286 of file PinGroup.h.
◆ setPullupOn()
void PinGroup::setPullupOn |
( |
| ) |
|
|
inline |
Set the pin pullup resistor to on.
Definition at line 276 of file PinGroup.h.
◆ setState()
void PinGroup::setState |
( |
uint8_t |
state | ) |
|
|
inline |
Set the pin state.
- Parameters
-
state | the state of the pin (HIGH, LOW) |
Definition at line 252 of file PinGroup.h.
◆ toggleMode()
void PinGroup::toggleMode |
( |
| ) |
|
|
inline |
Toggle the pin mode (OUTPUT -> INPUT, INPUT -> OUTPUT)
Definition at line 370 of file PinGroup.h.
◆ toggleState()
void PinGroup::toggleState |
( |
| ) |
|
|
inline |
The documentation for this class was generated from the following file: