File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,22 @@ SERCOM sercom5(SERCOM5);
185185#define PMIC_REG01 0x01
186186#define PMIC_REG07 0x07
187187
188+ #define PMIC_REG00 0x00
189+
190+ static inline void set_voltage_current_thresholds () {
191+ PERIPH_WIRE.initMasterWIRE (100000 );
192+ PERIPH_WIRE.enableWIRE ();
193+ pinPeripheral (PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType );
194+ pinPeripheral (PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType );
195+
196+ PERIPH_WIRE.startTransmissionWIRE ( PMIC_ADDRESS, WIRE_WRITE_FLAG );
197+ PERIPH_WIRE.sendDataMasterWIRE (PMIC_REG00);
198+ PERIPH_WIRE.sendDataMasterWIRE (0x06 ); // input voltage limit = 3.88V, input current limit = 2A
199+ PERIPH_WIRE.prepareCommandBitsWire (WIRE_MASTER_ACT_STOP);
200+
201+ PERIPH_WIRE.disableWIRE ();
202+ }
203+
188204static inline void enable_battery_charging () {
189205 PERIPH_WIRE.initMasterWIRE (100000 );
190206 PERIPH_WIRE.enableWIRE ();
@@ -230,6 +246,7 @@ void initVariant() {
230246 enable_battery_charging ();
231247 }
232248 disable_battery_fet (!batteryPresent);
249+ set_voltage_current_thresholds ();
233250#endif
234251
235252 // put GSM modem in reset on start to conserve power if it's not used
You can’t perform that action at this time.
0 commit comments