mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-04-27 11:13:25 +02:00
@@ -217,9 +217,6 @@ done: ;
|
||||
current_app->unload();
|
||||
current_app = NULL;
|
||||
}
|
||||
#ifdef ESP_PLATFORM
|
||||
vTaskDelete(NULL);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,12 @@ extern TaskHandle_t hcore0, hcore1;
|
||||
#define ESP32_CORE0 tskNO_AFFINITY
|
||||
#define ESP32_CORE1 tskNO_AFFINITY
|
||||
#endif
|
||||
#define multicore_launch_core1(a) xTaskCreatePinnedToCore((void(*)(void *))a, "core1", 4096*ITF_TOTAL*2, NULL, CONFIG_TINYUSB_TASK_PRIORITY - 2, &hcore1, ESP32_CORE1)
|
||||
static inline void task_wrapper(void *arg) {
|
||||
void* (*func)(void*) = (void* (*)(void*))arg;
|
||||
func(NULL);
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
#define multicore_launch_func_core1(func) xTaskCreatePinnedToCore(task_wrapper, "core1", 4096*ITF_TOTAL*2, (void *)func, CONFIG_TINYUSB_TASK_PRIORITY - 2, &hcore1, ESP32_CORE1)
|
||||
#define multicore_reset_core1() do { if (hcore1) { eTaskState e = eTaskGetState(hcore1); if (e <= eSuspended) { vTaskDelete(hcore1); }} }while(0)
|
||||
#define sleep_ms(a) vTaskDelay(a / portTICK_PERIOD_MS)
|
||||
static inline uint32_t board_millis(void) {
|
||||
|
||||
@@ -236,4 +236,8 @@ extern pico_unique_board_id_t pico_serial;
|
||||
extern char pico_serial_str[2 * PICO_UNIQUE_BOARD_ID_SIZE_BYTES + 1];
|
||||
extern uint8_t pico_serial_hash[32];
|
||||
|
||||
#if defined(PICO_PLATFORM)
|
||||
#define multicore_launch_func_core1(a) multicore_launch_core1((void (*) (void))a)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#endif
|
||||
#include <stdbool.h>
|
||||
typedef struct {
|
||||
pthread_mutex_t mtx;
|
||||
pthread_cond_t cnd;
|
||||
@@ -115,7 +116,7 @@ static inline void queue_clear(queue_t *a) {
|
||||
pthread_mutex_unlock(&a->mtx);
|
||||
}
|
||||
extern pthread_t hcore0, hcore1;
|
||||
#define multicore_launch_core1(a) pthread_create(&hcore1, NULL, (void *(*) (void *))a, NULL)
|
||||
#define multicore_launch_func_core1(a) pthread_create(&hcore1, NULL, (void *(*) (void *))a, NULL)
|
||||
#define multicore_reset_core1()
|
||||
|
||||
typedef pthread_mutex_t mutex_t;
|
||||
|
||||
@@ -185,7 +185,7 @@ void card_start(uint8_t itf, void *(*func)(void *)) {
|
||||
}
|
||||
if (func) {
|
||||
multicore_reset_core1();
|
||||
multicore_launch_core1(func);
|
||||
multicore_launch_func_core1(func);
|
||||
}
|
||||
led_set_mode(MODE_MOUNTED);
|
||||
card_locked_itf = itf;
|
||||
|
||||
Reference in New Issue
Block a user