mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 09:44:12 +01:00
cleanup
This commit is contained in:
parent
49e4bdd9bf
commit
d2ba9e9a07
2 changed files with 14 additions and 19 deletions
|
@ -54,13 +54,13 @@ async def to_code(config):
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
await uart.register_uart_device(var, config)
|
await uart.register_uart_device(var, config)
|
||||||
|
|
||||||
p = await cg.gpio_pin_expression(config[CONF_PIN_AUX])
|
pin_aux = await cg.gpio_pin_expression(config[CONF_PIN_AUX])
|
||||||
cg.add(var.set_pin_aux(p))
|
cg.add(var.set_pin_aux(pin_aux))
|
||||||
|
|
||||||
p = await cg.gpio_pin_expression(config[CONF_PIN_M0])
|
pin_m0 = await cg.gpio_pin_expression(config[CONF_PIN_M0])
|
||||||
cg.add(var.set_pin_m0(p))
|
cg.add(var.set_pin_m0(pin_m0))
|
||||||
p = await cg.gpio_pin_expression(config[CONF_PIN_M1])
|
pin_m1 = await cg.gpio_pin_expression(config[CONF_PIN_M1])
|
||||||
cg.add(var.set_pin_m1(p))
|
cg.add(var.set_pin_m1(pin_m1))
|
||||||
|
|
||||||
if CONF_LORA_MESSAGE in config:
|
if CONF_LORA_MESSAGE in config:
|
||||||
sens = await text_sensor.new_text_sensor(config[CONF_LORA_MESSAGE])
|
sens = await text_sensor.new_text_sensor(config[CONF_LORA_MESSAGE])
|
||||||
|
|
|
@ -33,18 +33,13 @@ class Lora : public PollingComponent, public uart::UARTDevice {
|
||||||
void update() override;
|
void update() override;
|
||||||
void loop() override;
|
void loop() override;
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
// local
|
|
||||||
/// Helper function to read the value of a pin.
|
|
||||||
bool digital_read(uint8_t pin);
|
|
||||||
/// Helper function to write the value of a pin.
|
/// Helper function to write the value of a pin.
|
||||||
void digital_write(uint8_t pin, bool value);
|
void digital_write(uint8_t pin, bool value);
|
||||||
/// Helper function to set the pin mode of a pin.
|
void set_message_sensor(text_sensor::TextSensor *message_text_sensor) { message_text_sensor_ = message_text_sensor; }
|
||||||
void pin_mode(uint8_t pin, gpio::Flags flags);
|
void set_rssi_sensor(sensor::Sensor *rssi_sensor) { rssi_sensor_ = rssi_sensor; }
|
||||||
void set_message_sensor(text_sensor::TextSensor *s) { message_text_sensor_ = s; }
|
void set_pin_aux(GPIOPin *pin_aux) { pin_aux_ = pin_aux; }
|
||||||
void set_rssi_sensor(sensor::Sensor *s) { rssi_sensor_ = s; }
|
void set_pin_m0(GPIOPin *pin_m0) { pin_m0_ = pin_m0; }
|
||||||
void set_pin_aux(GPIOPin *s) { pin_aux_ = s; }
|
void set_pin_m1(GPIOPin *pin_m1) { pin_m1_ = pin_m1; }
|
||||||
void set_pin_m0(GPIOPin *s) { pin_m0_ = s; }
|
|
||||||
void set_pin_m1(GPIOPin *s) { pin_m1_ = s; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ModeType mode_ = MODE_INIT;
|
ModeType mode_ = MODE_INIT;
|
||||||
|
@ -66,9 +61,9 @@ class Lora : public PollingComponent, public uart::UARTDevice {
|
||||||
std::string raw_message_;
|
std::string raw_message_;
|
||||||
text_sensor::TextSensor *message_text_sensor_{nullptr};
|
text_sensor::TextSensor *message_text_sensor_{nullptr};
|
||||||
sensor::Sensor *rssi_sensor_{nullptr};
|
sensor::Sensor *rssi_sensor_{nullptr};
|
||||||
GPIOPin *pin_aux_{nullptr};
|
GPIOPin *pin_aux_;
|
||||||
GPIOPin *pin_m0_{nullptr};
|
GPIOPin *pin_m0_;
|
||||||
GPIOPin *pin_m1_{nullptr};
|
GPIOPin *pin_m1_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace lora
|
} // namespace lora
|
||||||
|
|
Loading…
Reference in a new issue