|
Simone: a game of visual memory and speed
|
Header for the portable functions to interact with the HW of the buttons. The functions must be implemented in the platform-specific code. More...
#include <stdint.h>#include <stdbool.h>Macros | |
| #define | PORT_USER_BUTTON_ID |
| #define | PORT_USER_BUTTON_DEBOUNCE_TIME_MS |
Functions | |
| void | port_button_init (uint8_t button_id) |
| Configure the HW specifications of a given button. More... | |
| bool | port_button_get_pressed (uint8_t button_id) |
| Return the status of the button (pressed or not). More... | |
Header for the portable functions to interact with the HW of the buttons. The functions must be implemented in the platform-specific code.
| #define PORT_USER_BUTTON_DEBOUNCE_TIME_MS |
Button debounce time in milliseconds
| #define PORT_USER_BUTTON_ID |
User button identifier that represents the button to start and config the game
| bool port_button_get_pressed | ( | uint8_t | button_id | ) |
Return the status of the button (pressed or not).
TODO alumnos:
✅ 1. Return the value of the field
flag_pressed. Call the function_stm32f4_button_get()to get the button struct.
| button_id | Button ID. This index is used to get the correct button status struct. |
| void port_button_init | ( | uint8_t | button_id | ) |
Configure the HW specifications of a given button.
Assuming we are using an STM32F4-based platform, this function must call the following functions:
TODO alumnos: ✅ 1. Retrieve the button configuration struct calling
_stm32f4_button_get()
✅ 2. Call functionstm32f4_system_gpio_config()with the right arguments to configure the button as input and no pull up neither pull down connection
✅ 3. Call functionstm32f4_system_gpio_config_exti()with the right arguments to configure interruption mode in both rising and falling edges, and enable the interrupt request
✅ 4. Call functionstm32f4_system_gpio_exti_enable()with the right parameters to enable the interrupt line and set the priority level to1and the subpriority level to0
| button_id | Button ID. This index is used to select the element of the buttons_arr[] array |