|
| FastMaskedPort ()=default |
| Construct a FastMaskedPort without any physical setup on target MCU. More...
|
|
| FastMaskedPort (uint8_t ddr, uint8_t port=0) |
| Construct a FastMaskedPort for the pins selected by the provide bits mask, with the given direction byte and initial values byte. More...
|
|
void | set_PORT (uint8_t port) INLINE |
| Set the 8-bits value for port PORT register, this value will be masked according to the provided bit mask provided in constructor. More...
|
|
uint8_t | get_PORT () INLINE |
| Get the current 8-bit value of port PORT register, masked according to the bit mask provided at construction time. More...
|
|
void | set_DDR (uint8_t ddr) INLINE |
| Set the 8-bits value for port DDR (direction) register, this value will be masked according to the provided bit mask provided in constructor. More...
|
|
uint8_t | get_DDR () INLINE |
| Get the current 8-bit value of port DDR (direction) register, masked according to the bit mask provided at construction time. More...
|
|
void | set_PIN (uint8_t pin) INLINE |
| Set the 8-bits value for port PIN register, this value will be masked according to the provided bit mask provided in constructor. More...
|
|
uint8_t | get_PIN () INLINE |
| Get the current 8-bit value of PIN register for this port, masked according to the bit mask provided at construction time. More...
|
|
template<
board::Port PORT_, uint8_t MASK_>
class gpio::FastMaskedPort< PORT_, MASK_ >
API that manipulates a part of a digital IO port.
Implementation is highly optimized for size and speed: instances use 1 byte SRAM only.
Using this API allows you to manipulate several pins of a port at once, but without having to care for other pins of that port: the API always ensure that only those selected pins get modified. This is useful when, for instance, you handle a 4x4 keypad with one port, 4 pins out and 4 pins in, then you can define 2 FastMaskedPort
instances, one for output pins, the other for input pins.
Note that, although more efficient than using individual FastPin
s, it is not as efficient as using only one single FastPort
to handle all its pins.
- Template Parameters
-
PORT_ | the target port |
MASK_ | the bit mask determining which pins of the port are handled by this instance; only these pins will be impacted by FastMaskedPort methods. |
- See also
- board::Port
Definition at line 379 of file gpio.h.
Set the 8-bits value for port PORT register, this value will be masked according to the provided bit mask provided in constructor.
If a pin is set currently set as output, then the matching bit in port
will set the output level of this pin. If a pin is set currently as input, then the matching bit in port
defines if a pullup resistor is used or not.
- Parameters
-
port | the initial values for PORT register of this port; each
bit is for one pin of the port, its meaning depends on the pin direction: if input, then it fixes if pullup resistor should be used, if output, then it fixes the output level of the pin. |
- See also
- set_DDR()
Definition at line 439 of file gpio.h.
Get the current 8-bit value of port PORT register, masked according to the bit mask provided at construction time.
Each bit maps to a pin configuration in this port. For all pins not part of the mask, returned value is 0
. Depending on DDR configuration for a pin, the PORT value is interpreted differently: for an input pin, the matching PORT bit indicates if this pin has a pullup register on it.
- Returns
- the value of PORT register masked with constructor-provided bit mask
Definition at line 455 of file gpio.h.