From 888165e98702c526f43692ce8eb4ad420f3d04c9 Mon Sep 17 00:00:00 2001 From: pmantoine Date: Mon, 24 Oct 2022 08:33:08 +0800 Subject: [PATCH] Skeletal ADCee class for STM32 --- DCCTimerSTM32.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/DCCTimerSTM32.cpp b/DCCTimerSTM32.cpp index 2cacaff..cab3bc7 100644 --- a/DCCTimerSTM32.cpp +++ b/DCCTimerSTM32.cpp @@ -1,5 +1,5 @@ /* - * © 2022 Paul M Antoine + * © 2022 Paul M. Antoine * © 2021 Mike S * © 2021 Harald Barth * © 2021 Fred Decker @@ -127,4 +127,31 @@ void DCCTimer::reset() { while(true) {}; } +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 \ No newline at end of file