forked from EmbeddedTeam/app_photomagnetic
36 lines
909 B
C++
36 lines
909 B
C++
#ifndef __THER_COM_HPP__
|
|
#define __THER_COM_HPP__
|
|
|
|
#include <led_strip_indicator/led_strip_indicator.hpp>
|
|
#include <uart_com/simple_protocal.hpp>
|
|
#include <zpp/driver.hpp>
|
|
#include <zpp/error.hpp>
|
|
namespace ther {
|
|
|
|
template <device *kDev> class Com {
|
|
public:
|
|
enum Addr : uint8_t { TEMP = 0, GET_ID, RUNNING_STATE };
|
|
using CbTableValueType =
|
|
std::pair<const uint8_t, void (*)(uart_com::DataType)>;
|
|
static auto Init() -> zpp::error {
|
|
s_proto->SetRxCallbackTable({GET_ID, Cb::GetId},
|
|
{RUNNING_STATE, Cb::RunningState});
|
|
return zpp::ok();
|
|
}
|
|
|
|
private:
|
|
struct Cb {
|
|
static auto GetId(uart_com::DataType data) -> void {
|
|
// TODO
|
|
}
|
|
static auto RunningState(uart_com::DataType data) -> void {
|
|
// TODO
|
|
}
|
|
};
|
|
constexpr static uart_com::SimpleProtocal *s_proto =
|
|
(uart_com::SimpleProtocal *)(kDev);
|
|
};
|
|
} // namespace ther
|
|
|
|
#endif
|