Loading...
Searching...
No Matches
bat_voltage_params.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 TU Dresden
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include "saul/bat_voltage.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
32
37{
38 {
39 .name = "BAT",
40 .phydat_scale = -3,
41 .line = ADC_LINE(5),
42 .res = ADC_RES_10BIT,
43 .convert = saul_bat_voltage_convert,
44 },
45};
46
47#ifdef __cplusplus
48}
49#endif
50
static const saul_bat_voltage_params_t saul_bat_voltage_params[]
Battery voltage configuration.
int16_t saul_bat_voltage_convert(int32_t adc_sample)
Conversion function to convert ADC sample to battery voltage.
Parameter definitions for mapping battery voltage to SAUL.
int32_t adc_sample(adc_t line, adc_res_t res)
Sample a value from the given ADC line.
#define ADC_LINE(x)
Default ADC line access macro.
Definition adc.h:85
@ ADC_RES_10BIT
ADC resolution: 10 bit.
Definition adc.h:95
SAUL battery voltage configuration values.
Definition bat_voltage.h:32