board/nocturne/base_detect.c: Format with clang-format
BRANCH=none
TEST=none
*/
#define WINDOW_SIZE 5
-
enum base_detect_state {
BASE_DETACHED = 0,
BASE_ATTACHED_DEBOUNCE,
@@ -141,8 +140,7 @@ static void base_detect_changed(void)
static int base_seems_attached(int attach_pin_mv, int detach_pin_mv)
{
/* We can't tell if we don't have good readings. */
- if (attach_pin_mv == ADC_READ_ERROR ||
- detach_pin_mv == ADC_READ_ERROR)
+ if (attach_pin_mv == ADC_READ_ERROR || detach_pin_mv == ADC_READ_ERROR)
return 0;
if (gpio_get_level(GPIO_BASE_PWR_EN))
@@ -157,8 +155,7 @@ static int base_seems_attached(int attach_pin_mv, int detach_pin_mv)
static int base_seems_detached(int attach_pin_mv, int detach_pin_mv)
{
/* We can't tell if we don't have good readings. */
- if (attach_pin_mv == ADC_READ_ERROR ||
- detach_pin_mv == ADC_READ_ERROR)
+ if (attach_pin_mv == ADC_READ_ERROR || detach_pin_mv == ADC_READ_ERROR)
return 0;
return (attach_pin_mv >= PWREN_ATTACH_MIN_MV) &&
@@ -194,9 +191,9 @@ static void base_detect_deferred(void)
if (forced_state != BASE_NO_FORCED_STATE) {
if (state != forced_state) {
- CPRINTS("BD forced %s",
- forced_state == BASE_ATTACHED ?
- "attached" : "detached");
+ CPRINTS("BD forced %s", forced_state == BASE_ATTACHED ?
+ "attached" :
+ "detached");
set_state(forced_state);
base_detect_changed();
}
@@ -212,8 +209,7 @@ static void base_detect_deferred(void)
if (debug) {
int i;
- CPRINTS("BD st%d: att: %dmV det: %dmV", state,
- attach_reading,
+ CPRINTS("BD st%d: att: %dmV det: %dmV", state, attach_reading,
detach_reading);
CPRINTF("det readings = [");
for (i = 0; i < WINDOW_SIZE; i++)
@@ -341,7 +337,6 @@ static void check_and_reapply_base_power_deferred(void)
hook_call_deferred(&clear_base_power_on_attempts_deferred_data,
SECOND);
}
-
}
DECLARE_DEFERRED(check_and_reapply_base_power_deferred);
@@ -371,15 +366,14 @@ static int command_basedetectdebug(int argc, char **argv)
if ((argc > 1) && !parse_bool(argv[1], &debug))
return EC_ERROR_PARAM1;
- CPRINTS("BD: %sst%d", forced_state != BASE_NO_FORCED_STATE ?
- "forced " : "", state);
+ CPRINTS("BD: %sst%d",
+ forced_state != BASE_NO_FORCED_STATE ? "forced " : "", state);
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(basedebug, command_basedetectdebug, "[ena|dis]",
"En/Disable base detection debug");
-
void base_force_state(enum ec_set_base_state_cmd state)
{
if (state == EC_SET_BASE_STATE_ATTACH)
