|
#define | GPIO_PIN(reg, bit) {&PIN##reg, &DDR##reg, &PORT##reg, 1 << bit} |
|
Fast Digital I/O functions and template class.
#define GPIO_PIN |
( |
|
reg, |
|
|
|
bit |
|
) |
| {&PIN##reg, &DDR##reg, &PORT##reg, 1 << bit} |
static void badPinCheck |
( |
uint8_t |
pin | ) |
|
|
inlinestatic |
Check for valid pin number
- Parameters
-
[in] | pin | Number of pin to be checked. |
void badPinNumber |
( |
void |
| ) |
|
generate bad pin number error
static volatile uint8_t* ddrReg |
( |
uint8_t |
pin | ) |
|
|
inlinestatic |
DDR register address
- Parameters
-
[in] | pin | Arduino pin number |
- Returns
- register address
static void fastBitWriteSafe |
( |
volatile uint8_t * |
address, |
|
|
uint8_t |
mask, |
|
|
bool |
level |
|
) |
| |
|
inlinestatic |
Fast write helper.
- Parameters
-
[in] | address | I/O register address |
[in] | mask | bit mask for pin |
[in] | level | value for bit |
static void fastDdrWrite |
( |
uint8_t |
pin, |
|
|
bool |
level |
|
) |
| |
|
inlinestatic |
Write the DDR register.
- Parameters
-
[in] | pin | Arduino pin number |
[in] | level | value to write |
static bool fastDigitalRead |
( |
uint8_t |
pin | ) |
|
|
inlinestatic |
Read pin value.
- Parameters
-
[in] | pin | Arduino pin number |
- Returns
- value read
static void fastDigitalToggle |
( |
uint8_t |
pin | ) |
|
|
inlinestatic |
Toggle a pin.
- Parameters
-
[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.
static void fastDigitalWrite |
( |
uint8_t |
pin, |
|
|
bool |
level |
|
) |
| |
|
inlinestatic |
Set pin value.
- Parameters
-
[in] | pin | Arduino pin number |
[in] | level | value to write |
static void fastPinConfig |
( |
uint8_t |
pin, |
|
|
uint8_t |
mode, |
|
|
bool |
level |
|
) |
| |
|
inlinestatic |
set pin configuration
- Parameters
-
[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. |
static void fastPinMode |
( |
uint8_t |
pin, |
|
|
uint8_t |
mode |
|
) |
| |
|
inlinestatic |
Set pin mode.
- Parameters
-
[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.
static uint8_t pinMask |
( |
uint8_t |
pin | ) |
|
|
inlinestatic |
Bit mask for pin
- Parameters
-
[in] | pin | Arduino pin number |
- Returns
- mask
static volatile uint8_t* pinReg |
( |
uint8_t |
pin | ) |
|
|
inlinestatic |
PIN register address
- Parameters
-
[in] | pin | Arduino pin number |
- Returns
- register address
static volatile uint8_t* portReg |
( |
uint8_t |
pin | ) |
|
|
inlinestatic |
PORT register address
- Parameters
-
[in] | pin | Arduino pin number |
- Returns
- register address