summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/include/samd.hpp1
-rw-r--r--src/drivers/samd.cpp9
2 files changed, 10 insertions, 0 deletions
diff --git a/src/drivers/include/samd.hpp b/src/drivers/include/samd.hpp
index 4a31a577..2640eb8b 100644
--- a/src/drivers/include/samd.hpp
+++ b/src/drivers/include/samd.hpp
@@ -52,6 +52,7 @@ class Samd {
auto UpdateUsbStatus() -> void;
auto ResetToFlashSamd() -> void;
+ auto PowerDown() -> void;
static auto CreateReadPending() -> SemaphoreHandle_t;
diff --git a/src/drivers/samd.cpp b/src/drivers/samd.cpp
index 455e9ce5..176da241 100644
--- a/src/drivers/samd.cpp
+++ b/src/drivers/samd.cpp
@@ -138,6 +138,15 @@ auto Samd::ResetToFlashSamd() -> void {
ESP_ERROR_CHECK(transaction.Execute());
}
+auto Samd::PowerDown() -> void {
+ I2CTransaction transaction;
+ transaction.start()
+ .write_addr(kAddress, I2C_MASTER_WRITE)
+ .write_ack(Registers::kPowerControl, 0b1)
+ .stop();
+ ESP_ERROR_CHECK(transaction.Execute());
+}
+
auto Samd::CreateReadPending() -> SemaphoreHandle_t {
sReadPending = xSemaphoreCreateBinary();
return sReadPending;