You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
440 B
22 lines
440 B
![]()
3 years ago
|
/*
|
||
|
* Copyright (c) 2021 The ZMK Contributors
|
||
|
*
|
||
|
* SPDX-License-Identifier: MIT
|
||
|
*/
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#include <drivers/sensor.h>
|
||
|
#include <stdint.h>
|
||
|
|
||
|
struct battery_value {
|
||
|
uint16_t adc_raw;
|
||
|
uint16_t millivolts;
|
||
|
uint8_t state_of_charge;
|
||
|
};
|
||
|
|
||
|
int battery_channel_get(const struct battery_value *value, enum sensor_channel chan,
|
||
|
struct sensor_value *val_out);
|
||
|
|
||
|
uint8_t lithium_ion_mv_to_pct(int16_t bat_mv);
|