bat_voltage.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 TU Dresden
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
21 #include <stdint.h>
22 
23 #include "periph/adc.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
32 typedef struct {
33  const char *name;
34  int8_t phydat_scale;
44  int16_t (*convert)(int32_t adc_sample);
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 
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:71
adc_res_t
Possible ADC resolution settings.
Definition: adc.h:92
SAUL battery voltage configuration values.
Definition: bat_voltage.h:32
const char * name
name of the device connected to this pin
Definition: bat_voltage.h:33
adc_res_t res
ADC resolution.
Definition: bat_voltage.h:36
int8_t phydat_scale
Phydat scale of the resulting voltage.
Definition: bat_voltage.h:34
adc_t line
ADC line to initialize and expose.
Definition: bat_voltage.h:35