/* * Copyright (c) 2021 The ZMK Contributors * * SPDX-License-Identifier: MIT */ #include #include #include "battery_common.h" int battery_channel_get(const struct battery_value *value, enum sensor_channel chan, struct sensor_value *val_out) { switch (chan) { case SENSOR_CHAN_VOLTAGE: val_out->val1 = value->millivolts / 1000; val_out->val2 = (value->millivolts % 1000) * 1000U; break; default: return -ENOTSUP; } return 0; }