ow-dash-cube/Core/Src/dashboard.c
2025-09-15 14:32:20 +02:00

77 lines
2.3 KiB
C

#include "dashboard.h"
#include "font.h"
#include "monomaniacone12pt.h"
#include "monomaniacone14pt.h"
#include "monomaniacone20pt.h"
#include "monomaniacone72pt.h"
void run_dashboard_loop() {
init();
while (1) {
}
}
void init() {
LCD_Init();
draw_init();
}
void update_values() {
// UART send 0201 04 4084 03
}
void update_values_setup() {
// UART send 0201 2F D58D 03
}
void update_adc() {
// UART send 0201 20 2462 03
}
void LCD_DrawHollowRoundRect(
uint16_t x,
uint16_t y,
uint16_t w,
uint16_t h,
uint8_t radius_top,
uint8_t radius_bottom,
uint8_t border_width,
uint16_t color,
uint16_t fill_color,
uint8_t do_fill);
void draw_init() {
LCD_Fill_Screen(COLOR_OFF, 1);
LCD_Fill_Screen(COLOR_BG, 0);
GFX_DrawChar(40, 40, '!', &monomaniacone20pt, COLOR_PRIMARY, COLOR_BG);
GFX_DrawChar(60, 40, '2', &monomaniacone20pt, COLOR_PRIMARY, COLOR_BG);
GFX_DrawChar(80, 40, '3', &monomaniacone20pt, COLOR_SECONDARY, COLOR_BG);
GFX_DrawChar(100, 40, '4', &monomaniacone20pt, COLOR_SECONDARY, COLOR_BG);
GFX_DrawChar(120, 40, '5', &monomaniacone20pt, COLOR_ERROR, COLOR_BG);
GFX_DrawText(LCD_WIDTH / 2, 50, "Bonjour Monsieur !", &monomaniacone12pt,
COLOR_SECONDARY, COLOR_BG, 1, -2);
GFX_DrawText(LCD_WIDTH / 2, 70, "Bonjour Monsieur !", &monomaniacone14pt,
COLOR_SECONDARY, COLOR_BG, 1, -2);
GFX_DrawText(LCD_WIDTH / 2, 100, "Bonjour MONSieur !", &monomaniacone20pt,
COLOR_SUCCESS, COLOR_BG, 1, -2);
GFX_DrawText(LCD_WIDTH / 2, 26+95, "12", &monomaniacone72pt, COLOR_FG, COLOR_BG, 1, -5);
// Draw a rectangle with different top/bottom radii
LCD_DrawHollowRoundRect(10, 10, 100, 50, 10, 0, 4, BLACK, COLOR_PRIMARY, 1);
// Draw a pill-shaped rectangle (same radius for all corners)
LCD_DrawHollowRoundRect(20, 70, 80, 30, 15, 15, 2, COLOR_SUCCESS, 0, 0);
// Draw a square with rounded corners
LCD_DrawHollowRoundRect(50, 100, 60, 60, 10, 10, 6, COLOR_ERROR, 0, 0);
LCD_DrawHollowRoundRect(130, 100, 60, 60, 10, 10, 0, 0, COLOR_ERROR, 1);
LCD_DrawHollowRoundRect(136, 106, 48, 48, 4, 4, 0, 0, COLOR_PRIMARY, 1);
uint16_t bar_width = LCD_WIDTH - 12;
LCD_DrawHollowRoundRect(4, LCD_HEIGHT - 30, bar_width+4, 26, 8, 8, 2,
COLOR_FG, COLOR_SUCCESS, 0);
LCD_DrawHollowRoundRect(4+2, LCD_HEIGHT - 30 + 2, 0.75 * bar_width, 22, 6, 6, 0,
COLOR_FG, COLOR_SUCCESS, 1);
}