5using dfrobot_sen0465_base::FRAME_SIZE;
6using dfrobot_sen0465_base::RESPONSE_TIMEOUT_ID;
9static constexpr uint32_t RESPONSE_TIMEOUT_MS = 3000;
14 DFRobotSEN0465Component::setup();
19 const uint8_t *frame =
nullptr;
39 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.
const uint8_t * feed(uint8_t c)
Feed one byte; returns the completed frame, header included, valid until the next call,...
void reset()
Forget the partial frame and look for a header from the next byte.
void handle_no_response_()
void handle_response_(const uint8_t *frame)
void read_response() override
bool write_frame(const uint8_t *frame) override
FrameReader< dfrobot_sen0465_base::FRAME_SIZE, dfrobot_sen0465_base::FRAME_HEAD > reader_
void discard_available()
Read and drop every byte waiting in the receive buffer.
bool read_available(F &&on_byte)
Same as read_available_chunks(), calling on_byte(uint8_t) once per byte.
void write_array(const uint8_t *data, size_t len)