summaryrefslogtreecommitdiffstats
path: root/esphome/config/my_components/mycc1101/mycc1101.h
diff options
context:
space:
mode:
Diffstat (limited to 'esphome/config/my_components/mycc1101/mycc1101.h')
-rw-r--r--esphome/config/my_components/mycc1101/mycc1101.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/esphome/config/my_components/mycc1101/mycc1101.h b/esphome/config/my_components/mycc1101/mycc1101.h
new file mode 100644
index 0000000..95f714d
--- /dev/null
+++ b/esphome/config/my_components/mycc1101/mycc1101.h
@@ -0,0 +1,39 @@
1#pragma once
2
3#include "esphome/components/cc1101/cc1101.h"
4#include "esphome/components/cc1101/cc1101defs.h"
5
6namespace esphome {
7namespace cc1101 {
8
9static const char *const TAG = "mycc1101";
10
11class MyCC1101Component : public CC1101Component {
12 public:
13 void idle() {
14 ESP_LOGD(TAG, "idle");
15 this->send_(Command::IDLE);
16 }
17
18 void power_down() {
19 ESP_LOGD(TAG, "power_down");
20 this->send_(Command::IDLE);
21 this->send_(Command::PWD);
22 }
23
24 void wakeup() {
25 ESP_LOGD(TAG, "wakeup");
26 this->cs_->digital_write(false);
27 delayMicroseconds(10);
28 this->cs_->digital_write(true);
29 delayMicroseconds(200);
30
31 this->send_(Command::IDLE);
32
33 // set patable after after wakeup
34 this->set_output_power(this->output_power_requested_);
35 }
36};
37
38} // namespace cc1101
39} // namespace esphome