fit the memory usage for esp32c3

This commit is contained in:
Terrence
2024-11-29 11:06:05 +08:00
parent ff28586c35
commit 436ff2b906
35 changed files with 754 additions and 360 deletions

View File

@@ -2,10 +2,9 @@
#define _LED_H_
#include <led_strip.h>
#include <freertos/semphr.h>
#include <freertos/task.h>
#include <freertos/event_groups.h>
#include <esp_timer.h>
#include <atomic>
#include <mutex>
#define BLINK_INFINITE -1
#define BLINK_TASK_STOPPED_BIT BIT0
@@ -33,17 +32,16 @@ public:
void SetBlue(uint8_t brightness = DEFAULT_BRIGHTNESS) { SetColor(0, 0, brightness); }
private:
SemaphoreHandle_t mutex_;
EventGroupHandle_t blink_event_group_;
std::mutex mutex_;
TaskHandle_t blink_task_ = nullptr;
led_strip_handle_t led_strip_ = nullptr;
uint8_t r_ = 0, g_ = 0, b_ = 0;
int blink_times_ = 0;
int blink_counter_ = 0;
int blink_interval_ms_ = 0;
std::atomic<bool> should_blink_{false};
esp_timer_handle_t blink_timer_ = nullptr;
void StartBlinkTask(int times, int interval_ms);
void StopBlinkInternal();
void OnBlinkTimer();
};
#endif // _LED_H_