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 
9 #pragma once
10 
23 #include <stdint.h>
24 
25 #include "periph/adc.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
44 int32_t adc_util_map(int sample, adc_res_t res, int32_t min, int32_t max);
45 
59 float adc_util_mapf(int sample, adc_res_t res, float min, float max);
60 
73 uint16_t dac_util_map(int value, int min, int max);
74 
86 uint16_t dac_util_mapf(float value, float min, float max);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
Low-level ADC peripheral driver interface definitions.
adc_res_t
Possible ADC resolution settings.
Definition: adc.h:92
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.
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 arithmetic)
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.
int32_t adc_util_map(int sample, adc_res_t res, int32_t min, int32_t max)
Map a sampled ADC value to a given range.