Fix style
This commit is contained in:
@ -145,7 +145,11 @@ int16_t battery_charger_enable(void) {
|
||||
return res;
|
||||
|
||||
// Set input current in mA
|
||||
res = smbus_write(CHARGER_ADDRESS, REG_INPUT_CURRENT, INPUT_CURRENT(battery_charger_input_current));
|
||||
res = smbus_write(
|
||||
CHARGER_ADDRESS,
|
||||
REG_INPUT_CURRENT,
|
||||
INPUT_CURRENT(battery_charger_input_current)
|
||||
);
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
|
@ -145,7 +145,11 @@ int16_t battery_charger_enable(void) {
|
||||
return res;
|
||||
|
||||
// Set input current in mA
|
||||
res = smbus_write(CHARGER_ADDRESS, REG_ADAPTER_CURRENT, INPUT_CURRENT(battery_charger_input_current));
|
||||
res = smbus_write(
|
||||
CHARGER_ADDRESS,
|
||||
REG_ADAPTER_CURRENT,
|
||||
INPUT_CURRENT(battery_charger_input_current)
|
||||
);
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
|
@ -355,8 +355,7 @@ void power_cpu_reset(void) {
|
||||
//TODO: if this returns false, retry?
|
||||
power_peci_limit(
|
||||
// AC is connected
|
||||
(!gpio_get(&ACIN_N))
|
||||
&&
|
||||
(!gpio_get(&ACIN_N)) &&
|
||||
// There is available current
|
||||
(battery_charger_input_current >= CHARGER_INPUT_CURRENT)
|
||||
);
|
||||
|
@ -23,11 +23,8 @@ static int16_t usbpd_current_limit(void) {
|
||||
int16_t res = i2c_get(&I2C_USBPD, USBPD_ADDRESS, REG_ACTIVE_CONTRACT_PDO, value, sizeof(value));
|
||||
if (res == 7) {
|
||||
if (value[0] == 6) {
|
||||
uint32_t pdo =
|
||||
((uint32_t)value[1]) |
|
||||
(((uint32_t)value[2]) << 8) |
|
||||
(((uint32_t)value[3]) << 16) |
|
||||
(((uint32_t)value[4]) << 24);
|
||||
uint32_t pdo = ((uint32_t)value[1]) | (((uint32_t)value[2]) << 8) |
|
||||
(((uint32_t)value[3]) << 16) | (((uint32_t)value[4]) << 24);
|
||||
DEBUG("USBPD PDO %08lX ", pdo);
|
||||
uint8_t kind = (uint8_t)((pdo >> 30) & 0b11);
|
||||
if (kind == 0b00) {
|
||||
@ -73,7 +70,7 @@ static int16_t usbpd_current_limit(void) {
|
||||
|
||||
static void usbpd_dump(void) {
|
||||
/* Dump all registers for debugging */
|
||||
for(uint8_t reg = 0x00; reg < 0x40; reg+=1) {
|
||||
for (uint8_t reg = 0x00; reg < 0x40; reg += 1) {
|
||||
uint8_t value[65] = { 0 };
|
||||
int16_t res = i2c_get(&I2C_USBPD, USBPD_ADDRESS, reg, value, sizeof(value));
|
||||
if (res < 0) {
|
||||
|
Reference in New Issue
Block a user