Added toggle switch widget.
This commit is contained in:
@@ -49,4 +49,16 @@ void set_selected_menu_entry_idx(volatile pixel_t *const framebuffer, graphical_
|
||||
void decrement_selected_menu_entry_idx(volatile pixel_t *const framebuffer, graphical_menu_t *const menu);
|
||||
void increment_selected_menu_entry_idx(volatile pixel_t *const framebuffer, graphical_menu_t *const menu);
|
||||
|
||||
/*
|
||||
* Add a toggle switch to the menu entry
|
||||
* It is used to draw additional graphics on top of the menu entry
|
||||
* Arguments:
|
||||
* - menu_entry_size: the size of the menu entry
|
||||
* - toggle_switch_value: (bool *) the value of the toggle switch
|
||||
*
|
||||
* Can be used as a callback function for the extra_draw_function field in the graphical_menu_entry_t struct
|
||||
* This is why toggle_switch_value is a void pointer and not a bool pointer
|
||||
*/
|
||||
void add_toggle_switch_to_menu_entry(const menu_entry_size_t *const menu_entry_size, void *const toggle_switch_value);
|
||||
|
||||
#endif
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
#include "stdbool.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
@@ -53,7 +53,8 @@ extern "C" {
|
||||
void Error_Handler(void);
|
||||
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
extern volatile bool led1_state;
|
||||
extern volatile bool led2_state;
|
||||
/* USER CODE END EFP */
|
||||
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
@@ -384,13 +385,15 @@ void Error_Handler(void);
|
||||
#define OK_BUTTON_PRESSED() (HAL_GPIO_ReadPin(BUTTON4_GPIO_Port, BUTTON4_Pin) == GPIO_PIN_RESET)
|
||||
#define UP_BUTTON_PRESSED() (HAL_GPIO_ReadPin(BUTTON5_GPIO_Port, BUTTON5_Pin) == GPIO_PIN_RESET)
|
||||
|
||||
#define LED1_ON() (HAL_GPIO_WritePin(LD3_GPIO_Port, LD3_Pin, GPIO_PIN_SET))
|
||||
#define LED1_OFF() (HAL_GPIO_WritePin(LD3_GPIO_Port, LD3_Pin, GPIO_PIN_RESET))
|
||||
#define LED1_TOGGLE() (HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin))
|
||||
#define LED1_ON() led1_state = true;
|
||||
#define LED1_OFF() led1_state = false;
|
||||
#define LED1_TOGGLE() led1_state = !led1_state;
|
||||
#define LED1_STATE() (led1_state)
|
||||
|
||||
#define LED2_ON() (HAL_GPIO_WritePin(LD4_GPIO_Port, LD4_Pin, GPIO_PIN_SET))
|
||||
#define LED2_OFF() (HAL_GPIO_WritePin(LD4_GPIO_Port, LD4_Pin, GPIO_PIN_RESET))
|
||||
#define LED2_TOGGLE() (HAL_GPIO_TogglePin(LD4_GPIO_Port, LD4_Pin))
|
||||
#define LED2_ON() led2_state = true;
|
||||
#define LED2_OFF() led2_state = false;
|
||||
#define LED2_TOGGLE() led2_state = !led2_state;
|
||||
#define LED2_STATE() (led2_state)
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "stdbool.h"
|
||||
|
||||
void ui_left_button_pressed(void);
|
||||
void ui_right_button_pressed(void);
|
||||
void ui_up_button_pressed(void);
|
||||
void ui_down_button_pressed(void);
|
||||
void ui_ok_button_pressed(void);
|
||||
|
||||
Reference in New Issue
Block a user