![]() |
MySensors Library & Examples
2.3.2-62-ge298769
|
Fast Digital I/O functions and template class.
Classes | |
| struct | GpioPinMap_t |
| class | DigitalPin< PinNumber > |
| Fast digital port I/O. More... | |
Macros | |
| #define | GPIO_PIN(reg, bit) {&PIN##reg, &DDR##reg, &PORT##reg, 1 << bit} |
| #define | fastPinConfig(pin, mode, level) {fastPinMode(pin, mode); fastDigitalWrite(pin, level);} |
Functions | |
| void | badPinNumber (void) __attribute__((error("Pin number is too large or not a const ant"))) |
| if (address > reinterpret_cast< uint8_t * >(0X3F)) | |
| if (level) | |
| if (mode !=OUTPUT) | |
Variables | |
| static uint8_t | mask |
| static uint8_t bool | level |
| else | |
| static uint8_t | mode |
| #define fastPinConfig | ( | pin, | |
| mode, | |||
| level | |||
| ) | {fastPinMode(pin, mode); fastDigitalWrite(pin, level);} |
set pin configuration
| [in] | pin | Arduino pin number |
| [in] | mode | mode INPUT or OUTPUT. |
| [in] | level | If mode is output, set level high/low. If mode is input, enable or disable the pin's 20K pullup. |
Definition at line 310 of file DigitalPin.h.
| #define GPIO_PIN | ( | reg, | |
| bit | |||
| ) | {&PIN##reg, &DDR##reg, &PORT##reg, 1 << bit} |
Initializer macro.
Definition at line 41 of file DigitalPin.h.
| void badPinNumber | ( | void | ) | const |
generate bad pin number error
|
inline |
Doxygen will complain without this comment.
DDR register address
| [in] | pin | Arduino pin number |
Bit mask for pin
| [in] | pin | Arduino pin number |
PIN register address
| [in] | pin | Arduino pin number |
PORT register address
| [in] | pin | Arduino pin number |
Fast write helper.
| [in] | address | I/O register address |
| [in] | mask | bit mask for pin |
| [in] | level | value for bit |
Read pin value.
| [in] | pin | Arduino pin number |
Toggle a pin.
| [in] | pin | Arduino pin number |
If the pin is in output mode toggle the pin level. If the pin is in input mode toggle the state of the 20K pullup.
Set pin value.
| [in] | pin | Arduino pin number |
| [in] | level | value to write |
Write the DDR register.
| [in] | pin | Arduino pin number |
| [in] | level | value to write |
Set pin mode.
| [in] | pin | Arduino pin number |
| [in] | mode | INPUT, OUTPUT, or INPUT_PULLUP. |
The internal pullup resistors will be enabled if mode is INPUT_PULLUP and disabled if the mode is INPUT.
Definition at line 65 of file DigitalPin.h.
| else |
Definition at line 120 of file DigitalPin.h.
| static bool level |
Definition at line 112 of file DigitalPin.h.
| uint8_t mode |
Definition at line 185 of file DigitalPin.h.