MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
Push button driver board support

Typedefs

typedef void(* pb_callback) (void *pb)
 Type alias pb_callback for the push button callback. More...
 

Functions

int PB_Init (void)
 Initialize all push buttons. More...
 
int PB_RegisterCallback (unsigned int pb, pb_callback callback)
 Register or Unregister a callback handler for events on the pb push button. More...
 
int PB_RegisterRiseFallCallback (unsigned int pb, pb_callback callback)
 Register or Unregister a callback handler for rising and falling events on the pb push button. More...
 
void PB_IntEnable (unsigned int pb)
 Enable a callback interrupt. More...
 
void PB_IntDisable (unsigned int pb)
 Disable a callback interrupt. More...
 
void PB_IntClear (unsigned int pb)
 Clear a callback interrupt. More...
 
int PB_Get (unsigned int pb)
 Get the current state of the push button. More...
 

Variables

const gpio_cfg_t pb_pin []
 
const unsigned int num_pbs
 

Detailed Description

Typedef Documentation

◆ pb_callback

typedef void(* pb_callback) (void *pb)

The function is of type:

void pb_callback(void * pb)

To receive notification of a push button event, define a callback function and pass it as a pointer to the PB_RegisterCallback(unsigned int pb, pb_callback callback) function.

Parameters
pbPointer to the push button index that triggered the callback.

Function Documentation

◆ PB_Init()

int PB_Init ( void  )
Returns
E_NO_ERROR Push buttons initialized successfully.
"Error Code" Error Code if unsuccessful.

◆ PB_RegisterCallback()

int PB_RegisterCallback ( unsigned int  pb,
pb_callback  callback 
)
  • Calling this function with a pointer to a function callback, configures the pushbutton pb and enables the interrupt to handle the push button events.
  • Calling this function with a NULL pointer will disable the interrupt and unregister the callback function. pb must be a value between 0 and num_pbs.
Parameters
pbpush button index to receive event callbacks.
callbackCallback function pointer of type pb_callback
Returns
E_NO_ERROR if configured and callback registered successfully.
"Error Code" Error Code if unsuccessful.

◆ PB_RegisterRiseFallCallback()

int PB_RegisterRiseFallCallback ( unsigned int  pb,
pb_callback  callback 
)
  • Calling this function with a pointer to a function callback, configures the pushbutton pb and enables the interrupt to handle the push button events.
  • Calling this function with a NULL pointer will disable the interrupt and unregister the callback function. pb must be a value between 0 and num_pbs.
Parameters
pbpush button index to receive event callbacks.
callbackCallback function pointer of type pb_callback
Returns
E_NO_ERROR if configured and callback registered successfully.
"Error Code" Error Code if unsuccessful.

◆ PB_IntEnable()

void PB_IntEnable ( unsigned int  pb)
Note
PB_RegisterCallback must be called prior to enabling the callback interrupt.
Parameters
pbpush button index value between 0 and num_pbs.

◆ PB_IntDisable()

void PB_IntDisable ( unsigned int  pb)
Parameters
pbpush button index

◆ PB_IntClear()

void PB_IntClear ( unsigned int  pb)
Parameters
pbpush button index value between 0 and num_pbs.

◆ PB_Get()

int PB_Get ( unsigned int  pb)
Parameters
pbpush button index value between 0 and num_pbs.
Returns
TRUE The button is pressed.
FALSE The button is not pressed.