ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_task_button.c File Reference

Go to the source code of this file.

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...
 

Detailed Description

Author
Otso Jousimaa otso@.nosp@m.ojou.nosp@m.sima..nosp@m.net
Date
2020-01-25

Definition in file ruuvi_task_button.c.

Function Documentation

◆ rt_button_init()

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.

Parameters
[in]rt_initInitialization structure for button task.
Return values
RD_SUCCESSIf buttons were initialized.
RD_ERROR_NULLIf any array of rt_init is NULL or any element of p_button_pins or p_button_active is NULL.
RD_ERROR_INVALID_STATEif GPIO or GPIO interrupts aren't initialized.
RD_ERROR_INVALID_PARAMif the GPIOs arent useable, e.g. pin 48 on board with 32 GPIO pins or invalid active state.
RD_ERROR_NOT_ENABLEDif the driver module is not enabled at compile time.
Note
This function can be called without uninitialization to reconfigure.
Warning
Behaviour is undefined if lengths of arrays don't match num_buttons.
If error occurs while intializing pins the task calls rt_button_unit with the original initialization structure.

Definition at line 113 of file ruuvi_task_button.c.

◆ rt_button_uninit()

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.

Return values
RD_SUCCESS
RD_ERROR_NULLIf 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.