Kestrel Interface
Loading...
Searching...
No Matches
kest_int.c
Go to the documentation of this file.
1#include <sys/types.h>
2#include <sys/stat.h>
3#include <time.h>
4
5static const char *FNAME = "kest_int.c";
6
7#include "bsp/esp32_p4_nano.h"
8#include "esp_task_wdt.h"
9
10#include "kest_int.h"
11
13
14
16{
17 int ret_val;
18
20
21 srand(time(0));
22
23 esp_task_wdt_deinit();
24
26
27 #ifdef USE_DISPLAY
28 lv_disp_t *disp;
30 #endif
31
34
36
37 #ifdef USE_SGTL5000
38 xTaskCreate(kest_sgtl5000_init, "kest_sgtl5000_init_task", 8192, NULL, 8, NULL);
39 #endif
40
41 #ifdef USE_FPGA
42 xTaskCreate(kest_fpga_comms_task, "kest_fpga_comms_task", 4096, NULL, 8, NULL);
43 xTaskCreate(kest_param_update_task, "kest_param_update_task", 4096, NULL, 8, NULL);
44 #else
45 init_m_msg_queue();
46 begin_m_comms();
47 #endif
48 #ifdef USE_SDCARD
49 kest_printf("DOING THE SD CARD STUFF\n");
53 init_effect_selector_eff(&global_cxt.pages.effect_selector);
55
58 kest_state state;
59 ret_val = load_state_from_file(&state, SETTINGS_FNAME);
60
61 if (ret_val == NO_ERROR)
62 {
63 ret_val = kest_cxt_restore_state(&global_cxt, &state);
64
65 kest_printf("Restored state from disk with error code \"%s\"\n", kest_error_code_to_string(ret_val));
66 }
67 else
68 {
69 kest_printf("Unable to restore state from disk: \"%s\"\n", kest_error_code_to_string(ret_val));
70 }
71 #endif
72
73 init_representation_updater();
74 #ifdef KEST_SIMULATED
75 while (1)
76 {
77 lv_timer_handler();
78 vTaskDelay(pdMS_TO_TICKS(10));
79 }
80 #else
81 #ifdef USE_DISPLAY
82 if (bsp_display_lock(0))
83 {
85 lv_log_register_print_cb(kest_lv_log_cb);
86 kest_create_ui(disp);
88 #ifdef KEST_PRINT_MEMORY_REPORT
89 lv_timer_create(print_memory_report, 2000, NULL);
90 #endif
91 bsp_display_unlock();
92 }
93 #endif
94 #endif
95
96 //init_footswitch_task();
97
98 while (1);
99}
void print_memory_report()
Definition kest_alloc.c:172
void kest_mem_init()
Definition kest_alloc.c:116
void context_print_profiles(kest_context *cxt)
int kest_init_context(kest_context *cxt)
int kest_context_init_effect_list(kest_context *cxt)
int init_effect_selector_eff(kest_ui_page *page)
const char * kest_error_code_to_string(int error_code)
#define NO_ERROR
int load_saved_sequences(kest_context *cxt)
int load_state_from_file(kest_state *state, const char *fname)
Definition kest_files.c:298
int kest_init_directories()
Definition kest_files.c:697
int load_saved_profiles(kest_context *cxt)
Definition kest_files.c:960
int load_effects(kest_context *cxt)
#define SETTINGS_FNAME
Definition kest_files.h:24
void kest_fpga_comms_task(void *param)
kest_context global_cxt
Definition kest_int.c:12
void app_main()
Definition kest_int.c:15
void kest_lv_log_cb(lv_log_level_t level, const char *buf)
int kest_log_init()
void kest_param_update_task(void *arg)
void kest_printf(const char *fmt,...)
Definition kest_printf.c:21
void kest_printf_init()
Definition kest_printf.c:11
int init_sd_card()
Definition kest_sd.c:155
void kest_sgtl5000_init(void *param)
int kest_cxt_restore_state(kest_context *cxt, kest_state *state)
Definition kest_state.c:94
int kest_cxt_enter_previous_current_page(kest_context *cxt, kest_state *state)
Definition kest_state.c:120
int kest_init_global_pages(kest_global_pages *pages)
Definition kest_ui.c:78
void kest_create_ui(lv_disp_t *disp)
Definition kest_ui.c:121
int waveshare_dsi_touch_5_a_init(lv_disp_t **disp)