FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
API that manipulates one digital IO pin of a given port. More...
#include <fastarduino/gpio.h>
Public Member Functions | |
FastPin () INLINE | |
Construct a FastPin without any physical setup on target MCU. More... | |
FastPin (PinMode mode, bool value=false) INLINE | |
Construct a FastPin with the given mode and initial value. More... | |
void | set_mode (PinMode mode, bool value=false) INLINE |
Set mode (direction) and value (if output) of this pin. More... | |
void | set () INLINE |
Set pin level to HIGH (i.e. More... | |
void | clear () INLINE |
Set pin level to LOW (i.e. More... | |
void | toggle () INLINE |
Toggle pin level, i.e. More... | |
bool | value () INLINE |
Return the current level of this pin. More... | |
Static Public Attributes | |
static constexpr const board::Port | PORT = PORT_ |
The port to which this pin belongs. More... | |
static constexpr const uint8_t | BIT = BIT_ |
The bit position (from 0 to 7 ), in port, of this pin. More... | |
static constexpr const uint8_t | MASK = bits::BV8(BIT) |
The bit-mask to use when accessing DPIN through PORT . More... | |
API that manipulates one digital IO pin of a given port.
Implementation is highly optimized for size and speed: instances use no SRAM at all, most common methods use only 1 AVR instruction.
Note that, although it has public constructors, you generally do not construct FastPin
instances directly. You better use FastPinType
, which is directly provided a board::DigitalPin
constant, or even better, use FAST_PIN
alias type. You may also obtain a FastPin
instance through FastPort::get_pin()
.
PORT_ | the target port to which this pin belongs |
BIT_ | the bit position (from 0 to 7 ), in port, of this pin; note that if this position is not mapped to a physical IO of the MCU target, then a compilation error will occur. |
|
inline |
|
inline |
Construct a FastPin
with the given mode and initial value.
The pin mode is forced on the target MCU.
mode | the mode of this pin |
value | the initial pin level, if mode == PinMode::OUTPUT ; not used otherwise. |
|
inline |
Set mode (direction) and value (if output) of this pin.
mode | the mode of this pin |
value | the initial pin level, if mode == PinMode::OUTPUT ; not used otherwise. |
|
inline |
|
inline |
|
inline |
|
inline |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |