mirror of
https://github.com/esphome/esphome.git
synced 2025-11-18 07:45:56 +00:00
Co-authored-by: Djordje Mandic <6750655+DjordjeMandic@users.noreply.github.com> Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
36 lines
790 B
C++
36 lines
790 B
C++
#pragma once
|
|
|
|
#include "esphome/components/i2c/i2c.h"
|
|
#include "esphome/core/component.h"
|
|
|
|
namespace esphome {
|
|
namespace gp8403 {
|
|
|
|
enum GP8403Voltage {
|
|
GP8403_VOLTAGE_5V = 0x00,
|
|
GP8403_VOLTAGE_10V = 0x11,
|
|
};
|
|
|
|
enum GP8403Model {
|
|
GP8403,
|
|
GP8413,
|
|
};
|
|
|
|
class GP8403Component : public Component, public i2c::I2CDevice {
|
|
public:
|
|
void setup() override;
|
|
void dump_config() override;
|
|
float get_setup_priority() const override { return setup_priority::DATA; }
|
|
void set_model(GP8403Model model) { this->model_ = model; }
|
|
void set_voltage(gp8403::GP8403Voltage voltage) { this->voltage_ = voltage; }
|
|
|
|
void write_state(float state, uint8_t channel);
|
|
|
|
protected:
|
|
GP8403Voltage voltage_;
|
|
GP8403Model model_{GP8403Model::GP8403};
|
|
};
|
|
|
|
} // namespace gp8403
|
|
} // namespace esphome
|