This commit is contained in:
Dylan Smith
2026-01-12 16:25:36 -05:00
parent 73005fc56b
commit 6cdbe8cb11
8 changed files with 128 additions and 26 deletions

View File

@@ -19,6 +19,7 @@
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "cmsis_os.h"
#include "graphics.h"
#include "stm32f4xx_hal_ltdc.h"
#include "stm32f4xx_hal_spi.h"
#include "usb_host.h"
@@ -27,6 +28,7 @@
/* USER CODE BEGIN Includes */
#include "display.h"
#include "font.h"
#include "menu.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -903,6 +905,15 @@ static void MX_GPIO_Init(void)
/* USER CODE BEGIN 4 */
const graphical_menu_t menu_main = {
.num_entries = 3,
.entries = (graphical_menu_entry_t[]){
{.title = "Home", .enabled = true, .highlighted_callback_function = NULL, .highlighted_callback_function_args = NULL, .selected_callback_function = NULL, .selected_callback_function_args = NULL},
{.title = "Settings", .enabled = true, .highlighted_callback_function = NULL, .highlighted_callback_function_args = NULL, .selected_callback_function = NULL, .selected_callback_function_args = NULL},
{.title = "About", .enabled = true, .highlighted_callback_function = NULL, .highlighted_callback_function_args = NULL, .selected_callback_function = NULL, .selected_callback_function_args = NULL},
}
};
/* USER CODE END 4 */
/* USER CODE BEGIN Header_StartDefaultTask */
@@ -916,25 +927,15 @@ void StartDefaultTask(void const * argument)
{
/* init code for USB_HOST */
/* USER CODE BEGIN 5 */
times_changed = 0;
ILI9341_Init();
uint8_t time_string[20] = {0};
DisplayTest(0xFFFF);
draw_menu(&menu_main);
draw_string(framebuffer, &roboto_bold_font, 10, 75, "Number of beans:", 0x0000);
/* Infinite loop */
for(;;)
{
uint32_t t = HAL_GetTick() / 100;
// Convert milliseconds to string
uint32_to_string(t, time_string, sizeof(time_string));
DrawBox(25, 0, 40, 80, 0xffff);
draw_string(framebuffer, &roboto_bold_font, 25, 25, time_string, 0x0000);
DrawBox(25, 100, 40, 150, 0xffff);
draw_string(framebuffer, &roboto_bold_large_font, 25, 125, time_string, 0x001f);
osDelay(100);
}
/* USER CODE END 5 */