MiraOS GPIO driver.
More...
#include <stdint.h>
Go to the source code of this file.
|
void | mira_gpio_init (MiraGpioPorts port, uint8_t pin, MiraGpioPinMode mode, MiraGpioPullMode pull_mode) |
| Initialize a GPIO pin. More...
|
|
uint8_t | mira_gpio_read (MiraGpioPorts port, uint8_t pin) |
| Read an input pin. More...
|
|
void | mira_gpio_set (MiraGpioPorts port, uint8_t pin) |
| Set an output pin (logic high output). More...
|
|
void | mira_gpio_clear (MiraGpioPorts port, uint8_t pin) |
| Clear an output pin (logic low output). More...
|
|
void | mira_gpio_setup_interrupt (MiraGpioPorts port, uint8_t pin, MiraGpioInterruptType irq_type, MiraGpioCallbackType callback) |
| Configure an GPIO interrupt. More...
|
|
void | mira_gpio_enable_interrupt (MiraGpioPorts port, uint8_t pin) |
| Enables an GPIO interrupt. More...
|
|
void | mira_gpio_disable_interrupt (MiraGpioPorts port, uint8_t pin) |
| Disables an GPIO interrupt. More...
|
|
MiraOS GPIO driver.
- Author
- LumenRadio AB
- Date
- 5 March 2016 The MiraOS library provides functions for controlling the Mira radio module, sending/receiving messages, controlling peripherals, etc.
- See also
- http://docs.lumenrad.io/mira
typedef void(* MiraGpioCallbackType) (uint8_t port, uint8_t pin) |
Type definition for callbacks invoked by the GPIO ISRs.
This is the prototype of a function pointer passed to mira_gpio_setup_interrupt(). These callbacks are registered on a port/pin basis. When a GPIO port generates an interrupt, if a callback has been registered for the port/pin combination, the ISR will invoke it. The ISR will pass the port/pin as arguments in that call, so that a developer can re-use the same callback for multiple port/pin combinations
- Parameters
-
port | The port that triggered the GPIO interrupt. |
pin | The pin that triggered the interrupt |
- Returns
- void
GPIO edge trigger.
Enumerator |
---|
MiraGpioIrqRisingEdge |
Interrupt triggers on rising edge
|
MiraGpioIrqFallingEdge |
Interrupt triggers on falling edge
|
MiraGpioIrqBothEdges |
Interrupt triggers on both rising and falling edges
|
Clear an output pin (logic low output).
- Parameters
-
port | The port where the pin is located (Port A, B, C) |
pin | Pin number within the port |
- Returns
- void
void mira_gpio_disable_interrupt |
( |
MiraGpioPorts |
port, |
|
|
uint8_t |
pin |
|
) |
| |
Disables an GPIO interrupt.
- Parameters
-
port | The port where the pin is located (Port A, B, C) |
pin | Pin number within the port |
- Returns
- void
void mira_gpio_enable_interrupt |
( |
MiraGpioPorts |
port, |
|
|
uint8_t |
pin |
|
) |
| |
Enables an GPIO interrupt.
- Parameters
-
port | The port where the pin is located (Port A, B, C) |
pin | Pin number within the port |
- Returns
- void
Initialize a GPIO pin.
- Parameters
-
port | The port where the pin is located (Port A, B, C) |
pin | Pin number within the port |
mode | Input or output |
pull_mode | Pull-up/pull-down mode |
- Returns
- void
Read an input pin.
- Parameters
-
port | The port where the pin is located (Port A, B, C) |
pin | Pin number within the port |
- Returns
- logic level at input pin
Set an output pin (logic high output).
- Parameters
-
port | The port where the pin is located (Port A, B, C) |
pin | Pin number within the port |
- Returns
- void
Configure an GPIO interrupt.
If both edges are used as trigger, this will not be able to wake up processor from deep sleep. Only rising or falling edges may be used as wake-up triggers.
- Parameters
-
port | The port where the pin is located (Port A, B, C) |
pin | Pin number within the port |
irq_type | The interrupt type (falling, rising or both edges) |
callback | The callback function that will be invoked by the ISR |
- Returns
- void