Browse Source

fix(clang-format)

xmkb
Nick 4 years ago
parent
commit
f5909f9c26
  1. 15
      app/drivers/zephyr/battery_voltage_divider.c

15
app/drivers/zephyr/battery_voltage_divider.c

@ -30,8 +30,10 @@ struct battery_config {
static struct battery_config battery_config; static struct battery_config battery_config;
static int lithium_ion_mv_to_pct(int16_t bat_mv) { static int lithium_ion_mv_to_pct(int16_t bat_mv) {
// Magic function that maps mV to this discharge graph from adafruit: https://learn.adafruit.com/li-ion-and-lipoly-batteries/voltages // Magic function that maps mV to this discharge graph from adafruit:
return round(106.818 + (-0.032685 - 106.818) / pow(1 + pow(bat_mv/3679.35, 58.979), 0.347386)); // https://learn.adafruit.com/li-ion-and-lipoly-batteries/voltages
return round(106.818 +
(-0.032685 - 106.818) / pow(1 + pow(bat_mv / 3679.35, 58.979), 0.347386));
} }
static void battery_read(struct k_work *workd) { static void battery_read(struct k_work *workd) {
@ -56,10 +58,7 @@ static void battery_read(struct k_work *workd) {
K_WORK_DEFINE(battery_work, battery_read); K_WORK_DEFINE(battery_work, battery_read);
static void battery_handler(struct k_timer *timer) static void battery_handler(struct k_timer *timer) { k_work_submit(&battery_work); }
{
k_work_submit(&battery_work);
}
K_TIMER_DEFINE(battery_tick, battery_handler, NULL); K_TIMER_DEFINE(battery_tick, battery_handler, NULL);
@ -108,8 +107,6 @@ static int battery_setup(struct device *_arg) {
return 0; return 0;
} }
SYS_INIT(battery_setup, SYS_INIT(battery_setup, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
APPLICATION,
CONFIG_APPLICATION_INIT_PRIORITY);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
Loading…
Cancel
Save