forked from EmbeddedTeam/app_photomagnetic
- Add CONFIG_SAMPLE_NTC to CMakeLists.txt and Kconfig - Implement PI temperature controller with PWM output in heating.hpp - Convert NtcGroup from template to non-template class - Add LED helper class with flash support - Implement COM protocol handlers for device ID and running state - Add SPI, sensor, and PWM configuration to prj.conf - Remove indicator overlay and update main.cpp with temperature monitoring - Add test script for serial protocol communication
30 lines
618 B
C++
30 lines
618 B
C++
#ifndef __THER_LED_HPP__
|
|
#define __THER_LED_HPP__
|
|
#include <zephyr/drivers/led.h>
|
|
#include <zpp/work_queue.hpp>
|
|
namespace ther {
|
|
|
|
template <led_dt_spec kSpec> class Led {
|
|
public:
|
|
static auto On() { led_on_dt(&kSpec); }
|
|
static auto Off() { led_off_dt(&kSpec); }
|
|
template <typename TRep, typename TPeriod>
|
|
static auto Flash(std::chrono::duration<TRep, TPeriod> period) {
|
|
s_work.submit(period);
|
|
}
|
|
|
|
private:
|
|
inline static zpp::periodic_work<> s_work{[]() {
|
|
static bool is_on = false;
|
|
if (is_on) {
|
|
Off();
|
|
} else {
|
|
On();
|
|
}
|
|
is_on = !is_on;
|
|
}};
|
|
};
|
|
|
|
} // namespace ther
|
|
#endif
|