MySensors Library & Examples  2.3.2
Classes | Macros | Functions | Variables
Fast Pin I/O

Detailed Description

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
 

Macro Definition Documentation

◆ fastPinConfig

#define fastPinConfig (   pin,
  mode,
  level 
)    {fastPinMode(pin, mode); fastDigitalWrite(pin, level);}

set pin configuration

Parameters
[in]pinArduino pin number
[in]modemode INPUT or OUTPUT.
[in]levelIf 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.

◆ GPIO_PIN

#define GPIO_PIN (   reg,
  bit 
)    {&PIN##reg, &DDR##reg, &PORT##reg, 1 << bit}

Initializer macro.

Definition at line 41 of file DigitalPin.h.

Function Documentation

◆ badPinNumber()

void badPinNumber ( void  ) const

generate bad pin number error

Variable Documentation

◆ __attribute__

static __attribute__
inline

Doxygen will complain without this comment.

DDR register address

Parameters
[in]pinArduino pin number
Returns
register address

Bit mask for pin

Parameters
[in]pinArduino pin number
Returns
mask

PIN register address

Parameters
[in]pinArduino pin number
Returns
register address

PORT register address

Parameters
[in]pinArduino pin number
Returns
register address

Fast write helper.

Parameters
[in]addressI/O register address
[in]maskbit mask for pin
[in]levelvalue for bit

Read pin value.

Parameters
[in]pinArduino pin number
Returns
value read

Toggle a pin.

Parameters
[in]pinArduino 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.

Parameters
[in]pinArduino pin number
[in]levelvalue to write

Write the DDR register.

Parameters
[in]pinArduino pin number
[in]levelvalue to write

Set pin mode.

Parameters
[in]pinArduino pin number
[in]modeINPUT, 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

else
Initial value:
{
*address &= ~mask

Definition at line 120 of file DigitalPin.h.

◆ level

static bool level
Initial value:
{
uint8_t s

Definition at line 112 of file DigitalPin.h.

◆ mode

uint8_t mode
Initial value:
{
fastDdrWrite(pin, mode == OUTPUT)

Definition at line 185 of file DigitalPin.h.