implemented furi from flipper zero
added cmsis_core, furi, mlib and nanobake implemented basic app structure from furi implemented basic placeholder apps
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
#ifndef NANOBAKE_H
|
||||
#define NANOBAKE_H
|
||||
#pragma once
|
||||
|
||||
#include "nb_platform.h"
|
||||
#include "nb_hardware.h"
|
||||
#include "nb_app.h"
|
||||
|
||||
extern void nanobake_run(nb_platform_config_t _Nonnull * config);
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//extern nb_app_config_t[32] nanobake_apps(nb_app_config_t app_configs, ...);
|
||||
extern void nanobake_start(nb_config_t _Nonnull * config);
|
||||
|
||||
#endif //NANOBAKE_H
|
||||
typedef void* FuriThreadId;
|
||||
|
||||
extern FuriThreadId nanobake_get_app_thread_id(size_t index);
|
||||
extern size_t nanobake_get_app_thread_count();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,49 +1,38 @@
|
||||
#ifndef NANOBAKE_NB_APP_H
|
||||
#define NANOBAKE_NB_APP_H
|
||||
|
||||
#define NB_APP_ID_LENGTH 32
|
||||
#define NB_APP_NAME_LENGTH 32
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <esp_err.h>
|
||||
#include <lvgl.h>
|
||||
|
||||
// region Forward declarations
|
||||
struct nb_platform;
|
||||
typedef struct nb_platform nb_platform_t;
|
||||
//endregion
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NB_APP_ID_LENGTH 32
|
||||
#define NB_APP_NAME_LENGTH 32
|
||||
|
||||
typedef enum nb_app_type nb_app_type_t;
|
||||
|
||||
enum nb_app_type {
|
||||
SERVICE,
|
||||
SYSTEM,
|
||||
USER
|
||||
USER,
|
||||
STARTUP
|
||||
};
|
||||
|
||||
typedef struct nb_app nb_app_t;
|
||||
|
||||
typedef void (*nb_app_callback_on_create) (nb_platform_t* platform, lv_obj_t* lv_parent);
|
||||
typedef void (*nb_app_callback_update) (nb_platform_t* platform, lv_obj_t* lv_parent);
|
||||
typedef void (*nb_app_callback_on_destroy) (nb_platform_t* platform);
|
||||
typedef int32_t (*nb_app_entry_point) (void _Nonnull* parameter);
|
||||
|
||||
struct nb_app {
|
||||
char id[NB_APP_ID_LENGTH];
|
||||
char name[NB_APP_NAME_LENGTH];
|
||||
nb_app_type_t type;
|
||||
nb_app_callback_on_create _Nullable on_create;
|
||||
nb_app_callback_on_destroy _Nullable on_destroy;
|
||||
nb_app_callback_update _Nullable on_update;
|
||||
size_t update_task_stack_size;
|
||||
uint32_t update_task_priority;
|
||||
const char id[NB_APP_ID_LENGTH];
|
||||
const char name[NB_APP_NAME_LENGTH];
|
||||
const nb_app_type_t type;
|
||||
const nb_app_entry_point _Nullable entry_point;
|
||||
const size_t stack_size;
|
||||
const uint32_t priority;
|
||||
};
|
||||
|
||||
typedef struct nb_app_instance nb_app_instance_t;
|
||||
|
||||
struct nb_app_instance {
|
||||
nb_app_t config;
|
||||
};
|
||||
|
||||
esp_err_t nb_app_validate(nb_app_t* _Nonnull app);
|
||||
|
||||
#endif //NANOBAKE_NB_APP_H
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "nb_display.h"
|
||||
#include "nb_touch.h"
|
||||
#include "nb_app.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef nb_touch_driver_t (*create_touch_driver)();
|
||||
typedef nb_display_driver_t (*create_display_driver)();
|
||||
|
||||
typedef struct nb_config nb_config_t;
|
||||
struct nb_config {
|
||||
// Required driver for display
|
||||
const create_display_driver _Nonnull display_driver;
|
||||
// Optional driver for touch input
|
||||
const create_touch_driver _Nullable touch_driver;
|
||||
// List of user applications
|
||||
const nb_app_t* apps[];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,8 +1,11 @@
|
||||
#ifndef NANOBAKE_NB_DISPLAY_H
|
||||
#define NANOBAKE_NB_DISPLAY_H
|
||||
#pragma once
|
||||
|
||||
#include <esp_lcd_panel_io.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct nb_display nb_display_t;
|
||||
|
||||
struct nb_display {
|
||||
@@ -25,6 +28,8 @@ struct nb_display_driver {
|
||||
* @param[in] driver
|
||||
* @return allocated display object
|
||||
*/
|
||||
nb_display_t _Nonnull* nb_display_create(nb_display_driver_t _Nonnull* driver);
|
||||
nb_display_t _Nonnull* nb_display_alloc(nb_display_driver_t _Nonnull* driver);
|
||||
|
||||
#endif // NANOBAKE_NB_DISPLAY_H
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "nb_config.h"
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct nb_hardware nb_hardware_t;
|
||||
struct nb_hardware {
|
||||
nb_display_t* _Nonnull display;
|
||||
nb_touch_t* _Nullable touch;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param[in] config
|
||||
* @return a newly allocated platform instance (caller takes ownership)
|
||||
*/
|
||||
nb_hardware_t _Nonnull* nb_hardware_alloc(nb_config_t _Nonnull* config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
#ifndef NANOBAKE_NB_PLATFORM_H
|
||||
#define NANOBAKE_NB_PLATFORM_H
|
||||
|
||||
#include "nb_display.h"
|
||||
#include "nb_touch.h"
|
||||
#include "nb_app.h"
|
||||
#include <esp_err.h>
|
||||
#include <lvgl.h>
|
||||
|
||||
typedef nb_touch_driver_t (*create_touch_driver)();
|
||||
typedef nb_display_driver_t (*create_display_driver)();
|
||||
|
||||
typedef struct nb_platform_config nb_platform_config_t;
|
||||
struct nb_platform_config {
|
||||
// Required driver for display
|
||||
create_display_driver _Nonnull display_driver;
|
||||
// Optional driver for touch input
|
||||
create_touch_driver _Nullable touch_driver;
|
||||
// List of user applications
|
||||
nb_app_t* apps[];
|
||||
};
|
||||
|
||||
typedef struct nb_lvgl nb_lvgl_t;
|
||||
struct nb_lvgl {
|
||||
lv_disp_t* _Nonnull disp;
|
||||
lv_indev_t* _Nullable touch_indev;
|
||||
};
|
||||
|
||||
typedef struct nb_platform nb_platform_t;
|
||||
struct nb_platform {
|
||||
nb_display_t* _Nonnull display;
|
||||
nb_touch_t* _Nullable touch;
|
||||
nb_lvgl_t* _Nonnull lvgl;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param[in] config
|
||||
* @return a newly allocated platform instance (caller takes ownership)
|
||||
*/
|
||||
nb_platform_t _Nonnull* nb_platform_create(nb_platform_config_t _Nonnull* config);
|
||||
|
||||
#endif // NANOBAKE_NB_PLATFORM_H
|
||||
@@ -1,9 +1,12 @@
|
||||
#ifndef NANOBAKE_NB_TOUCH_H
|
||||
#define NANOBAKE_NB_TOUCH_H
|
||||
#pragma once
|
||||
|
||||
#include "esp_lcd_touch.h"
|
||||
#include <esp_lcd_panel_io.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct nb_touch_driver nb_touch_driver_t;
|
||||
|
||||
struct nb_touch_driver {
|
||||
@@ -22,6 +25,8 @@ struct nb_touch {
|
||||
* @param[in] driver
|
||||
* @return a newly allocated instance
|
||||
*/
|
||||
nb_touch_t _Nonnull* nb_touch_create(nb_touch_driver_t _Nonnull* driver);
|
||||
nb_touch_t _Nonnull* nb_touch_alloc(nb_touch_driver_t _Nonnull* driver);
|
||||
|
||||
#endif // NANOBAKE_NB_TOUCH_H
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user