rename folder

This commit is contained in:
2023-12-17 20:31:18 +01:00
parent 9ee2ee5864
commit 90b58c7e4d
76 changed files with 0 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
```yaml
# example configuration:
empty_i2c_component:
id: empty_i2c_component_1
address: 0x01 # optional
i2c:
sda: 4
scl: 5
```
@@ -0,0 +1,20 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c, sensor
from esphome.const import CONF_ID
DEPENDENCIES = ['i2c']
CONF_I2C_ADDR = 0x01
empty_i2c_component_ns = cg.esphome_ns.namespace('empty_i2c_component')
EmptyI2CComponent = empty_i2c_component_ns.class_('EmptyI2CComponent', cg.Component, i2c.I2CDevice)
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(EmptyI2CComponent)
}).extend(cv.COMPONENT_SCHEMA).extend(i2c.i2c_device_schema(CONF_I2C_ADDR))
def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config)
yield i2c.register_i2c_device(var, config)
@@ -0,0 +1,26 @@
#include "esphome/core/log.h"
#include "empty_i2c_component.h"
namespace esphome {
namespace empty_i2c_component {
static const char *TAG = "empty_i2c_component.component";
void EmptyI2CComponent::setup() {
this->write_register(0x0, 0x1, 0x1);
}
void EmptyI2CComponent::loop() {
this->write_register(0x0, 0x1, 0x1);
delay(1000);
this->write_register(0x0, 0x0, 0x1);
delay(1000);
}
void EmptyI2CComponent::dump_config(){
ESP_LOGCONFIG(TAG, "Empty I2C component");
}
} // namespace empty_i2c_component
} // namespace esphome
@@ -0,0 +1,18 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/components/i2c/i2c.h"
namespace esphome {
namespace empty_i2c_component {
class EmptyI2CComponent : public i2c::I2CDevice, public Component {
public:
void setup() override;
void loop() override;
void dump_config() override;
};
} // namespace empty_i2c_component
} // namespace esphome