ESPHome 2026.11.0b6
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 i2c::I2CDevice,
13 public gpio_expander::CachedGpioExpander<uint8_t, 8> {
14 public:
16
17 void setup() override;
18 void pin_mode(uint8_t pin, gpio::Flags flags);
19
20 float get_setup_priority() const override;
21
22 void dump_config() override;
23
24 void loop() override;
25
26 uint16_t get_adc_value();
28 void set_pwm_value(uint8_t value); // 0 - 255
30 void write_pwm_level(float state, uint8_t min_value, uint8_t max_value);
31
32 protected:
33 bool digital_read_hw(uint8_t pin) override;
34 bool digital_read_cache(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 uint8_t input_mask_{0x00}; // The state read in digital_read_hw - 1 means HIGH, 0 means LOW
40
41 bool write_gpio_modes_();
43};
44
46
47} // namespace esphome::waveshare_io_ch32v003
48
A class to cache the read state of a GPIO expander.
Definition cached_gpio.h:29
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:41
ESPHOME_EXPANDER_PIN_SUMMARY_DECL(esphome::waveshare_io_ch32v003::WaveshareIOCH32V003Component)