Aruna
ADC.hpp
Go to the documentation of this file.
1 /*
2  * ADC.cpp
3  *
4  * Created on: 30 nov. 2020
5  * Author: noeel
6  */
7 
8 #ifndef ARUNA_ADC_H
9 #error Include ADC.h
10 #endif
11 
12 #ifndef ARUNA_ADC_IMP_H
13 #define ARUNA_ADC_IMP_H
14 
15 template<typename T>
17  return _read(raw);
18 }
19 
20 template<typename T>
22  int32_t raw;
23  aruna::err_t err;
24  err = read_raw(raw);
25  if ((bool) err)
26  return err;
27 
28  mV = raw_to_voltage(raw);
29  return aruna::err_t::OK;
30 }
31 
32 
33 #endif /* ARUNA_ADC_IMP_H */
err_t read_raw(T &raw)
Read raw value from ADC, convert to voltage yourself.
virtual int32_t raw_to_voltage(int32_t raw)
Convert raw data to voltage.
Definition: ADC.cpp:27
err_t read_voltage(T &mV)
Read voltage level of input.
virtual err_t _read(int32_t &raw)=0
Read analogue value and convert to 32bit signed resolution.