ESPHome 2026.3.2
Loading...
Searching...
No Matches
micronova.h
Go to the documentation of this file.
1#pragma once
2
7#include "esphome/core/log.h"
8
9namespace esphome::micronova {
10
11static constexpr uint8_t WRITE_QUEUE_SIZE = 10;
12
18 uint8_t data;
19
20 bool is_write() const;
21};
22
23class MicroNova;
24
26// Interface classes.
28 public:
30
31 void set_memory_location(uint8_t l) { this->memory_location_ = l; }
32 uint8_t get_memory_location() { return this->memory_location_; }
33
34 void set_memory_address(uint8_t a) { this->memory_address_ = a; }
35 uint8_t get_memory_address() { return this->memory_address_; }
36
37 void dump_base_config();
38
39 protected:
41 uint8_t memory_location_ = 0;
42 uint8_t memory_address_ = 0;
43};
44
46 public:
48
49 void update() override { this->request_value_from_stove_(); }
50
51 virtual void process_value_from_stove(int value_from_stove) = 0;
52
53 void dump_base_config();
54
55 protected:
57};
58
60// Main component class
61class MicroNova : public Component, public uart::UARTDevice {
62 public:
63 MicroNova(GPIOPin *enable_rx_pin) : enable_rx_pin_(enable_rx_pin) {}
64
65 void setup() override;
66 void loop() override;
67 void dump_config() override;
68
69#ifdef MICRONOVA_LISTENER_COUNT
71
76 void queue_read_request(uint8_t location, uint8_t address);
77#endif
78
79#ifdef USE_MICRONOVA_WRITER
85 bool queue_write_command(uint8_t location, uint8_t address, uint8_t data);
86#endif
87
88 protected:
91#ifdef MICRONOVA_LISTENER_COUNT
93#endif
94
96
97#ifdef USE_MICRONOVA_WRITER
99#endif
100#ifdef MICRONOVA_LISTENER_COUNT
102#endif
105 bool reply_pending_{false};
106
107#ifdef MICRONOVA_LISTENER_COUNT
109#endif
110};
111
112} // namespace esphome::micronova
uint8_t l
Definition bl0906.h:0
uint8_t m
Definition bl0906.h:1
uint8_t address
Definition bl0906.h:4
This class simplifies creating components that periodically check a state.
Definition component.h:538
Fixed-size circular buffer with FIFO semantics and iteration support.
Definition helpers.h:303
Minimal static vector - saves memory by avoiding std::vector overhead.
Definition helpers.h:209
MicroNovaCommand current_command_
Definition micronova.h:103
StaticVector< MicroNovaListener *, MICRONOVA_LISTENER_COUNT > listeners_
Definition micronova.h:108
bool reply_pending_
True if we are waiting for a reply from the stove.
Definition micronova.h:105
MicroNova(GPIOPin *enable_rx_pin)
Definition micronova.h:63
StaticRingBuffer< MicroNovaCommand, MICRONOVA_LISTENER_COUNT > read_queue_
Definition micronova.h:101
void queue_read_request(uint8_t location, uint8_t address)
Queue a read request to the stove (low priority - added at back) All listeners registered for this ad...
bool queue_write_command(uint8_t location, uint8_t address, uint8_t data)
Queue a write command to the stove (processed before reads)
uint32_t transmission_time_
Time when current command was sent.
Definition micronova.h:104
StaticRingBuffer< MicroNovaCommand, WRITE_QUEUE_SIZE > write_queue_
Definition micronova.h:98
void register_micronova_listener(MicroNovaListener *listener)
Definition micronova.cpp:41
virtual void process_value_from_stove(int value_from_stove)=0
static void uint32_t
Represents a command to be sent to the stove Write commands have the high bit (0x80) set in memory_lo...
Definition micronova.h:15
uint8_t data
Only used for write commands.
Definition micronova.h:18