ruuvi.drivers.c
${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
|
#include "ruuvi_driver_error.h"
#include "ruuvi_interface_gpio.h"
#include "ruuvi_interface_gpio_interrupt.h"
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | rt_button_init_t |
Struct for initializing buttons. More... | |
Typedefs | |
typedef void(* | rt_button_fp_t) (const ri_gpio_evt_t event) |
Called on button event with the slope of edge. More... | |
Functions | |
rd_status_t | rt_button_init (const rt_button_init_t *const rt_init) |
Button initialization function. More... | |
rd_status_t | rt_button_uninit (const rt_button_init_t *const rt_init) |
Button uninitialization function. More... | |
Definition in file ruuvi_task_button.h.
typedef void(* rt_button_fp_t) (const ri_gpio_evt_t event) |
Called on button event with the slope of edge.
[in] | event | Slope of the button event, RI_GPIO_SLOPE_LOTOHI or RI_GPIO_SLOPE_HITOLO. |
Definition at line 28 of file ruuvi_task_button.h.
rd_status_t rt_button_init | ( | const rt_button_init_t *const | rt_init | ) |
Button initialization function.
Requires GPIO and interrupts to be initialized. Configures GPIO as pullup/-down according to button active state.
[in] | rt_init | Initialization structure for button task. |
RD_SUCCESS | If buttons were initialized. |
RD_ERROR_NULL | If any array of rt_init is NULL or any element of p_button_pins or p_button_active is NULL. |
RD_ERROR_INVALID_STATE | if GPIO or GPIO interrupts aren't initialized. |
RD_ERROR_INVALID_PARAM | if the GPIOs arent useable, e.g. pin 48 on board with 32 GPIO pins or invalid active state. |
RD_ERROR_NOT_ENABLED | if the driver module is not enabled at compile time. |
Definition at line 113 of file ruuvi_task_button.c.
rd_status_t rt_button_uninit | ( | const rt_button_init_t *const | rt_init | ) |
Button uninitialization function.
After calling this function the given button pins are configured as High-Z and their interrupts are disabled.
RD_SUCCESS | |
RD_ERROR_NULL | If any array of rt_init is NULL or any element of p_button_pins NULL. |
Definition at line 118 of file ruuvi_task_button.c.