From 863c839563931f6e95e9170486264206279dffd3 Mon Sep 17 00:00:00 2001 From: pmantoine Date: Wed, 2 Nov 2022 13:46:16 +0800 Subject: [PATCH] Add Teensy ADCee class skeleton. --- DCCTimerTEENSY.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/DCCTimerTEENSY.cpp b/DCCTimerTEENSY.cpp index a8f97f1..0619e21 100644 --- a/DCCTimerTEENSY.cpp +++ b/DCCTimerTEENSY.cpp @@ -141,4 +141,31 @@ void DCCTimer::reset() { SCB_AIRCR = 0x05FA0004; } +int16_t ADCee::ADCmax() { + return 4095; +} + +int ADCee::init(uint8_t pin) { + return analogRead(pin); +} +/* + * Read function ADCee::read(pin) to get value instead of analogRead(pin) + */ +int ADCee::read(uint8_t pin, bool fromISR) { + int current; + if (!fromISR) noInterrupts(); + current = analogRead(pin); + if (!fromISR) interrupts(); + return current; +} +/* + * Scan function that is called from interrupt + */ +void ADCee::scan() { +} + +void ADCee::begin() { + noInterrupts(); + interrupts(); +} #endif