nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches
battery_def.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7/* This configuration file is included only once from battery level measuring
8 * module and holds information about battery characteristic.
9 */
10
11#include <helpers/nrfx_analog_common.h>
12#include <zephyr/drivers/adc.h>
13
14/* This structure enforces the header file is included only once in the build.
15 * Violating this requirement triggers a multiple definition error at link time.
16 */
18
19#define BATTERY_MEAS_ADC_INPUT NRFX_ANALOG_EXTERNAL_AIN2
20#define BATTERY_MEAS_ADC_GAIN ADC_GAIN_1_4
21#define BATTERY_MEAS_VOLTAGE_GAIN 4
22
23/* Converting measured battery voltage[mV] to State of Charge[%].
24 * First element corresponds to CONFIG_DESKTOP_BATTERY_MIN_LEVEL.
25 * Each element is CONFIG_DESKTOP_VOLTAGE_TO_SOC_DELTA higher than previous.
26 * Defined separately for every configuration.
27 */
28static const uint8_t battery_voltage_to_soc[] = {
29 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
30 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 9, 9, 10,
3111, 13, 14, 15, 16, 18, 19, 21, 23, 24, 26, 28, 31, 33, 35, 37, 40, 42, 45, 47,
3250, 52, 54, 57, 59, 62, 64, 66, 68, 71, 73, 75, 76, 78, 80, 81, 83, 84, 85, 86,
3388, 89, 90, 90, 91, 92, 93, 93, 94, 94, 95, 95, 96, 96, 96, 97, 97, 97, 97, 98,
3498, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100,
35100
36};
static const uint8_t battery_voltage_to_soc[]
Definition battery_def.h:28
const struct @46 battery_def_include_once