Midnight Sun Firmware
Loading...
Searching...
No Matches
BUTTON

Driver for an individual GPIO-connected button with debounce and edge-triggered callbacks. More...

Classes

struct  ButtonCallbacks
 Button Callbacks. More...
 
struct  ButtonConfig
 Button configuration structure. More...
 
struct  Button
 Button instance structure. More...
 

Typedefs

typedef struct Button Button
 Button instance structure.
 

Enumerations

enum  ButtonState { BUTTON_IDLE , BUTTON_PRESSED }
 Button states representing current input. More...
 

Functions

StatusCode button_init (Button *button, ButtonConfig *config)
 Initialize a button instance. More...
 
StatusCode button_update (Button *button)
 Update the Button state based on the given GPIO state. More...
 

Detailed Description

Driver for an individual GPIO-connected button with debounce and edge-triggered callbacks.

Enumeration Type Documentation

◆ ButtonState

Button states representing current input.

Enumerator
BUTTON_IDLE 

Button is not pressed

BUTTON_PRESSED 

Button is pressed

Function Documentation

◆ button_init()

StatusCode button_init ( Button button,
ButtonConfig config 
)

Initialize a button instance.

Parameters
buttonPointer to the Button instance to initialize
configPointer to the ButtonConfig structure
Returns
STATUS_CODE_OK if initialized successfully STATUS_CODE_INVALID_ARGS if an invalid parameter is passed in

◆ button_update()

StatusCode button_update ( Button button)

Update the Button state based on the given GPIO state.

Parameters
buttonPointer to the Button instance
Returns
STATUS_CODE_OK if initialized successfully STATUS_CODE_INVALID_ARGS if an invalid parameter is passed in