14 namespace shelly_dimmer {
18 static constexpr uint16_t SHELLY_DIMMER_BUFFER_SIZE = 256;
25 void setup()
override;
58 std::array<uint8_t, SHELLY_DIMMER_BUFFER_SIZE>
buffer_;
123 #endif // USE_ESP8266 size_t frame_command_(uint8_t *data, uint8_t cmd, const uint8_t *payload, size_t len)
Frames a given command payload.
void reset_normal_boot_()
Reset STM32 to boot the regular firmware.
bool is_running_configured_version() const
void set_warmup_time(uint16_t warmup_time)
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
sensor::Sensor * current_sensor_
void send_settings_()
Sends dimmer configuration.
Interface to write LightStates to hardware.
std::array< uint8_t, SHELLY_DIMMER_BUFFER_SIZE > buffer_
void set_max_brightness(uint16_t max_brightness)
int handle_byte_(uint8_t c)
Handles a single byte as part of a protocol frame.
void set_min_brightness(uint16_t min_brightness)
void reset_dfu_boot_()
Reset STM32 to boot into DFU mode to enable firmware upgrades.
bool read_frame_()
Reads a response frame.
void write_state(light::LightState *state) override
const float LATE
For components that should be initialized at the very end of the setup process.
void set_leading_edge(bool leading_edge)
light::LightTraits get_traits() override
This class simplifies creating components that periodically check a state.
void reset_(bool boot0)
Reset STM32 with the BOOT0 pin set to the given value.
void set_fade_rate(uint16_t fade_rate)
bool send_command_(uint8_t cmd, const uint8_t *payload, uint8_t len)
Sends a command and waits for an acknowledgement.
uint16_t warmup_brightness_
sensor::Sensor * power_sensor_
void set_voltage_sensor(sensor::Sensor *voltage_sensor)
void set_warmup_brightness(uint16_t warmup_brightness)
light::LightState * state_
uint16_t convert_brightness_(float brightness)
Convert relative brightness into a dimmer brightness value.
bool upgrade_firmware_()
Performs a firmware upgrade.
float get_setup_priority() const override
Master brightness of the light can be controlled.
This class is used to represent the capabilities of a light.
void set_power_sensor(sensor::Sensor *power_sensor)
bool handle_frame_()
Handles a complete frame.
void dump_config() override
void setup_state(light::LightState *state) override
void set_current_sensor(sensor::Sensor *current_sensor)
Implementation of SPI Controller mode.
sensor::Sensor * voltage_sensor_
void set_nrst_pin(GPIOPin *nrst_pin)
Base-class for all sensors.
void set_boot0_pin(GPIOPin *boot0_pin)
void send_brightness_(uint16_t brightness)
Sends the given brightness value.