Rename project to tactility (#7)

* wifi wip

* renamed project to Tactility

* renamed code files and defines

* changed prefixes to tt_

* removed wifi wip code
This commit is contained in:
Ken Van Hoeylandt 2024-01-06 12:24:38 +01:00 committed by GitHub
parent b0ffa04d78
commit 28bd80c1f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
64 changed files with 92 additions and 89 deletions

View File

@ -16,4 +16,4 @@ if(NOT "${IDF_TARGET}" STREQUAL "esp32s3")
endif() endif()
include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(NanoBake) project(Tactility)

View File

@ -1,9 +1,9 @@
## Overview ## Overview
NanoBake is a front-end application platform for ESP32. Tactility is a front-end application platform for ESP32. It is mainly intended for touchscreen devices.
It provides an application framework that is based on code from the [Flipper Zero](https://github.com/flipperdevices/flipperzero-firmware/) project. It provides an application framework that is based on code from the [Flipper Zero](https://github.com/flipperdevices/flipperzero-firmware/) project.
Nanobake provides: Tactility provides:
- A hardware abstraction layer - A hardware abstraction layer
- UI capabilities (via LVGL) - UI capabilities (via LVGL)
- An application platform that can run apps and services - An application platform that can run apps and services
@ -40,7 +40,7 @@ Other configurations can be supported, but they require you to set up the driver
Until there is proper documentation, here are some pointers: Until there is proper documentation, here are some pointers:
- Sample application: [bootstrap](main/src/main.c) and [app](main/src/hello_world/hello_world.c) - Sample application: [bootstrap](main/src/main.c) and [app](main/src/hello_world/hello_world.c)
- [NanoBake](./components/nanobake/): the main platform with default services and apps - [Tactility](./components/tactility/): the main platform with default services and apps
- [Furi](./components/furi/): the core platform code, based on Flipper Zero firmware - [Furi](./components/furi/): the core platform code, based on Flipper Zero firmware
## Building Firmware ## Building Firmware

View File

@ -1,5 +1,5 @@
idf_component_register( idf_component_register(
SRC_DIRS "." SRC_DIRS "."
INCLUDE_DIRS "." INCLUDE_DIRS "."
REQUIRES nanobake esp_lcd esp_lcd_touch_gt911 REQUIRES tactility esp_lcd esp_lcd_touch_gt911
) )

View File

@ -1,10 +1,10 @@
#include "nanobake.h" #include "driver/ledc.h"
#include "esp_log.h" #include "driver/spi_master.h"
#include "esp_err.h" #include "esp_err.h"
#include "esp_lcd_panel_ops.h" #include "esp_lcd_panel_ops.h"
#include "driver/spi_master.h"
#include "esp_lcd_panel_vendor.h" #include "esp_lcd_panel_vendor.h"
#include "driver/ledc.h" #include "esp_log.h"
#include "tactility.h"
#define TAG "lilygo_tdeck_display" #define TAG "lilygo_tdeck_display"

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "nanobake.h" #include "tactility.h"
extern const HardwareConfig lilygo_tdeck; extern const HardwareConfig lilygo_tdeck;

View File

@ -1,4 +1,4 @@
#include "nanobake.h" #include "tactility.h"
#include "esp_lcd_touch_gt911.h" #include "esp_lcd_touch_gt911.h"
#include "esp_log.h" #include "esp_log.h"

View File

@ -1,5 +1,5 @@
idf_component_register( idf_component_register(
SRC_DIRS "." SRC_DIRS "."
INCLUDE_DIRS "." INCLUDE_DIRS "."
REQUIRES nanobake esp_lcd_touch_cst816s esp_lcd_ili9341 REQUIRES tactility esp_lcd_touch_cst816s esp_lcd_ili9341
) )

View File

@ -1,12 +1,12 @@
#include "nanobake.h"
#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/gpio.h"
#include "driver/spi_master.h" #include "driver/spi_master.h"
#include "esp_err.h"
#include "esp_lcd_ili9341.h"
#include "esp_lcd_panel_ops.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "tactility.h"
#define TAG "2432s024_ili9341" #define TAG "2432s024_ili9341"

View File

@ -1,8 +1,8 @@
#include "nanobake.h" #include "driver/i2c.h"
#include "esp_err.h"
#include "esp_lcd_touch_cst816s.h" #include "esp_lcd_touch_cst816s.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_err.h" #include "tactility.h"
#include "driver/i2c.h"
#define TOUCH_I2C_PORT 0 #define TOUCH_I2C_PORT 0

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "nanobake.h" #include "tactility.h"
// Capacitive touch version of the 2.4" yellow board // Capacitive touch version of the 2.4" yellow board
extern const HardwareConfig yellow_board_24inch_cap; extern const HardwareConfig yellow_board_24inch_cap;

View File

@ -1,13 +0,0 @@
#pragma once
#include "nanobake.h"
#ifdef __cplusplus
extern "C" {
#endif
Hardware nb_hardware_init(const HardwareConfig _Nonnull* config);
#ifdef __cplusplus
}
#endif

View File

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 274 B

View File

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

View File

@ -5,7 +5,7 @@
#define TAG "hardware" #define TAG "hardware"
Hardware nb_hardware_init(const HardwareConfig _Nonnull* config) { Hardware tt_hardware_init(const HardwareConfig _Nonnull* config) {
if (config->bootstrap != NULL) { if (config->bootstrap != NULL) {
ESP_LOGI(TAG, "Bootstrapping"); ESP_LOGI(TAG, "Bootstrapping");
config->bootstrap(); config->bootstrap();
@ -14,13 +14,13 @@ Hardware nb_hardware_init(const HardwareConfig _Nonnull* config) {
furi_check(config->display_driver != NULL, "no display driver configured"); furi_check(config->display_driver != NULL, "no display driver configured");
DisplayDriver display_driver = config->display_driver(); DisplayDriver display_driver = config->display_driver();
ESP_LOGI(TAG, "display with driver %s", display_driver.name); ESP_LOGI(TAG, "display with driver %s", display_driver.name);
DisplayDevice* display = nb_display_device_alloc(&display_driver); DisplayDevice* display = tt_display_device_alloc(&display_driver);
TouchDevice* touch = NULL; TouchDevice* touch = NULL;
if (config->touch_driver != NULL) { if (config->touch_driver != NULL) {
TouchDriver touch_driver = config->touch_driver(); TouchDriver touch_driver = config->touch_driver();
ESP_LOGI(TAG, "touch with driver %s", touch_driver.name); ESP_LOGI(TAG, "touch with driver %s", touch_driver.name);
touch = nb_touch_alloc(&touch_driver); touch = tt_touch_alloc(&touch_driver);
} else { } else {
ESP_LOGI(TAG, "no touch configured"); ESP_LOGI(TAG, "no touch configured");
touch = NULL; touch = NULL;

View File

@ -0,0 +1,13 @@
#pragma once
#include "tactility.h"
#ifdef __cplusplus
extern "C" {
#endif
Hardware tt_hardware_init(const HardwareConfig _Nonnull* config);
#ifdef __cplusplus
}
#endif

View File

@ -1,7 +1,7 @@
#include "check.h" #include "check.h"
#include "display.h" #include "display.h"
DisplayDevice _Nonnull* nb_display_device_alloc(DisplayDriver _Nonnull* driver) { DisplayDevice _Nonnull* tt_display_device_alloc(DisplayDriver _Nonnull* driver) {
DisplayDevice _Nonnull* display = malloc(sizeof(DisplayDevice)); DisplayDevice _Nonnull* display = malloc(sizeof(DisplayDevice));
memset(display, 0, sizeof(DisplayDevice)); memset(display, 0, sizeof(DisplayDevice));
furi_check(driver->create_display_device(display), "failed to create display"); furi_check(driver->create_display_device(display), "failed to create display");

View File

@ -31,7 +31,7 @@ typedef struct {
* @param[in] driver * @param[in] driver
* @return allocated display object * @return allocated display object
*/ */
DisplayDevice _Nonnull* nb_display_device_alloc(DisplayDriver _Nonnull* driver); DisplayDevice _Nonnull* tt_display_device_alloc(DisplayDriver _Nonnull* driver);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -5,7 +5,7 @@
#define TAG "lvgl" #define TAG "lvgl"
Lvgl nb_graphics_init(Hardware _Nonnull* hardware) { Lvgl tt_graphics_init(Hardware _Nonnull* hardware) {
const lvgl_port_cfg_t lvgl_cfg = { const lvgl_port_cfg_t lvgl_cfg = {
.task_priority = 4, .task_priority = 4,
.task_stack = 4096, .task_stack = 4096,

View File

@ -7,7 +7,7 @@
extern "C" { extern "C" {
#endif #endif
Lvgl nb_graphics_init(Hardware _Nonnull* hardware); Lvgl tt_graphics_init(Hardware _Nonnull* hardware);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -37,7 +37,7 @@ static esp_err_t spiffs_init(esp_vfs_spiffs_conf_t* conf) {
return ESP_OK; return ESP_OK;
} }
esp_err_t nb_partitions_init() { esp_err_t tt_partitions_init() {
ESP_ERROR_CHECK(nvs_flash_init_safely()); ESP_ERROR_CHECK(nvs_flash_init_safely());
esp_vfs_spiffs_conf_t assets_spiffs = { esp_vfs_spiffs_conf_t assets_spiffs = {

View File

@ -5,4 +5,4 @@
#define MOUNT_POINT_ASSETS "/assets" #define MOUNT_POINT_ASSETS "/assets"
#define MOUNT_POINT_CONFIG "/config" #define MOUNT_POINT_CONFIG "/config"
esp_err_t nb_partitions_init(); esp_err_t tt_partitions_init();

View File

@ -59,7 +59,7 @@ LoaderStatus loader_start_app(const char* id, const char* args, FuriString* erro
LoaderMessage message; LoaderMessage message;
LoaderMessageLoaderStatusResult result; LoaderMessageLoaderStatusResult result;
message.type = LoaderMessageTypeStartByName; message.type = LoaderMessageTypeAppStart;
message.start.id = id; message.start.id = id;
message.start.args = args; message.start.args = args;
message.start.error_message = error_message; message.start.error_message = error_message;
@ -74,7 +74,7 @@ void loader_start_app_nonblocking(const char* id, const char* args) {
LoaderMessage message; LoaderMessage message;
LoaderMessageLoaderStatusResult result; LoaderMessageLoaderStatusResult result;
message.type = LoaderMessageTypeStartByName; message.type = LoaderMessageTypeAppStart;
message.start.id = id; message.start.id = id;
message.start.args = args; message.start.args = args;
message.start.error_message = NULL; message.start.error_message = NULL;
@ -173,6 +173,11 @@ static void loader_start_app_with_manifest(
} }
loader_unlock(); loader_unlock();
LoaderEvent event = {
.type = LoaderEventTypeApplicationStarted
};
furi_pubsub_publish(loader->pubsub, &event);
} }
static LoaderStatus loader_do_start_by_id( static LoaderStatus loader_do_start_by_id(
@ -234,8 +239,9 @@ static void loader_do_stop_app() {
heap_caps_get_free_size(MALLOC_CAP_INTERNAL) heap_caps_get_free_size(MALLOC_CAP_INTERNAL)
); );
LoaderEvent event; LoaderEvent event = {
event.type = LoaderEventTypeApplicationStopped; .type = LoaderEventTypeApplicationStopped
};
furi_pubsub_publish(loader->pubsub, &event); furi_pubsub_publish(loader->pubsub, &event);
} }
@ -256,7 +262,7 @@ static int32_t loader_main(void* p) {
if (furi_message_queue_get(loader->queue, &message, FuriWaitForever) == FuriStatusOk) { if (furi_message_queue_get(loader->queue, &message, FuriWaitForever) == FuriStatusOk) {
FURI_LOG_I(TAG, "Processing message of type %d", message.type); FURI_LOG_I(TAG, "Processing message of type %d", message.type);
switch (message.type) { switch (message.type) {
case LoaderMessageTypeStartByName: case LoaderMessageTypeAppStart:
if (loader_is_app_running()) { if (loader_is_app_running()) {
loader_do_stop_app(); loader_do_stop_app();
} }
@ -272,7 +278,7 @@ static int32_t loader_main(void* p) {
case LoaderMessageTypeAppStop: case LoaderMessageTypeAppStop:
loader_do_stop_app(); loader_do_stop_app();
break; break;
case LoaderMessageTypeExit: case LoaderMessageTypeServiceStop:
exit_requested = true; exit_requested = true;
break; break;
} }
@ -297,7 +303,7 @@ static void loader_stop() {
furi_check(loader != NULL); furi_check(loader != NULL);
LoaderMessage message = { LoaderMessage message = {
.api_lock = NULL, .api_lock = NULL,
.type = LoaderMessageTypeExit .type = LoaderMessageTypeServiceStop
}; };
// Send stop signal to thread and wait for thread to finish // Send stop signal to thread and wait for thread to finish

View File

@ -25,16 +25,16 @@ struct Loader {
}; };
typedef enum { typedef enum {
LoaderMessageTypeStartByName, LoaderMessageTypeAppStart,
LoaderMessageTypeAppStop, LoaderMessageTypeAppStop,
LoaderMessageTypeExit, LoaderMessageTypeServiceStop,
} LoaderMessageType; } LoaderMessageType;
typedef struct { typedef struct {
const char* id; const char* id;
const char* args; const char* args;
FuriString* error_message; FuriString* error_message;
} LoaderMessageStartById; } LoaderMessageAppStart;
typedef struct { typedef struct {
LoaderStatus value; LoaderStatus value;
@ -51,7 +51,7 @@ typedef struct {
LoaderMessageType type; LoaderMessageType type;
union { union {
LoaderMessageStartById start; LoaderMessageAppStart start;
}; };
union { union {

View File

@ -1,12 +1,12 @@
#include "nanobake.h"
#include "app_manifest_registry.h" #include "app_manifest_registry.h"
#include "devices_i.h" #include "devices_i.h"
#include "furi.h" #include "furi.h"
#include "graphics_i.h" #include "graphics_i.h"
#include "partitions.h" #include "partitions.h"
#include "services/gui/gui.h" #include "services/gui/gui.h"
#include "tactility.h"
#define TAG "nanobake" #define TAG "tactility"
Gui* gui_alloc(); Gui* gui_alloc();
@ -66,13 +66,13 @@ static void start_user_services(const Config* _Nonnull config) {
FURI_LOG_I(TAG, "User services started"); FURI_LOG_I(TAG, "User services started");
} }
__attribute__((unused)) extern void nanobake_start(const Config* _Nonnull config) { __attribute__((unused)) extern void tactility_start(const Config* _Nonnull config) {
furi_init(); furi_init();
nb_partitions_init(); tt_partitions_init();
Hardware hardware = nb_hardware_init(config->hardware); Hardware hardware = tt_hardware_init(config->hardware);
/*NbLvgl lvgl =*/nb_graphics_init(&hardware); /*NbLvgl lvgl =*/tt_graphics_init(&hardware);
// Register all apps // Register all apps
register_system_apps(); register_system_apps();

View File

@ -34,10 +34,7 @@ typedef struct {
const ServiceManifest* const services[CONFIG_SERVICES_LIMIT]; const ServiceManifest* const services[CONFIG_SERVICES_LIMIT];
} Config; } Config;
__attribute__((unused)) extern void nanobake_start(const Config _Nonnull* config); __attribute__((unused)) extern void tactility_start(const Config _Nonnull* config);
FuriThreadId nanobake_get_app_thread_id(size_t index);
size_t nanobake_get_app_thread_count();
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,7 +1,7 @@
#include "check.h" #include "check.h"
#include "touch.h" #include "touch.h"
TouchDevice _Nonnull* nb_touch_alloc(TouchDriver _Nonnull* driver) { TouchDevice _Nonnull* tt_touch_alloc(TouchDriver _Nonnull* driver) {
TouchDevice _Nonnull* touch = malloc(sizeof(TouchDevice)); TouchDevice _Nonnull* touch = malloc(sizeof(TouchDevice));
bool success = driver->create_touch_device( bool success = driver->create_touch_device(
&(touch->io_handle), &(touch->io_handle),

View File

@ -23,7 +23,7 @@ typedef struct {
* @param[in] driver * @param[in] driver
* @return a newly allocated instance * @return a newly allocated instance
*/ */
TouchDevice _Nonnull* nb_touch_alloc(TouchDriver _Nonnull* driver); TouchDevice _Nonnull* tt_touch_alloc(TouchDriver _Nonnull* driver);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,5 +1,4 @@
# Yellow Board only runs on ESP32 set(project_components tactility)
set(project_components nanobake)
if("${IDF_TARGET}" STREQUAL "esp32") if("${IDF_TARGET}" STREQUAL "esp32")
list(APPEND project_components yellow_board) list(APPEND project_components yellow_board)

View File

@ -1,14 +1,14 @@
# Kconfig file for NanoBake example app # Kconfig file for Tactility example app
menu "NanoBake App" menu "Tactility App"
choice choice
prompt "Board" prompt "Board"
default NB_BOARD_CUSTOM default TT_BOARD_CUSTOM
config NB_BOARD_CUSTOM config TT_BOARD_CUSTOM
bool "Custom" bool "Custom"
config NB_BOARD_YELLOW_BOARD_24_CAP config TT_BOARD_YELLOW_BOARD_24_CAP
bool "Yellow Board (2.4\" capacitive)" bool "Yellow Board (2.4\" capacitive)"
config NB_BOARD_LILYGO_TDECK config TT_BOARD_LILYGO_TDECK
bool "LilyGo T-Deck" bool "LilyGo T-Deck"
endchoice endchoice
endmenu endmenu

View File

@ -4,4 +4,4 @@ dependencies:
espressif/esp_lcd_touch_gt911: "^1.0.0" espressif/esp_lcd_touch_gt911: "^1.0.0"
espressif/esp_lcd_touch: "1.1.1" espressif/esp_lcd_touch: "1.1.1"
esp_lvgl_port: '1.4.0' esp_lvgl_port: '1.4.0'
idf: '>=5.1' idf: '>=5.1.2'

View File

@ -1,14 +1,15 @@
#pragma once #pragma once
#include "sdkconfig.h"
// Supported hardware: // Supported hardware:
#if defined(CONFIG_NB_BOARD_LILYGO_TDECK) #if defined(CONFIG_TT_BOARD_LILYGO_TDECK)
#include "lilygo_tdeck.h" #include "lilygo_tdeck.h"
#define NB_BOARD_HARDWARE &lilygo_tdeck #define TT_BOARD_HARDWARE &lilygo_tdeck
#elif defined(CONFIG_NB_BOARD_YELLOW_BOARD_24_CAP) #elif defined(CONFIG_TT_BOARD_YELLOW_BOARD_24_CAP)
#include "yellow_board.h" #include "yellow_board.h"
#define NB_BOARD_HARDWARE &yellow_board_24inch_cap #define TT_BOARD_HARDWARE &yellow_board_24inch_cap
#elif defined(CONFIG_NB_BOARD_CUSTOM) #else
#define NB_BOARD_HARDWARE furi_crash( \ #define TT_BOARD_HARDWARE NULL
"Replace NB_BOARD_HARDWARE in main.c with your own, or use \"idf.py menuconfig\" to select a supported board." \ #error Replace TT_BOARD_HARDWARE in main.c with your own. Or copy one of the ./sdkconfig.board.* files into ./sdkconfig.
)
#endif #endif

View File

@ -1,4 +1,4 @@
#include "nanobake.h" #include "tactility.h"
#include "board_config.h" #include "board_config.h"
// Apps // Apps
@ -10,12 +10,12 @@ __attribute__((unused)) void app_main(void) {
* Auto-select a board based on the ./sdkconfig.board.* file * Auto-select a board based on the ./sdkconfig.board.* file
* that you copied to ./sdkconfig before you opened this project. * that you copied to ./sdkconfig before you opened this project.
*/ */
.hardware = NB_BOARD_HARDWARE, .hardware = TT_BOARD_HARDWARE,
.apps = { .apps = {
&hello_world_app &hello_world_app
}, },
.services = { }, .services = { },
}; };
nanobake_start(&config); tactility_start(&config);
} }

View File

@ -14,7 +14,7 @@ CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
# Hardware defaults # Hardware defaults
CONFIG_NB_BOARD_LILYGO_TDECK=y CONFIG_TT_BOARD_LILYGO_TDECK=y
CONFIG_IDF_TARGET="esp32s3" CONFIG_IDF_TARGET="esp32s3"
CONFIG_LV_COLOR_16_SWAP=y CONFIG_LV_COLOR_16_SWAP=y
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y

View File

@ -14,7 +14,7 @@ CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
# Hardware defaults # Hardware defaults
CONFIG_NB_BOARD_YELLOW_BOARD_24_CAP=y CONFIG_TT_BOARD_YELLOW_BOARD_24_CAP=y
CONFIG_IDF_TARGET="esp32" CONFIG_IDF_TARGET="esp32"
CONFIG_LV_COLOR_16_SWAP=y CONFIG_LV_COLOR_16_SWAP=y
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y

View File

@ -16,4 +16,4 @@ CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
CONFIG_FREERTOS_UNICORE=y CONFIG_FREERTOS_UNICORE=y
# Hardware defaults # Hardware defaults
CONFIG_NB_BOARD_CUSTOM=y CONFIG_TT_BOARD_CUSTOM=y