Arduino Helpers master
Utility library for Arduino
ADCConfig.hpp
Go to the documentation of this file.
1#pragma once
2
16#include <AH/Arduino-Wrapper.h>
17
18#if defined(ADC_RESOLUTION)
19#define HAS_ANALOG_READ_RESOLUTION 1
20
21// Teensy
22//------------------------------------------------------------------------------
23#elif defined(TEENSYDUINO) && !defined(DOXYGEN)
24
25#if defined(__AVR__) // Teensy 2.x
26#define ADC_RESOLUTION 10
27#define HAS_ANALOG_READ_RESOLUTION 0
28
29#elif defined(__MK20DX128__) // Teensy 3.0
30#define ADC_RESOLUTION 13
31#define HAS_ANALOG_READ_RESOLUTION 1
32
33#elif defined(__MK20DX256__) // Teensy 3.1/3.2
34#define ADC_RESOLUTION 13
35#define HAS_ANALOG_READ_RESOLUTION 1
36
37#elif defined(__MKL26Z64__) // Teensy LC
38#define ADC_RESOLUTION 12
39#define HAS_ANALOG_READ_RESOLUTION 1
40
41#elif defined(__MK64FX512__) // Teensy 3.5
42#define ADC_RESOLUTION 13
43#define HAS_ANALOG_READ_RESOLUTION 1
44
45#elif defined(__MK66FX1M0__) // Teensy 3.6
46#define ADC_RESOLUTION 13
47#define HAS_ANALOG_READ_RESOLUTION 1
48
49#elif defined(__IMXRT1062__) || defined(__IMXRT1052__) // Teensy 4.0
50#define ADC_RESOLUTION 12
51#define HAS_ANALOG_READ_RESOLUTION 1
52
53#else
54#warning "Unknown Teensy board, please open an issue on GitHub" \
55 "https://github.com/tttapa/Arduino-Helpers"
56#endif
57
58// ESP32
59//------------------------------------------------------------------------------
60#elif defined(ESP32)
61
62#define ADC_RESOLUTION 12
63#define HAS_ANALOG_READ_RESOLUTION 1
64
65// Unit test on PC
66// -----------------------------------------------------------------------------
67#elif !defined(ARDUINO)
68
69#define ADC_RESOLUTION 10
70#define HAS_ANALOG_READ_RESOLUTION 1
71
72// Unknown/Default
73//------------------------------------------------------------------------------
74#else
76#define ADC_RESOLUTION 10
78#define HAS_ANALOG_READ_RESOLUTION 0
79
80#endif