mirror of
https://github.com/espressif/arduino-esp32
synced 2024-09-21 10:28:04 +00:00
Adjustable Serial Event Task Stack Size And Priority (#6685)
* Adjustable Serial Event Task Stack Size And Priority * Added options to Kconfig * Added Core Affinity * Added CONFIG_FREERTOS_UNICORE * Removed _CONFIG from FREERTOS_UNICORE * Fixing Core choice for OnReceive() Makes it alligned to changes in #6718 Also eliminates conflict with #6718 for merging Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com> Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
This commit is contained in:
parent
5482315036
commit
ed33e15752
@ -73,6 +73,42 @@ config ARDUINO_EVENT_RUNNING_CORE
|
|||||||
default 1 if ARDUINO_EVENT_RUN_CORE1
|
default 1 if ARDUINO_EVENT_RUN_CORE1
|
||||||
default -1 if ARDUINO_EVENT_RUN_NO_AFFINITY
|
default -1 if ARDUINO_EVENT_RUN_NO_AFFINITY
|
||||||
|
|
||||||
|
choice ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
|
||||||
|
bool "Core on which Arduino's Serial Event task is running"
|
||||||
|
default ARDUINO_SERIAL_EVENT_RUN_CORE0 if FREERTOS_UNICORE
|
||||||
|
default ARDUINO_SERIAL_EVENT_RUN_NO_AFFINITY if !FREERTOS_UNICORE
|
||||||
|
help
|
||||||
|
Select on which core Arduino's Serial Event task run
|
||||||
|
|
||||||
|
config ARDUINO_SERIAL_EVENT_RUN_CORE0
|
||||||
|
bool "CORE 0"
|
||||||
|
config ARDUINO_SERIAL_EVENT_RUN_CORE1
|
||||||
|
bool "CORE 1"
|
||||||
|
depends on !FREERTOS_UNICORE
|
||||||
|
config ARDUINO_SERIAL_EVENT_RUN_NO_AFFINITY
|
||||||
|
bool "BOTH"
|
||||||
|
depends on !FREERTOS_UNICORE
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
|
||||||
|
int
|
||||||
|
default 0 if ARDUINO_SERIAL_EVENT_RUN_CORE0
|
||||||
|
default 1 if ARDUINO_SERIAL_EVENT_RUN_CORE1
|
||||||
|
default -1 if ARDUINO_SERIAL_EVENT_RUN_NO_AFFINITY
|
||||||
|
|
||||||
|
config ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE
|
||||||
|
int "Serial Event task stack size"
|
||||||
|
default 2048
|
||||||
|
help
|
||||||
|
Amount of stack available for the Serial Event task.
|
||||||
|
|
||||||
|
config ARDUINO_SERIAL_EVENT_TASK_PRIORITY
|
||||||
|
int "Priority of the Serial Event task"
|
||||||
|
default 24
|
||||||
|
help
|
||||||
|
Select at what priority you want the Serial Event task to run.
|
||||||
|
|
||||||
choice ARDUINO_UDP_RUNNING_CORE
|
choice ARDUINO_UDP_RUNNING_CORE
|
||||||
bool "Core on which Arduino's UDP is running"
|
bool "Core on which Arduino's UDP is running"
|
||||||
default ARDUINO_UDP_RUN_CORE0
|
default ARDUINO_UDP_RUN_CORE0
|
||||||
|
@ -9,6 +9,18 @@
|
|||||||
#include "driver/uart.h"
|
#include "driver/uart.h"
|
||||||
#include "freertos/queue.h"
|
#include "freertos/queue.h"
|
||||||
|
|
||||||
|
#ifndef ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE
|
||||||
|
#define ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE 2048
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ARDUINO_SERIAL_EVENT_TASK_PRIORITY
|
||||||
|
#define ARDUINO_SERIAL_EVENT_TASK_PRIORITY (configMAX_PRIORITIES-1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE
|
||||||
|
#define ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE -1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SOC_RX0
|
#ifndef SOC_RX0
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
#define SOC_RX0 3
|
#define SOC_RX0 3
|
||||||
@ -159,7 +171,7 @@ HardwareSerial::~HardwareSerial()
|
|||||||
void HardwareSerial::_createEventTask(void *args)
|
void HardwareSerial::_createEventTask(void *args)
|
||||||
{
|
{
|
||||||
// Creating UART event Task
|
// Creating UART event Task
|
||||||
xTaskCreate(_uartEventTask, "uart_event_task", 2048, this, configMAX_PRIORITIES - 1, &_eventTask);
|
xTaskCreateUniversal(_uartEventTask, "uart_event_task", ARDUINO_SERIAL_EVENT_TASK_STACK_SIZE, this, ARDUINO_SERIAL_EVENT_TASK_PRIORITY, &_eventTask, ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE);
|
||||||
if (_eventTask == NULL) {
|
if (_eventTask == NULL) {
|
||||||
log_e(" -- UART%d Event Task not Created!", _uart_nr);
|
log_e(" -- UART%d Event Task not Created!", _uart_nr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user