mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
Enable FreeRTOS SMP (multicore) (#90)
This commit is contained in:
parent
dfd9349e6c
commit
d06137ba76
@ -3,7 +3,6 @@
|
||||
#include "CoreExtraDefines.h"
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include "freertos/portmacro.h"
|
||||
#else
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
@ -4,11 +4,9 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/portmacro.h"
|
||||
#else
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
@ -6,11 +6,9 @@
|
||||
#ifdef ESP_TARGET
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/event_groups.h"
|
||||
#include "freertos/portmacro.h"
|
||||
#else
|
||||
#include "FreeRTOS.h"
|
||||
#include "event_groups.h"
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
#define TT_EVENT_FLAG_MAX_BITS_EVENT_GROUPS 24U
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include "I2cCompat.h"
|
||||
#include "CoreTypes.h"
|
||||
#include <climits>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -24,7 +25,7 @@ typedef struct {
|
||||
/** Whether configuration can be changed. */
|
||||
bool hasMutableConfiguration;
|
||||
/** Read/write timeout (not related to mutex locking mechanism) */
|
||||
TickType_t timeout;
|
||||
unsigned long timeout;
|
||||
/** Configuration that must be valid when initAtBoot is set to true. */
|
||||
i2c_config_t config;
|
||||
} Configuration;
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef ESP_TARGET
|
||||
|
||||
#include <hal/i2c_types.h>
|
||||
#include <driver/i2c.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <cstdint>
|
||||
#include "portmacro.h"
|
||||
|
||||
typedef int esp_err_t;
|
||||
|
||||
|
||||
@ -26,7 +26,8 @@ typedef enum {
|
||||
WifiMessageTypeRadioOff,
|
||||
WifiMessageTypeScan,
|
||||
WifiMessageTypeConnect,
|
||||
WifiMessageTypeDisconnect
|
||||
WifiMessageTypeDisconnect,
|
||||
WifiMessageTypeAutoConnect,
|
||||
} WifiMessageType;
|
||||
|
||||
typedef struct {
|
||||
@ -282,7 +283,7 @@ static bool copy_scan_list(Wifi* wifi) {
|
||||
|
||||
static void auto_connect(Wifi* wifi) {
|
||||
for (int i = 0; i < wifi->scan_list_count; ++i) {
|
||||
const char* ssid = (const char*)wifi->scan_list[i].ssid;
|
||||
auto ssid = reinterpret_cast<const char*>(wifi->scan_list[i].ssid);
|
||||
if (settings::contains(ssid)) {
|
||||
static_assert(sizeof(wifi->scan_list[i].ssid) == (TT_WIFI_SSID_LIMIT + 1), "SSID size mismatch");
|
||||
settings::WifiApSettings ap_settings;
|
||||
@ -334,7 +335,9 @@ static void event_handler(TT_UNUSED void* arg, esp_event_base_t event_base, int3
|
||||
TT_LOG_I(TAG, "Finished scan");
|
||||
|
||||
if (copied_list && wifi_singleton->radio_state == WIFI_RADIO_ON) {
|
||||
auto_connect(wifi_singleton);
|
||||
WifiMessage message = {.type = WifiMessageTypeAutoConnect};
|
||||
// No need to lock for queue
|
||||
wifi_singleton->queue.put(&message, 100 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
unlock(wifi_singleton);
|
||||
@ -709,6 +712,11 @@ _Noreturn int32_t wifi_main(TT_UNUSED void* parameter) {
|
||||
disconnect_internal_but_keep_active(wifi);
|
||||
unlock(wifi);
|
||||
break;
|
||||
case WifiMessageTypeAutoConnect:
|
||||
lock(wifi);
|
||||
auto_connect(wifi_singleton);
|
||||
unlock(wifi);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||
CONFIG_FREERTOS_SMP=n
|
||||
CONFIG_FREERTOS_UNICORE=y
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
|
||||
@ -12,7 +12,8 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||
CONFIG_FREERTOS_SMP=n
|
||||
CONFIG_FREERTOS_UNICORE=y
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
|
||||
@ -12,7 +12,8 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||
CONFIG_FREERTOS_SMP=n
|
||||
CONFIG_FREERTOS_UNICORE=y
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
|
||||
@ -12,7 +12,7 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||
CONFIG_FREERTOS_SMP=n
|
||||
CONFIG_FREERTOS_UNICORE=y
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
|
||||
@ -12,7 +12,7 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||
CONFIG_FREERTOS_SMP=n
|
||||
CONFIG_FREERTOS_UNICORE=y
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
|
||||
@ -12,7 +12,7 @@ CONFIG_LV_USE_CLIB_MALLOC=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||
CONFIG_FREERTOS_SMP=n
|
||||
CONFIG_FREERTOS_UNICORE=y
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user