analog_util.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Freie Universit├Ąt Berlin
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 
21 #ifndef ANALOG_UTIL_H
22 #define ANALOG_UTIL_H
23 
24 #include "periph/adc.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
45 int adc_util_map(int sample, adc_res_t res, int min, int max);
46 
60 float adc_util_mapf(int sample, adc_res_t res, float min, float max);
61 
74 uint16_t dac_util_map(int value, int min, int max);
75 
87 uint16_t dac_util_mapf(float value, float min, float max);
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif /* ANALOG_UTIL_H */
94 
uint16_t dac_util_mapf(float value, float min, float max)
Helper function to map a given float value range to a valid DAC value.
Low-level ADC peripheral driver interface definitions.
float adc_util_mapf(int sample, adc_res_t res, float min, float max)
Map a sampled ADC value to a given range (using floating point arithmetics)
int adc_util_map(int sample, adc_res_t res, int min, int max)
Map a sampled ADC value to a given range.
uint16_t dac_util_map(int value, int min, int max)
Map a value out of the given range to a 16-bit unsigned int.