Fix style

This commit is contained in:
Jeremy Soller
2023-03-31 07:57:30 -06:00
parent 916c9f8c5f
commit d38ef1413f
4 changed files with 14 additions and 10 deletions

View File

@ -145,7 +145,11 @@ int16_t battery_charger_enable(void) {
return res; return res;
// Set input current in mA // 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) if (res < 0)
return res; return res;

View File

@ -145,7 +145,11 @@ int16_t battery_charger_enable(void) {
return res; return res;
// Set input current in mA // 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) if (res < 0)
return res; return res;

View File

@ -355,8 +355,7 @@ void power_cpu_reset(void) {
//TODO: if this returns false, retry? //TODO: if this returns false, retry?
power_peci_limit( power_peci_limit(
// AC is connected // AC is connected
(!gpio_get(&ACIN_N)) (!gpio_get(&ACIN_N)) &&
&&
// There is available current // There is available current
(battery_charger_input_current >= CHARGER_INPUT_CURRENT) (battery_charger_input_current >= CHARGER_INPUT_CURRENT)
); );

View File

@ -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)); int16_t res = i2c_get(&I2C_USBPD, USBPD_ADDRESS, REG_ACTIVE_CONTRACT_PDO, value, sizeof(value));
if (res == 7) { if (res == 7) {
if (value[0] == 6) { if (value[0] == 6) {
uint32_t pdo = uint32_t pdo = ((uint32_t)value[1]) | (((uint32_t)value[2]) << 8) |
((uint32_t)value[1]) | (((uint32_t)value[3]) << 16) | (((uint32_t)value[4]) << 24);
(((uint32_t)value[2]) << 8) |
(((uint32_t)value[3]) << 16) |
(((uint32_t)value[4]) << 24);
DEBUG("USBPD PDO %08lX ", pdo); DEBUG("USBPD PDO %08lX ", pdo);
uint8_t kind = (uint8_t)((pdo >> 30) & 0b11); uint8_t kind = (uint8_t)((pdo >> 30) & 0b11);
if (kind == 0b00) { if (kind == 0b00) {
@ -73,7 +70,7 @@ static int16_t usbpd_current_limit(void) {
static void usbpd_dump(void) { static void usbpd_dump(void) {
/* Dump all registers for debugging */ /* 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 }; uint8_t value[65] = { 0 };
int16_t res = i2c_get(&I2C_USBPD, USBPD_ADDRESS, reg, value, sizeof(value)); int16_t res = i2c_get(&I2C_USBPD, USBPD_ADDRESS, reg, value, sizeof(value));
if (res < 0) { if (res < 0) {