|
Simone: a game of visual memory and speed
|
Portable functions to interact with the button FSM library. All portable functions must be implemented in this file. More...
#include <stdio.h>#include "port_button.h"#include "port_system.h"#include "stm32f4_system.h"#include "stm32f4_button.h"Functions | |
| stm32f4_button_hw_t * | _stm32f4_button_get (uint8_t button_id) |
| Get the button struct with the given ID. More... | |
| 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... | |
Variables | |
| stm32f4_button_hw_t | buttons_arr [] |
| Array of elements that represents the HW characteristics of the buttons connected to the STM32F4 platform. More... | |
Portable functions to interact with the button FSM library. All portable functions must be implemented in this file.
| stm32f4_button_hw_t* _stm32f4_button_get | ( | uint8_t | button_id | ) |
Get the button struct with the given ID.
| button_id | Button ID. |
| 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 |
| stm32f4_button_hw_t buttons_arr[] |
Array of elements that represents the HW characteristics of the buttons connected to the STM32F4 platform.
Array of elements that represents the HW characteristics of the buttons.
This is an extern variable that is declared in stm32f4_button.h. It represents an array of hardware buttons.