-
-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Hi,
I've build TcMenu with VSCode + ESP-IDF v5.1.3 for ESP32 an ST7735 1,8" TFT display.
To achieve it i changed this lines in TaskManagerIO and SimpleCollections lib
#include "Utils.h"
inline bool casAtomic(position_ptr_t ptr, position_t expected, position_t newVal) {
uint32_t exp32 = expected;
uint32_t new32 = newVal;
// uxPortCompareSet(ptr, exp32, &new32);
uxPortCompareSetCustom(ptr, exp32, &new32);
return new32 == expected;
}
// Utils.h
#include <stdint.h>
void uxPortCompareSetCustom(volatile uint32_t *addr, uint32_t compare, uint32_t *set);
// Utils.cpp
#include "Utils.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
void uxPortCompareSetCustom(volatile uint32_t *addr, uint32_t compare, uint32_t *set) {
uint32_t prev;
//BaseType_t taskState;
int taskState;
// Enter critical section to ensure atomicity
taskState = taskENTER_CRITICAL_FROM_ISR();
prev = *addr;
if (prev == compare) {
*addr = *set; // Update memory location with the new value
}
*set = prev; // Update the 'set' pointer with the previous value
// Exit critical section
taskEXIT_CRITICAL_FROM_ISR(taskState);
}
And IoAbstraction library required following modification
#include <Arduino.h>
void EspAnalogOutputMode::pinSetup() {
if(!isDac()) {
// for other than the dac ports, we need to set up PWM
ledcSetup(pwmChannel, pwmWidth, 8);
ledcAttachPin(pin, pwmChannel);
// ledcSetup(pwmChannel, pwmWidth, 8);
// ledcAttachPin(pin, pwmChannel);
ledcAttach(pin, pwmWidth, 8);
}
I hope you can implement this fixes to your project.
Metadata
Metadata
Assignees
Labels
No labels