|
|
@@ -98,10 +98,11 @@ int main(void)
|
|
|
|
|
|
{
|
|
|
SYSCFG_DL_init();
|
|
|
- battery_slotmgr.init();
|
|
|
NVIC_EnableIRQ(I2C_controller_INST_INT_IRQN);
|
|
|
NVIC_EnableIRQ(I2C_target_INST_INT_IRQN);
|
|
|
|
|
|
+ battery_slotmgr.init();
|
|
|
+
|
|
|
initialize_target_address();
|
|
|
|
|
|
while (1) {
|
|
|
@@ -118,11 +119,11 @@ int main(void)
|
|
|
// step 2: control loop to adjust the dac / adc values,
|
|
|
// but only if no error happens
|
|
|
// (0x80 is the error flag of the state)
|
|
|
- //if ((*battery_slots[slot].state & 0x80) == 0) {
|
|
|
+ if ((*battery_slots[slot].state & 0x80) == 0) {
|
|
|
battery_slotmgr.adjust_current(slot);
|
|
|
- //} else {
|
|
|
- // battery_slotmgr.disable(slot);
|
|
|
- //}
|
|
|
+ } else {
|
|
|
+ battery_slotmgr.disable(slot);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
delay_cycles(MAINLOOP_DELAY);
|