37 lines
539 B
C++
37 lines
539 B
C++
#ifndef ANALOG_IN_H_
|
|
#define ANALOG_IN_H_
|
|
|
|
/**** Includes ****/
|
|
#include <stdint.h>
|
|
|
|
namespace bsp {
|
|
|
|
/**** Public definitions ****/
|
|
static const uint8_t DEF_AIN_MUL = 215;
|
|
static const uint8_t DEF_AIN_DIV = 44;
|
|
static const int16_t DEF_AIN_OFFSET = 0;
|
|
|
|
class AnalogIn
|
|
{
|
|
protected:
|
|
uint8_t adc_ch;
|
|
|
|
public:
|
|
AnalogIn(uint8_t adc_ch);
|
|
|
|
uint8_t mul;
|
|
uint8_t div;
|
|
int16_t offset;
|
|
uint16_t last_read;
|
|
|
|
uint16_t read(void);
|
|
};
|
|
|
|
/**** Public function declarations ****/
|
|
|
|
#ifdef TESTING
|
|
#endif
|
|
|
|
} //namespace
|
|
|
|
#endif /* ANALOG_IN_H_ */ |