mirror of
https://github.com/m5stack/lv_m5_emulator.git
synced 2026-05-20 11:19:24 -07:00
Update clang-format and apply code formatting
This commit is contained in:
+4
-8
@@ -1,7 +1,5 @@
|
||||
---
|
||||
Language: Cpp
|
||||
BasedOnStyle: Google
|
||||
AccessModifierOffset: -1
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: true
|
||||
AlignConsecutiveAssignments: true
|
||||
@@ -29,7 +27,7 @@ BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
@@ -42,7 +40,7 @@ BraceWrapping:
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
@@ -163,6 +161,4 @@ StatementMacros:
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
...
|
||||
|
||||
UseTab: Never
|
||||
+4
-2
@@ -7,7 +7,8 @@ extern void user_app(void);
|
||||
|
||||
M5GFX gfx;
|
||||
|
||||
void setup(void) {
|
||||
void setup(void)
|
||||
{
|
||||
gfx.init();
|
||||
|
||||
lvgl_port_init(gfx);
|
||||
@@ -15,7 +16,8 @@ void setup(void) {
|
||||
user_app();
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
void loop(void)
|
||||
{
|
||||
#if defined(ARDUINO) && defined(ESP_PLATFORM)
|
||||
delay(10);
|
||||
#elif !defined(ARDUINO) && (__has_include(<SDL2/SDL.h>) || __has_include(<SDL.h>))
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
#include "lvgl_port_m5stack.hpp"
|
||||
#include "demos/lv_demos.h"
|
||||
|
||||
void user_app(void) {
|
||||
void user_app(void)
|
||||
{
|
||||
// You can test the lvgl default demo
|
||||
// /*
|
||||
if (lvgl_port_lock()) {
|
||||
|
||||
@@ -17,11 +17,13 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(ARDUINO) && defined(ESP_PLATFORM)
|
||||
static void lvgl_tick_timer(void *arg) {
|
||||
static void lvgl_tick_timer(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
lv_tick_inc(10);
|
||||
}
|
||||
static void lvgl_rtos_task(void *pvParameter) {
|
||||
static void lvgl_rtos_task(void *pvParameter)
|
||||
{
|
||||
(void)pvParameter;
|
||||
while (1) {
|
||||
if (pdTRUE == xSemaphoreTake(xGuiSemaphore, portMAX_DELAY)) {
|
||||
@@ -32,14 +34,16 @@ static void lvgl_rtos_task(void *pvParameter) {
|
||||
}
|
||||
}
|
||||
#elif !defined(ARDUINO) && (__has_include(<SDL2/SDL.h>) || __has_include(<SDL.h>))
|
||||
static uint32_t lvgl_tick_timer(uint32_t interval, void *param) {
|
||||
static uint32_t lvgl_tick_timer(uint32_t interval, void *param)
|
||||
{
|
||||
(void)interval;
|
||||
(void)param;
|
||||
lv_tick_inc(10);
|
||||
return 10;
|
||||
}
|
||||
|
||||
static int lvgl_sdl_thread(void *data) {
|
||||
static int lvgl_sdl_thread(void *data)
|
||||
{
|
||||
(void)data;
|
||||
while (1) {
|
||||
if (SDL_LockMutex(xGuiMutex) == 0) {
|
||||
@@ -54,7 +58,8 @@ static int lvgl_sdl_thread(void *data) {
|
||||
|
||||
#if LVGL_USE_V8 == 1
|
||||
static lv_disp_draw_buf_t draw_buf;
|
||||
static void lvgl_flush_cb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) {
|
||||
static void lvgl_flush_cb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
|
||||
{
|
||||
M5GFX &gfx = *(M5GFX *)disp->user_data;
|
||||
int w = (area->x2 - area->x1 + 1);
|
||||
int h = (area->y2 - area->y1 + 1);
|
||||
@@ -89,7 +94,8 @@ static void lvgl_flush_cb(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t
|
||||
lv_disp_flush_ready(disp);
|
||||
}
|
||||
|
||||
static void lvgl_read_cb(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) {
|
||||
static void lvgl_read_cb(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
|
||||
{
|
||||
M5GFX &gfx = *(M5GFX *)indev_driver->user_data;
|
||||
uint16_t touchX, touchY;
|
||||
|
||||
@@ -103,7 +109,8 @@ static void lvgl_read_cb(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) {
|
||||
}
|
||||
}
|
||||
|
||||
void lvgl_port_init(M5GFX &gfx) {
|
||||
void lvgl_port_init(M5GFX &gfx)
|
||||
{
|
||||
lv_init();
|
||||
|
||||
#if defined(ARDUINO) && defined(ESP_PLATFORM)
|
||||
@@ -173,7 +180,8 @@ void lvgl_port_init(M5GFX &gfx) {
|
||||
#endif
|
||||
}
|
||||
#elif LVGL_USE_V9 == 1
|
||||
static void lvgl_flush_cb(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map) {
|
||||
static void lvgl_flush_cb(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map)
|
||||
{
|
||||
M5GFX &gfx = *(M5GFX *)lv_display_get_driver_data(disp);
|
||||
|
||||
uint32_t w = (area->x2 - area->x1 + 1);
|
||||
@@ -209,7 +217,8 @@ static void lvgl_flush_cb(lv_display_t *disp, const lv_area_t *area, uint8_t *px
|
||||
lv_display_flush_ready(disp);
|
||||
}
|
||||
|
||||
static void lvgl_read_cb(lv_indev_t *indev, lv_indev_data_t *data) {
|
||||
static void lvgl_read_cb(lv_indev_t *indev, lv_indev_data_t *data)
|
||||
{
|
||||
M5GFX &gfx = *(M5GFX *)lv_indev_get_driver_data(indev);
|
||||
uint16_t touchX, touchY;
|
||||
|
||||
@@ -223,7 +232,8 @@ static void lvgl_read_cb(lv_indev_t *indev, lv_indev_data_t *data) {
|
||||
}
|
||||
}
|
||||
|
||||
void lvgl_port_init(M5GFX &gfx) {
|
||||
void lvgl_port_init(M5GFX &gfx)
|
||||
{
|
||||
lv_init();
|
||||
|
||||
static lv_display_t *disp = lv_display_create(gfx.width(), gfx.height());
|
||||
@@ -296,7 +306,8 @@ void lvgl_port_init(M5GFX &gfx) {
|
||||
}
|
||||
#endif
|
||||
|
||||
bool lvgl_port_lock(void) {
|
||||
bool lvgl_port_lock(void)
|
||||
{
|
||||
#if defined(ARDUINO) && defined(ESP_PLATFORM)
|
||||
return xSemaphoreTake(xGuiSemaphore, portMAX_DELAY) == pdTRUE ? true : false;
|
||||
#elif !defined(ARDUINO) && (__has_include(<SDL2/SDL.h>) || __has_include(<SDL.h>))
|
||||
@@ -304,7 +315,8 @@ bool lvgl_port_lock(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void lvgl_port_unlock(void) {
|
||||
void lvgl_port_unlock(void)
|
||||
{
|
||||
#if defined(ARDUINO) && defined(ESP_PLATFORM)
|
||||
xSemaphoreGive(xGuiSemaphore);
|
||||
#elif !defined(ARDUINO) && (__has_include(<SDL2/SDL.h>) || __has_include(<SDL.h>))
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
__attribute__((weak)) int user_func(bool *running) {
|
||||
__attribute__((weak)) int user_func(bool *running)
|
||||
{
|
||||
setup();
|
||||
do {
|
||||
loop();
|
||||
@@ -12,7 +13,8 @@ __attribute__((weak)) int user_func(bool *running) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int, char **) {
|
||||
int main(int, char **)
|
||||
{
|
||||
// The second argument is effective for step execution with breakpoints.
|
||||
// You can specify the time in milliseconds to perform slow execution that ensures screen updates.
|
||||
return lgfx::Panel_sdl::main(user_func, 128);
|
||||
|
||||
Reference in New Issue
Block a user