void (*userButtonStateChangedCallback)(bool); ///< Function called when the button state changes. The bool parameter is true if the button was released.
/**
* @brief Initializes the button module.
* @param stateChangedCallback function 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.
*/
void but_Init(void (*stateChangedCallback)(bool))
{
GPIO_InitTypeDef GPIO_InitStruct;
EXTI_InitTypeDef EXTI_InitStruct;
NVIC_InitTypeDef NVIC_InitStruct;
// Initialize the pin as input.
GPIO_InitStruct.GPIO_Pin = BOARD_BUTTON_PIN;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(BOARD_BUTTON_PORT, &GPIO_InitStruct);
// Optionally setup the callback that triggers when the button is pressed or