|
|
@ -51,6 +51,7 @@ Samd::Samd() { |
|
|
|
|
|
|
|
|
|
|
|
UpdateChargeStatus(); |
|
|
|
UpdateChargeStatus(); |
|
|
|
UpdateUsbStatus(); |
|
|
|
UpdateUsbStatus(); |
|
|
|
|
|
|
|
SetFastChargeEnabled(true); |
|
|
|
} |
|
|
|
} |
|
|
|
Samd::~Samd() {} |
|
|
|
Samd::~Samd() {} |
|
|
|
|
|
|
|
|
|
|
@ -125,6 +126,18 @@ auto Samd::ResetToFlashSamd() -> void { |
|
|
|
ESP_ERROR_CHECK(transaction.Execute(3)); |
|
|
|
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 { |
|
|
|
auto Samd::PowerDown() -> void { |
|
|
|
I2CTransaction transaction; |
|
|
|
I2CTransaction transaction; |
|
|
|
transaction.start() |
|
|
|
transaction.start() |
|
|
|