diff --git a/blinds.yaml b/blinds.yaml index bbd450c..ddf8d53 100644 --- a/blinds.yaml +++ b/blinds.yaml @@ -4,13 +4,15 @@ esphome: project: name: dasfoo.blinds - version: "1.0" + version: "2.0" includes: - somfy.h + - cc1101.h libraries: - SPI + - lsatan/SmartRC-CC1101-Driver-Lib packages: device_base: !include templates/esp32-poe.yaml @@ -25,7 +27,7 @@ globals: cover: - platform: custom lambda: |- - auto rfPin = D2; + auto rfPin = 4; std::vector blinds; for (int i = 0; i < 13; ++i) { @@ -37,6 +39,9 @@ cover: App.register_component(cover); } + // SomfyRTS ctor will set correct pin modes, now we can initialize cc1101. + cc1101_Init(); + return blinds; covers: diff --git a/cc1101.h b/cc1101.h new file mode 100644 index 0000000..648a13e --- /dev/null +++ b/cc1101.h @@ -0,0 +1,10 @@ +#include + +void cc1101_Init() { + ELECHOUSE_cc1101.addSpiPin(14, 16, 15, 13, 0); + ELECHOUSE_cc1101.setModul(0); + ELECHOUSE_cc1101.Init(); + ELECHOUSE_cc1101.setPA(7); + ELECHOUSE_cc1101.setMHZ(433.34); + ELECHOUSE_cc1101.SetTx(); +}