diff --git a/components/board_2432s024/board_2432s024.h b/components/board_2432s024/board_2432s024.h index 5496e5f6..64070f8e 100644 --- a/components/board_2432s024/board_2432s024.h +++ b/components/board_2432s024/board_2432s024.h @@ -1,4 +1,3 @@ -#ifndef NANOBAKE_BOARD_2432S024_H #define NANOBAKE_BOARD_2432S024_H #include "board_2432s024_display.h" diff --git a/components/board_2432s024/board_2432s024_display.c b/components/board_2432s024/board_2432s024_display.c index f1fd0797..813ba02f 100644 --- a/components/board_2432s024/board_2432s024_display.c +++ b/components/board_2432s024/board_2432s024_display.c @@ -1,14 +1,13 @@ #include "board_2432s024_display.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "esp_lcd_ili9341.h" +#include "esp_log.h" +#include "esp_err.h" +#include "esp_lcd_panel_ops.h" +#include "driver/gpio.h" +#include "driver/spi_master.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" static const char* TAG = "2432s024_ili9341"; diff --git a/components/board_2432s024/board_2432s024_display.h b/components/board_2432s024/board_2432s024_display.h index de64a9f0..14aea06a 100644 --- a/components/board_2432s024/board_2432s024_display.h +++ b/components/board_2432s024/board_2432s024_display.h @@ -1,7 +1,7 @@ #ifndef NANOBAKE_BOARD_2432S024_DISPLAY_H #define NANOBAKE_BOARD_2432S024_DISPLAY_H -#include +#include "nb_display.h" extern NbDisplayDriver board_2432s024_create_display_driver(); diff --git a/components/board_2432s024/board_2432s024_touch.c b/components/board_2432s024/board_2432s024_touch.c index a8122232..b9f32e3b 100644 --- a/components/board_2432s024/board_2432s024_touch.c +++ b/components/board_2432s024/board_2432s024_touch.c @@ -1,9 +1,9 @@ #include "board_2432s024_touch.h" -#include -#include -#include -#include +#include "esp_lcd_touch_cst816s.h" +#include "esp_log.h" +#include "esp_err.h" +#include "driver/i2c.h" #define CST816_I2C_PORT (0) diff --git a/components/board_2432s024/board_2432s024_touch.h b/components/board_2432s024/board_2432s024_touch.h index 3f58a78c..9c1b1b2c 100644 --- a/components/board_2432s024/board_2432s024_touch.h +++ b/components/board_2432s024/board_2432s024_touch.h @@ -1,7 +1,7 @@ #ifndef NANOBAKE_BOARD_2432S024_TOUCH_H #define NANOBAKE_BOARD_2432S024_TOUCH_H -#include +#include "nb_touch.h" NbTouchDriver board_2432s024_create_touch_driver(); diff --git a/components/nanobake/src/applications/services/desktop/desktop.c b/components/nanobake/src/applications/services/desktop/desktop.c index 567f2ad8..1500b6c3 100644 --- a/components/nanobake/src/applications/services/desktop/desktop.c +++ b/components/nanobake/src/applications/services/desktop/desktop.c @@ -1,6 +1,6 @@ #include "desktop.h" #include "nb_hardware.h" -#include +#include "core_defines.h" static int32_t prv_desktop_main(void* param) { UNUSED(param); diff --git a/components/nanobake/src/applications/services/gui/gui.c b/components/nanobake/src/applications/services/gui/gui.c index 664800b8..96838735 100644 --- a/components/nanobake/src/applications/services/gui/gui.c +++ b/components/nanobake/src/applications/services/gui/gui.c @@ -1,19 +1,19 @@ #include "gui_i.h" #include "core_defines.h" -#include -#include +#include "record.h" +#include "check.h" -static ScreenId screen_counter = 0; +static NbScreenId screen_counter = 0; NbGuiHandle gui_alloc() { struct NbGui* gui = malloc(sizeof(struct NbGui)); - screen_dict_init(gui->screens); + ScreenDict_init(gui->screens); gui->mutex = furi_mutex_alloc(FuriMutexTypeNormal); return gui; } void gui_free(NbGuiHandle gui) { - screen_dict_clear(gui->screens); + ScreenDict_clear(gui->screens); furi_mutex_free(gui->mutex); free(gui); } @@ -28,15 +28,15 @@ void gui_unlock(NbGuiHandle gui) { furi_check(furi_mutex_release(gui->mutex) == FuriStatusOk); } -ScreenId gui_screen_create(NbGuiHandle gui, InitScreen callback) { - ScreenId id = screen_counter++; +NbScreenId gui_screen_create(NbGuiHandle gui, InitScreen callback) { + NbScreenId id = screen_counter++; NbScreen screen = { .id = id, .parent = NULL, .callback = callback }; - screen_dict_set_at(gui->screens, id, screen); + ScreenDict_set_at(gui->screens, id, screen); // TODO: notify desktop of change // TODO: have desktop update views @@ -49,26 +49,26 @@ ScreenId gui_screen_create(NbGuiHandle gui, InitScreen callback) { return id; } -lv_obj_t* gui_screen_get_parent(NbGuiHandle gui, ScreenId id) { - NbScreen* screen = screen_dict_get(gui->screens, id); +lv_obj_t* gui_screen_get_parent(NbGuiHandle gui, NbScreenId id) { + NbScreen* screen = ScreenDict_get(gui->screens, id); furi_check(screen != NULL); return screen->parent; } -void gui_screen_set_parent(NbGuiHandle gui, ScreenId id, lv_obj_t* parent) { - NbScreen* screen = screen_dict_get(gui->screens, id); +void gui_screen_set_parent(NbGuiHandle gui, NbScreenId id, lv_obj_t* parent) { + NbScreen* screen = ScreenDict_get(gui->screens, id); furi_check(screen != NULL); screen->parent = parent; } -void gui_screen_free(NbGuiHandle gui, ScreenId id) { - NbScreen* screen = screen_dict_get(gui->screens, id); +void gui_screen_free(NbGuiHandle gui, NbScreenId id) { + NbScreen* screen = ScreenDict_get(gui->screens, id); furi_check(screen != NULL); // TODO: notify? use callback? (done from desktop service) lv_obj_clean(screen->parent); - screen_dict_erase(gui->screens, id); + ScreenDict_erase(gui->screens, id); } static int32_t prv_gui_main(void* param) { diff --git a/components/nanobake/src/applications/services/gui/gui.h b/components/nanobake/src/applications/services/gui/gui.h index 79b105d5..109a0bb7 100644 --- a/components/nanobake/src/applications/services/gui/gui.h +++ b/components/nanobake/src/applications/services/gui/gui.h @@ -8,16 +8,16 @@ extern "C" { #define RECORD_GUI "gui" -typedef uint16_t ScreenId; +typedef uint16_t NbScreenId; typedef struct NbGui* NbGuiHandle; -typedef void (*InitScreen)(lv_obj_t*, ScreenId); +typedef void (*InitScreen)(lv_obj_t*, NbScreenId); -ScreenId gui_screen_create(NbGuiHandle _Nonnull gui, InitScreen callback); -void gui_screen_free(NbGuiHandle _Nonnull gui, ScreenId id); +NbScreenId gui_screen_create(NbGuiHandle _Nonnull gui, InitScreen callback); +void gui_screen_free(NbGuiHandle _Nonnull gui, NbScreenId id); // TODO make internal -void gui_screen_set_parent(NbGuiHandle _Nonnull gui, ScreenId id, lv_obj_t* parent); -lv_obj_t* gui_screen_get_parent(NbGuiHandle _Nonnull gui, ScreenId id); +void gui_screen_set_parent(NbGuiHandle _Nonnull gui, NbScreenId id, lv_obj_t* parent); +lv_obj_t* gui_screen_get_parent(NbGuiHandle _Nonnull gui, NbScreenId id); extern const NbApp gui_app; diff --git a/components/nanobake/src/applications/services/gui/gui_i.h b/components/nanobake/src/applications/services/gui/gui_i.h index c591f03f..59cc83bc 100644 --- a/components/nanobake/src/applications/services/gui/gui_i.h +++ b/components/nanobake/src/applications/services/gui/gui_i.h @@ -1,20 +1,20 @@ #pragma once #include "gui.h" -#include -#include -#include +#include "mutex.h" +#include "m-dict.h" +#include "m-core.h" typedef struct { - ScreenId id; + NbScreenId id; lv_obj_t* parent; InitScreen _Nonnull callback; } NbScreen; -DICT_DEF2(screen_dict, ScreenId, M_BASIC_OPLIST, NbScreen, M_POD_OPLIST) +DICT_DEF2(ScreenDict, NbScreenId, M_BASIC_OPLIST, NbScreen, M_POD_OPLIST) struct NbGui { // TODO: use mutex FuriMutex* mutex; - screen_dict_t screens; + ScreenDict_t screens; }; diff --git a/components/nanobake/src/applications/system/system_info/system_info.c b/components/nanobake/src/applications/system/system_info/system_info.c index 62761a00..83e56938 100644 --- a/components/nanobake/src/applications/system/system_info/system_info.c +++ b/components/nanobake/src/applications/system/system_info/system_info.c @@ -1,7 +1,7 @@ #include "system_info.h" #include "nanobake.h" -#include -#include +#include "core_defines.h" +#include "thread.h" static int32_t system_info_entry_point(void* param) { UNUSED(param); diff --git a/components/nanobake/src/nanobake.c b/components/nanobake/src/nanobake.c index 8e40dfa0..1e22ddfd 100644 --- a/components/nanobake/src/nanobake.c +++ b/components/nanobake/src/nanobake.c @@ -3,12 +3,12 @@ #include "nb_lvgl_i.h" #include "nb_app_i.h" #include "applications/nb_applications.h" -#include -#include +#include "esp_log.h" +#include "m-list.h" // Furi -#include -#include -#include +#include "thread.h" +#include "kernel.h" +#include "record.h" M_LIST_DEF(thread_ids, FuriThreadId); diff --git a/components/nanobake/src/nanobake.h b/components/nanobake/src/nanobake.h index eaeba2af..1a0b455b 100644 --- a/components/nanobake/src/nanobake.h +++ b/components/nanobake/src/nanobake.h @@ -11,7 +11,7 @@ extern "C" { // Forward declarations typedef void* FuriThreadId; -__attribute__((unused)) extern void nanobake_start(NbConfig _Nonnull * config); +__attribute__((unused)) extern void nanobake_start(NbConfig _Nonnull* config); extern FuriThreadId nanobake_get_app_thread_id(size_t index); extern size_t nanobake_get_app_thread_count(); diff --git a/components/nanobake/src/nb_app.c b/components/nanobake/src/nb_app.c index efabef37..31017cf5 100644 --- a/components/nanobake/src/nb_app.c +++ b/components/nanobake/src/nb_app.c @@ -1,5 +1,5 @@ #include "nb_app_i.h" -#include +#include "check.h" const char* prv_type_service = "service"; const char* prv_type_system = "system"; diff --git a/components/nanobake/src/nb_app.h b/components/nanobake/src/nb_app.h index 7afacabe..1c5500e6 100644 --- a/components/nanobake/src/nb_app.h +++ b/components/nanobake/src/nb_app.h @@ -1,8 +1,8 @@ #pragma once #include -#include -#include +#include "esp_err.h" +#include "lvgl.h" #ifdef __cplusplus extern "C" { diff --git a/components/nanobake/src/nb_display.c b/components/nanobake/src/nb_display.c index 69f3e29c..69f37479 100644 --- a/components/nanobake/src/nb_display.c +++ b/components/nanobake/src/nb_display.c @@ -1,5 +1,5 @@ #include "nb_display.h" -#include +#include "check.h" NbDisplay _Nonnull* nb_display_alloc(NbDisplayDriver _Nonnull* driver) { NbDisplay _Nonnull* display = malloc(sizeof(NbDisplay)); diff --git a/components/nanobake/src/nb_hardware.c b/components/nanobake/src/nb_hardware.c index 2e67b26c..9f55e22d 100644 --- a/components/nanobake/src/nb_hardware.c +++ b/components/nanobake/src/nb_hardware.c @@ -1,7 +1,7 @@ #include "nb_hardware_i.h" -#include -#include -#include +#include "esp_check.h" +#include "esp_err.h" +#include "check.h" static const char* TAG = "nb_hardware"; diff --git a/components/nanobake/src/nb_lvgl.c b/components/nanobake/src/nb_lvgl.c index 6b4d7052..4b245e1d 100644 --- a/components/nanobake/src/nb_lvgl.c +++ b/components/nanobake/src/nb_lvgl.c @@ -1,6 +1,6 @@ #include "nb_lvgl_i.h" -#include -#include +#include "esp_lvgl_port.h" +#include "check.h" static const char* TAG = "nb_lvgl"; diff --git a/components/nanobake/src/nb_lvgl.h b/components/nanobake/src/nb_lvgl.h index c8d177c7..9cd03607 100644 --- a/components/nanobake/src/nb_lvgl.h +++ b/components/nanobake/src/nb_lvgl.h @@ -1,6 +1,6 @@ #pragma once -#include +#include "lvgl.h" #ifdef __cplusplus extern "C" { diff --git a/components/nanobake/src/nb_touch.h b/components/nanobake/src/nb_touch.h index 4628acb8..1d7e480e 100644 --- a/components/nanobake/src/nb_touch.h +++ b/components/nanobake/src/nb_touch.h @@ -1,7 +1,7 @@ #pragma once #include "esp_lcd_touch.h" -#include +#include "esp_lcd_panel_io.h" #ifdef __cplusplus extern "C" { diff --git a/main/src/hello_world/hello_world.c b/main/src/hello_world/hello_world.c index 23c7ebb5..8ff82b71 100644 --- a/main/src/hello_world/hello_world.c +++ b/main/src/hello_world/hello_world.c @@ -1,11 +1,11 @@ #include "hello_world.h" -#include -#include -#include -#include -#include -#include -#include +#include "core_defines.h" +#include "record.h" +#include "nb_lvgl.h" +#include "nb_hardware.h" +#include "applications/services/gui/gui.h" +#include "esp_lvgl_port.h" +#include "esp_log.h" static const char* TAG = "app_helloworld"; @@ -15,7 +15,7 @@ static void prv_on_button_click(lv_event_t _Nonnull* event) { struct NbGui* gui = furi_record_open(RECORD_GUI); // Free this screen - ScreenId screen_id = (ScreenId)event->user_data; + NbScreenId screen_id = (NbScreenId)event->user_data; gui_screen_free(gui, screen_id); // Close Gui record @@ -23,7 +23,7 @@ static void prv_on_button_click(lv_event_t _Nonnull* event) { gui = NULL; } -static void prv_hello_world_lvgl(lv_obj_t* parent, ScreenId screen_id) { +static void prv_hello_world_lvgl(lv_obj_t* parent, NbScreenId screen_id) { lvgl_port_lock(0); lv_obj_t* label = lv_label_create(parent); diff --git a/main/src/main.c b/main/src/main.c index 28b098b9..b6c96a15 100644 --- a/main/src/main.c +++ b/main/src/main.c @@ -1,8 +1,8 @@ -#include +#include "nanobake.h" // Hardware -#include -#include +#include "board_2432s024_touch.h" +#include "board_2432s024_display.h" // Apps #include "hello_world/hello_world.h"