Zumo32U4 library
|
#include <FastGPIO.h>
Static Public Member Functions | |
static void | setOutputLow () __attribute__((always_inline)) |
Configures the pin to be an output driving low. More... | |
static void | setOutputHigh () __attribute__((always_inline)) |
Configures the pin to be an output driving high. More... | |
static void | setOutputToggle () __attribute__((always_inline)) |
Configures the pin to be an output and toggles it. More... | |
static void | setOutput (bool value) __attribute__((always_inline)) |
Sets the pin as an output. More... | |
static void | setOutputValueLow () __attribute__((always_inline)) |
Sets the output value of the pin to 0. More... | |
static void | setOutputValueHigh () __attribute__((always_inline)) |
Sets the output value of the pin to 1. More... | |
static void | setOutputValueToggle () __attribute__((always_inline)) |
Toggles the output value of the pin. More... | |
static void | setOutputValue (bool value) __attribute__((always_inline)) |
Sets the output value of the pin. More... | |
static void | setInput () __attribute__((always_inline)) |
Sets a pin to be a digital input with the internal pull-up resistor disabled. More... | |
static void | setInputPulledUp () __attribute__((always_inline)) |
Sets a pin to be a digital input with the internal pull-up resistor enabled. More... | |
static bool | isInputHigh () __attribute__((always_inline)) |
Reads the input value of the pin. More... | |
static bool | isOutput () __attribute__((always_inline)) |
Returns 1 if the pin is configured as an output. More... | |
static bool | isOutputValueHigh () __attribute__((always_inline)) |
Returns the output value of the pin. More... | |
static uint8_t | getState () |
Returns the full 2-bit state of the pin. More... | |
static void | setState (uint8_t state) |
Sets the full 2-bit state of the pin. More... | |
pin | The pin number |
The FastGPIO::Pin class provides static functions for manipulating pins. This class can only be used if the pin number is known at compile time, which means it does not come from a variable that might change and it does not come from the result of a complicated calculation.
Here is some example code showing how to use this class to blink an LED:
Definition at line 275 of file FastGPIO.h.
|
inlinestatic |
Returns the full 2-bit state of the pin.
Bit 0 of this function's return value is the pin's output value. Bit 1 of the return value is the pin direction; a value of 1 means output. All the other bits are zero.
Definition at line 454 of file FastGPIO.h.
|
inlinestatic |
Reads the input value of the pin.
Definition at line 410 of file FastGPIO.h.
|
inlinestatic |
Returns 1 if the pin is configured as an output.
Definition at line 432 of file FastGPIO.h.
|
inlinestatic |
Returns the output value of the pin.
This is mainly intended to be called on pins that have been configured an an output. If it is called on an input pin, the return value indicates whether the pull-up resistor is enabled or not.
Definition at line 443 of file FastGPIO.h.
|
inlinestatic |
Sets a pin to be a digital input with the internal pull-up resistor disabled.
Definition at line 391 of file FastGPIO.h.
|
inlinestatic |
Sets a pin to be a digital input with the internal pull-up resistor enabled.
Definition at line 400 of file FastGPIO.h.
|
inlinestatic |
Sets the pin as an output.
value | Should be 0, LOW, or false to drive the pin low. Should be 1, HIGH, or true to drive the pin high. |
The PORT bit is set before the DDR bit to ensure that the output is not accidentally driven to the wrong value during the transition.
Definition at line 318 of file FastGPIO.h.
|
inlinestatic |
Configures the pin to be an output driving high.
This is equivalent to calling setOutput with an argument of 1, but it has a simpler implementation which means it is more likely to be compiled down to just 2 assembly instructions.
Definition at line 296 of file FastGPIO.h.
|
inlinestatic |
Configures the pin to be an output driving low.
This is equivalent to calling setOutput with an argument of 0, but it has a simpler implementation which means it is more likely to be compiled down to just 2 assembly instructions.
Definition at line 284 of file FastGPIO.h.
|
inlinestatic |
Configures the pin to be an output and toggles it.
Definition at line 304 of file FastGPIO.h.
|
inlinestatic |
Sets the output value of the pin.
value | Should be 0, LOW, or false to drive the pin low. Should be 1, HIGH, or true to drive the pin high. |
This is mainly intended to be used on pins that have already been configured as an output.
If this function is used on an input pin, it has the effect of toggling setting the state of the input pin's pull-up resistor.
Definition at line 376 of file FastGPIO.h.
|
inlinestatic |
Sets the output value of the pin to 1.
This is mainly intended to be used on pins that have already been configured as an output in order to make the output drive low.
If this is used on an input pin, it has the effect of enabling the input pin's pull-up resistor.
Definition at line 345 of file FastGPIO.h.
|
inlinestatic |
Sets the output value of the pin to 0.
This is mainly intended to be used on pins that have already been configured as an output in order to make the output drive low.
If this is used on an input pin, it has the effect of disabling the input pin's pull-up resistor.
Definition at line 332 of file FastGPIO.h.
|
inlinestatic |
Toggles the output value of the pin.
This is mainly intended to be used on pins that have already been configured as an output. If the pin was driving low, this function changes it to drive high. If the pin was driving high, this function changes it to drive low.
If this function is used on an input pin, it has the effect of toggling the state of the input pin's pull-up resistor.
Definition at line 360 of file FastGPIO.h.
|
inlinestatic |
Sets the full 2-bit state of the pin.
state | The state of the pin, as returns from getState. All bits other than bits 0 and 1 are ignored. |
Sometimes this function will need to change both the PORT bit (which specifies the output value) and the DDR bit (which specifies whether the pin is an output). If the DDR bit is getting set to 0, this function changes DDR first, and if it is getting set to 1, this function changes DDR last. This guarantees that the intermediate pin state is always an input state.
Definition at line 486 of file FastGPIO.h.