7using dfrobot_sen0465_base::FRAME_HEAD;
8using dfrobot_sen0465_base::FRAME_SIZE;
9using dfrobot_sen0465_base::RESPONSE_TIMEOUT_ID;
12static constexpr uint32_t RESPONSE_TIMEOUT_MS = 3000;
17 DFRobotSEN0465Component::setup();
51 this->
set_timeout(RESPONSE_TIMEOUT_ID, RESPONSE_TIMEOUT_MS, [
this]() {
bool cancel_timeout(const char *name)
Cancel a timeout function.
void enable_loop()
Enable this component's loop.
void set_timeout(const char *name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a const char* name.
void disable_loop()
Disable this component's loop.
void handle_no_response_()
void handle_response_(const uint8_t *frame)
void read_response() override
uint8_t rx_buffer_[dfrobot_sen0465_base::FRAME_SIZE]
bool write_frame(const uint8_t *frame) override
optional< std::array< uint8_t, N > > read_array()
bool peek_byte(uint8_t *data)
void discard_available()
Read and drop every byte waiting in the receive buffer.
bool read_byte(uint8_t *data)
void write_array(const uint8_t *data, size_t len)