ESPHome 2026.12.0-dev
Loading...
Searching...
No Matches
waveshare_io_ch32v003.h
Go to the documentation of this file.
1#pragma once
2
6#include "esphome/core/hal.h"
8
10
12 : public Component,
13 public gpio_expander::GpioExpanderInputs<gpio_expander::CachedGpioExpander<uint8_t, 8>>,
14 public i2c::I2CDevice {
15 public:
17
18 void setup() override;
19 void pin_mode(uint8_t pin, gpio::Flags flags);
20
21 float get_setup_priority() const override;
22
23 void dump_config() override;
24
25 void loop() override;
26
27 uint16_t get_adc_value();
29 void set_pwm_value(uint8_t value); // 0 - 255
31 void write_pwm_level(float state, uint8_t min_value, uint8_t max_value);
32
33 protected:
34 bool digital_read_hw(uint8_t pin) override;
35 void digital_write_hw(uint8_t pin, bool value) override;
36
37 uint8_t mode_mask_{0x00}; // Mask for the pin mode - 1 means output, 0 means input
38 uint8_t output_mask_{0x00}; // The mask to write as output state - 1 means HIGH, 0 means LOW
39
40 bool write_gpio_modes_();
42};
43
45
46} // namespace esphome::waveshare_io_ch32v003
47
Adds a store of the last value read from each bank to a read cache Base.
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:144
void write_pwm_level(float state, uint8_t min_value, uint8_t max_value)
Write an output level, 0.0 to 1.0, clamped to the board's safe PWM range.
uint16_t flags
bool state
Definition fan.h:2
uint32_t value
Definition hal.cpp:59
ESPHOME_EXPANDER_PIN_SUMMARY_DECL(esphome::waveshare_io_ch32v003::WaveshareIOCH32V003Component)