Revision b4885314 devices/PowerManagement/main.cpp
devices/PowerManagement/main.cpp | ||
---|---|---|
976 | 976 |
|
977 | 977 |
extStart(&EXTD1, &extcfg); |
978 | 978 |
|
979 |
boardClearI2CBus(GPIOB_GAUGE_SCL1); |
|
980 |
boardClearI2CBus(GPIOB_GAUGE_SCL2); |
|
979 |
boardClearI2CBus(GPIOB_GAUGE_SCL1, GPIOB_GAUGE_SDA1);
|
|
980 |
boardClearI2CBus(GPIOB_GAUGE_SCL2, GPIOB_GAUGE_SDA2);
|
|
981 | 981 |
|
982 | 982 |
global.HW_I2C1.start(&global.i2c1_config); |
983 | 983 |
global.HW_I2C2.start(&global.i2c2_config); |
984 | 984 |
|
985 |
uint16_t i2c_test = 0; |
|
986 |
while (global.ina219[INA_VIO18].readRegister(INA219::Driver::REG_BUS_VOLTAGE, i2c_test) != RDY_OK) { |
|
987 |
chprintf((BaseSequentialStream*)&global.sercanmux1, "I2C #1 stalled! trying to clear the bus... (this will take 20 seconds)\n"); |
|
988 |
boardWriteLed(1); |
|
989 |
boardResetBQ27500I2C(GPIOB_GAUGE_SCL2, GPIOB_GAUGE_SDA2); |
|
990 |
boardWriteLed(0); |
|
991 |
} |
|
992 |
while (global.ina219[INA_VDD].readRegister(INA219::Driver::REG_BUS_VOLTAGE, i2c_test) != RDY_OK) { |
|
993 |
chprintf((BaseSequentialStream*)&global.sercanmux1, "I2C #2 stalled! trying to clear the bus... (this will take 20 seconds)\n"); |
|
994 |
boardWriteLed(1); |
|
995 |
boardResetBQ27500I2C(GPIOB_GAUGE_SCL1, GPIOB_GAUGE_SDA1); |
|
996 |
boardWriteLed(0); |
|
997 |
} |
|
998 |
|
|
985 | 999 |
global.memory.init(); |
986 | 1000 |
uint8_t i = 0; |
987 | 1001 |
if (global.memory.getBoardId(&i) == fileSystemIo::FileSystemIoBase::OK) { |
Also available in: Unified diff