TM STM32Fxxx HAL Libraries  v1.0.0
Libraries for STM32Fxxx (F0, F4 and F7 series) devices based on HAL drivers from ST from Tilen Majerle

Library Functions. More...

Functions

TM_BUTTON_tTM_BUTTON_Init (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint8_t ButtonState, void(*ButtonHandler)(TM_BUTTON_t *, TM_BUTTON_PressType_t))
 Initializes a new button to library. More...
 
TM_BUTTON_tTM_BUTTON_SetPressTime (TM_BUTTON_t *ButtonStruct, uint16_t Normal, uint16_t Long)
 Sets press timing values. More...
 
void TM_BUTTON_Update (void)
 Updates buttons. This function have to be called periodically. More...
 

Detailed Description

Library Functions.

Function Documentation

TM_BUTTON_t* TM_BUTTON_Init ( GPIO_TypeDef *  GPIOx,
uint16_t  GPIO_Pin,
uint8_t  ButtonState,
void(*)(TM_BUTTON_t *, TM_BUTTON_PressType_t ButtonHandler 
)

Initializes a new button to library.

Note
This library uses malloc() to allocate memory, so make sure you have enough heap memory
Parameters
*GPIOxPointer to GPIOx where button is located
GPIO_PinGPIO pin where button is located
ButtonStateButton state when it is pressed.
  • 0: Button is low when pressed
  • > 0: Button is high when pressed
*ButtonHandler
Return values
Buttoncreation status:
  • 0: Button was not created
  • > 0: Button created and saved to library, button pointer is returned
TM_BUTTON_t* TM_BUTTON_SetPressTime ( TM_BUTTON_t ButtonStruct,
uint16_t  Normal,
uint16_t  Long 
)

Sets press timing values.

Parameters
*ButtonStructPointer to TM_BUTTON_t structure for button used
NormalTime that button must be pressed to indicate normal press. Value is in milliseconds
NormalTime that button must be pressed to indicate long press. Value is in milliseconds
Return values
Pointerto TM_BUTTON_t
void TM_BUTTON_Update ( void  )

Updates buttons. This function have to be called periodically.

Note
Function will automatically call callback functions for buttons if needed
Parameters
None
Return values
None