FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
API that manipulates a given digital IO pin of a the target MCU. More...
#include <fastarduino/gpio.h>
Public Types | |
using | TYPE = FastPin< PORT, BIT > |
The exact FastPin parameterized type for DPIN IO pin. More... | |
using | PORT_TYPE = FastPort< PORT > |
The exact FastPort parameterized type that DPIN IO pin belongs to. More... | |
Static Public Member Functions | |
static void | set_mode (PinMode mode, bool value=false) |
Set mode (direction) and value (if output) of DPIN . More... | |
static void | set () |
Set pin level to HIGH (i.e. More... | |
static void | clear () |
Set pin level to LOW (i.e. More... | |
static void | toggle () |
Toggle pin level, i.e. More... | |
static bool | value () |
Return the current level pin DPIN . More... | |
Static Public Attributes | |
static constexpr const board::DigitalPin | DPIN = DPIN_ |
The digital pin for this FastPinType. More... | |
static constexpr const board::Port | PORT = TRAIT::PORT |
The port to which DPIN belongs. More... | |
static constexpr const uint8_t | BIT = TRAIT::BIT |
The bit position of DPIN within its port. More... | |
static constexpr const uint8_t | MASK = bits::BV8(BIT) |
The bit-mask to use when accessing DPIN through PORT . More... | |
API that manipulates a given digital IO pin of a the target MCU.
It provides static methods to directly manipulate an IO pin (mode, level...) but it also helps you find out the exact FastPin
type for a given IO pin.
Implementation is highly optimized for size and speed: it uses no SRAM at all, most common methods use only 1 AVR instruction.
The following snippet demonstrates usage of FastPinType
to declare a FastPin
instance for later use in a function:
The next snippet demonstrate direct use of FastPinType
static methods, when you don't need an instance of FastPin
:
DPIN_ | a unique digital pin for the MCU target |
using gpio::FastPinType< DPIN_ >::TYPE = FastPin<PORT, BIT> |
using gpio::FastPinType< DPIN_ >::PORT_TYPE = FastPort<PORT> |
|
inlinestatic |
Set mode (direction) and value (if output) of DPIN
.
mode | the mode of PIN |
value | the initial pin level, if mode == PinMode::OUTPUT ; not used otherwise. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
staticconstexpr |
The digital pin for this FastPinType.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |