WIP
This commit is contained in:
@@ -5,10 +5,14 @@
|
||||
|
||||
#define DISPLAY_WIDTH 240
|
||||
#define DISPLAY_HEIGHT 320
|
||||
#define PIXEL_FORMAT_565
|
||||
//#define PIXEL_FORMAT_888
|
||||
|
||||
typedef uint16_t rgb565_pixel_t;
|
||||
typedef uint32_t rgb888_pixel_t;
|
||||
|
||||
|
||||
#ifdef PIXEL_FORMAT_565
|
||||
typedef rgb565_pixel_t pixel_t;
|
||||
|
||||
#define PIXEL_RED(p) (((p) >> 11) & 0x1F)
|
||||
#define PIXEL_GREEN(p) (((p) >> 5) & 0x3F)
|
||||
@@ -16,13 +20,20 @@ typedef uint16_t rgb565_pixel_t;
|
||||
|
||||
#define MAKE_PIXEL(r,g,b) \
|
||||
(((r & 0x1F) << 11) | ((g & 0x3F) << 5) | (b & 0x1F))
|
||||
#endif // PIXEL_FORMAT_565
|
||||
|
||||
|
||||
extern volatile rgb565_pixel_t framebuffer[DISPLAY_HEIGHT * DISPLAY_WIDTH];
|
||||
extern volatile uint32_t times_changed;
|
||||
#ifdef PIXEL_FORMAT_888
|
||||
typedef rgb888_pixel_t pixel_t;
|
||||
|
||||
#define PIXEL_RED(p) (((p) >> 16) & 0xFF)
|
||||
#define PIXEL_GREEN(p) (((p) >> 8) & 0xFF)
|
||||
#define PIXEL_BLUE(p) ((p) & 0xFF)
|
||||
|
||||
void DisplayTest(uint16_t color);
|
||||
#define MAKE_PIXEL(r,g,b) \
|
||||
(((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF))
|
||||
#endif // PIXEL_FORMAT_888
|
||||
|
||||
extern volatile pixel_t framebuffer[DISPLAY_HEIGHT * DISPLAY_WIDTH];
|
||||
|
||||
#endif
|
||||
@@ -5,6 +5,14 @@
|
||||
#include "display.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
// Font declarations - fonts are defined in separate .c files to avoid static variable conflicts
|
||||
#if LVGL_VERSION_MAJOR >= 8
|
||||
extern const lv_font_t roboto_bold_font;
|
||||
extern const lv_font_t roboto_bold_large_font;
|
||||
#else
|
||||
extern lv_font_t roboto_bold_font;
|
||||
extern lv_font_t roboto_bold_large_font;
|
||||
#endif
|
||||
|
||||
uint16_t draw_character(rgb565_pixel_t *framebuffer, const lv_font_t *font, const uint16_t x_loc, const uint16_t y_loc, const uint8_t character, rgb565_pixel_t color);
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
*
|
||||
* This layer includes a lot of code from lv_font_fmt_txt.h to define how
|
||||
* a bitmapped font is expressed.
|
||||
*
|
||||
* See:
|
||||
* - https://github.com/lvgl/lv_font_conv
|
||||
* - https://github.com/lvgl/lvgl/blob/master/src/font/lv_font.h
|
||||
* - https://github.com/lvgl/lvgl/blob/master/src/font/fmt_txt/lv_font_fmt_txt.h
|
||||
*
|
||||
* - Dylan
|
||||
*/
|
||||
|
||||
#ifndef LVGL_H
|
||||
@@ -15,13 +22,27 @@
|
||||
#include "stdint.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
/* Dummy Defines */
|
||||
#define LV_ATTRIBUTE_LARGE_CONST
|
||||
#define LV_FONT_SUBPX_NONE 0
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/******************************************* */
|
||||
/* Dummy defines for LVGL font compatibility */
|
||||
|
||||
#ifndef LV_ATTRIBUTE_LARGE_CONST
|
||||
#define LV_ATTRIBUTE_LARGE_CONST
|
||||
#endif
|
||||
|
||||
#ifndef LV_FONT_SUBPX_NONE
|
||||
#define LV_FONT_SUBPX_NONE 0
|
||||
#endif
|
||||
|
||||
#ifndef LVGL_VERSION_MAJOR
|
||||
#define LVGL_VERSION_MAJOR 7
|
||||
#define LV_VERSION_CHECK(X,Y,Z) 0
|
||||
#endif
|
||||
|
||||
/******************** */
|
||||
/* Struct Definitions */
|
||||
|
||||
typedef struct _lv_font_t lv_font_t;
|
||||
1483
Core/Inc/graphics/fonts/roboto_bold_large_font.h
Normal file
1483
Core/Inc/graphics/fonts/roboto_bold_large_font.h
Normal file
File diff suppressed because it is too large
Load Diff
10
Core/Inc/graphics/graphics.h
Normal file
10
Core/Inc/graphics/graphics.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef GRAPHICS_H
|
||||
#define GRAPHICS_H
|
||||
|
||||
#include "display.h"
|
||||
#include "stdint.h"
|
||||
|
||||
void DisplayTest(pixel_t color);
|
||||
void DrawBox(uint32_t topleft_x_loc, uint32_t topleft_y_loc, uint32_t height, uint32_t width, pixel_t color);
|
||||
|
||||
#endif
|
||||
25
Core/Inc/graphics/menu.h
Normal file
25
Core/Inc/graphics/menu.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef MENU_H
|
||||
#define MENU_H
|
||||
|
||||
#include "stdint.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *title;
|
||||
bool enabled; // not enabled = grayed out, unselectable
|
||||
void *highlighted_callback_function;
|
||||
void *selected_callback_function;
|
||||
} graphical_menu_entry_t;
|
||||
|
||||
|
||||
typedef struct _graphical_menu_t graphical_menu_t;
|
||||
struct _graphical_menu_t {
|
||||
graphical_menu_t *parent_menu;
|
||||
uint8_t num_entries;
|
||||
uint8_t highlighted_idx;
|
||||
graphical_menu_entry_t *entries;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user