HRI board firmware  v2.1
Microcontroller firmware of the board used during the HRI labs.
Functions
Driver / Button

Driver to access a button. More...

Functions

void but_Init (void(*stateChangedCallback)(bool))
 Initializes the button module. More...
 
bool but_GetState (void)
 Gets the current state of the user button. More...
 

Detailed Description

Driver to access a button.

Call but_Init() first in the initialization code. Then, call but_GetState() to read the current state of the button.

It is also possible to pass a function pointer to the but_Init() function. Then, the given function will be called automatically when the button state changes (pressed or released).

Function Documentation

◆ but_GetState()

bool but_GetState ( void  )

Gets the current state of the user button.

Returns
the state of the button (1=released, 0=pressed).

◆ but_Init()

void but_Init ( void(*)(bool)  stateChangedCallback)

Initializes the button module.

Parameters
stateChangedCallbackfunction pointer to the callback function that should be called when the button state changes. If this feature is not used, NULL can be passed instead.