summaryrefslogtreecommitdiff
path: root/src/drivers/samd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/samd.cpp')
-rw-r--r--src/drivers/samd.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/drivers/samd.cpp b/src/drivers/samd.cpp
index c5e8c08a..e4aa73ad 100644
--- a/src/drivers/samd.cpp
+++ b/src/drivers/samd.cpp
@@ -51,6 +51,7 @@ Samd::Samd() {
UpdateChargeStatus();
UpdateUsbStatus();
+ SetFastChargeEnabled(true);
}
Samd::~Samd() {}
@@ -125,6 +126,18 @@ auto Samd::ResetToFlashSamd() -> void {
ESP_ERROR_CHECK(transaction.Execute(3));
}
+auto Samd::SetFastChargeEnabled(bool en) -> void {
+ if (version_ < 4) {
+ return;
+ }
+ I2CTransaction transaction;
+ transaction.start()
+ .write_addr(kAddress, I2C_MASTER_WRITE)
+ .write_ack(Registers::kPowerControl, (en << 1))
+ .stop();
+ ESP_ERROR_CHECK(transaction.Execute(3));
+}
+
auto Samd::PowerDown() -> void {
I2CTransaction transaction;
transaction.start()