Loading...
Searching...
No Matches
bat_voltage.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 <stdint.h>
19
20#include "periph/adc.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
29typedef struct {
30 const char *name;
31 int8_t phydat_scale;
41 int16_t (*convert)(int32_t adc_sample);
43
44#ifdef __cplusplus
45}
46#endif
47
Low-level ADC peripheral driver interface definitions.
int32_t adc_sample(adc_t line, adc_res_t res)
Sample a value from the given ADC line.
uint_fast8_t adc_t
Define default ADC type identifier.
Definition adc.h:68
adc_res_t
Possible ADC resolution settings.
Definition adc.h:89
SAUL battery voltage configuration values.
Definition bat_voltage.h:29
const char * name
name of the device connected to this pin
Definition bat_voltage.h:30
adc_res_t res
ADC resolution.
Definition bat_voltage.h:33
int8_t phydat_scale
Phydat scale of the resulting voltage.
Definition bat_voltage.h:31
int16_t(* convert)(int32_t adc_sample)
Conversion function to convert raw ADC data to voltage.
Definition bat_voltage.h:41
adc_t line
ADC line to initialize and expose.
Definition bat_voltage.h:32