|
ruuvi.drivers.c ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
|
Go to the source code of this file.
Macros | |
| #define | RI_GPIO_ID_UNUSED 0xFFFF |
| Enable implementation selected by application. | |
Typedefs | |
| typedef uint16_t | ri_gpio_id_t |
| port<<8 + pin | |
Enumerations | |
| enum | ri_gpio_mode_t { RI_GPIO_MODE_HIGH_Z , RI_GPIO_MODE_INPUT_NOPULL , RI_GPIO_MODE_INPUT_PULLUP , RI_GPIO_MODE_INPUT_PULLDOWN , RI_GPIO_MODE_OUTPUT_STANDARD , RI_GPIO_MODE_OUTPUT_HIGHDRIVE , RI_GPIO_MODE_SINK_PULLUP_STANDARD , RI_GPIO_MODE_SINK_NOPULL_STANDARD , RI_GPIO_MODE_SINK_PULLUP_HIGHDRIVE , RI_GPIO_MODE_SINK_NOPULL_HIGHDRIVE } |
| enum | ri_gpio_state_t { RI_GPIO_LOW = false , RI_GPIO_HIGH = true } |
| States of GPIO pins. More... | |
Functions | |
| rd_status_t | ri_gpio_init (void) |
| Initializes GPIO module. Call this before other GPIO functions. After initialization all GPIO pins shall be in High-Z mode. | |
| rd_status_t | ri_gpio_uninit (void) |
| Uninitializes GPIO module. Call this to reset GPIO to High-Z mode. After uninitialization all GPIO pins shall be in High-Z mode. Uninitialization can be called at any time, but behaviour is not defined if some other peripheral (i.e. SPI) is using GPIO pins. | |
| bool | ri_gpio_is_init (void) |
| return true if GPIO is init, false otherwise. | |
| rd_status_t | ri_gpio_configure (const ri_gpio_id_t pin, const ri_gpio_mode_t mode) |
| Configure a pin of a port into a mode. If there are several ports the platform driver must implement a conversion function from port + pin to uint8_t. | |
| rd_status_t | ri_gpio_toggle (const ri_gpio_id_t pin) |
| Toggle the state of a pin of a port. If there are several ports the platform driver must implement a conversion function from port + pin to uint8_t. | |
| rd_status_t | ri_gpio_write (const ri_gpio_id_t pin, const ri_gpio_state_t state) |
| Write a pin of a port into given state If there are several ports the platform driver must implement a conversion function from port + pin to uint8_t. | |
| rd_status_t | ri_gpio_read (const ri_gpio_id_t pin, ri_gpio_state_t *const p_state) |
| Read state of a pin of a port into bool high If there are several ports the platform driver must implement a conversion function from port + pin to uint8_t. | |
Interface for basic GPIO writes and reads
Definition in file ruuvi_interface_gpio.h.
| #define RI_GPIO_ID_UNUSED 0xFFFF |
Enable implementation selected by application.
Use this value to signal that nothing should be done with this gpio, i.e. UART CTS not used.
Definition at line 29 of file ruuvi_interface_gpio.h.
| typedef uint16_t ri_gpio_id_t |
port<<8 + pin
Definition at line 60 of file ruuvi_interface_gpio.h.
| enum ri_gpio_mode_t |
GPIO modes supported by interface. If the underlying platform does not support given mode, it shall return RD_ERROR_NOT_SUPPORTED on configuration attempt.
Definition at line 36 of file ruuvi_interface_gpio.h.
| enum ri_gpio_state_t |
States of GPIO pins.
| Enumerator | |
|---|---|
| RI_GPIO_LOW | GPIO electrically low. |
| RI_GPIO_HIGH | GPIO electrically high. |
Definition at line 53 of file ruuvi_interface_gpio.h.