YAHAL
Yet Another Hardware Abstraction Library
Loading...
Searching...
No Matches
adc_esp8266.h
1// ---------------------------------------------
2// This file is part of
3// _ _ __ _ _ __ __
4// ( \/ ) /__\ ( )_( ) /__\ ( )
5// \ / /(__)\ ) _ ( /(__)\ )(__
6// (__)(__)(__)(_) (_)(__)(__)(____)
7//
8// Yet Another HW Abstraction Library
9// Copyright (C) Andreas Terstegge
10// BSD Licensed (see file LICENSE)
11//
12// ---------------------------------------------
13//
14// ADC implementation for ESP8266.
15//
16#ifndef _ADC_ESP8266_H_
17#define _ADC_ESP8266_H_
18
19#include "adc_interface.h"
20
21namespace ADC {
22 // additional ADC modes
23 const uint16_t FAST = 0x1000;
24}
25
26class adc_esp8266 : public adc_interface {
27public:
28 static adc_esp8266 inst;
29 ~adc_esp8266() override;
30
31 void adcMode (uint8_t channel, uint16_t mode) override;
32 adc_mode_t getMode (uint8_t channel) override;
33 uint16_t adcReadRaw (uint8_t channel) override;
34 float adcReadVoltage(uint8_t channel) override;
35 float rawToVoltage (uint8_t channel, uint16_t raw) override;
36
37private:
39
40 uint16_t _mode;
41};
42
43#endif // _ADC_ESP8266_H_