mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 08:36:14 +01:00
sorta works, but no adc yet
This commit is contained in:
parent
dff7eb37ab
commit
bbca4379d2
|
@ -33,6 +33,8 @@
|
||||||
#include "DCCTimer.h"
|
#include "DCCTimer.h"
|
||||||
#include "DIAG.h"
|
#include "DIAG.h"
|
||||||
#include "Portenta_H7_TimerInterrupt.h"
|
#include "Portenta_H7_TimerInterrupt.h"
|
||||||
|
#include "pins_arduino.h"
|
||||||
|
#include "pinDefinitions.h"
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Experimental code for High Accuracy (HA) DCC Signal mode
|
// Experimental code for High Accuracy (HA) DCC Signal mode
|
||||||
// Warning - use of TIM2 and TIM3 can affect the use of analogWrite() function on certain pins,
|
// Warning - use of TIM2 and TIM3 can affect the use of analogWrite() function on certain pins,
|
||||||
|
@ -173,13 +175,18 @@ int ADCee::init(uint8_t pin) {
|
||||||
* Read function ADCee::read(pin) to get value instead of analogRead(pin)
|
* Read function ADCee::read(pin) to get value instead of analogRead(pin)
|
||||||
*/
|
*/
|
||||||
int ADCee::read(uint8_t pin, bool fromISR) {
|
int ADCee::read(uint8_t pin, bool fromISR) {
|
||||||
int current;
|
//int current;
|
||||||
//DIAG(F("ADCee Read:%d"),fromISR);
|
//DIAG(F("ADCee Read:%d"),fromISR);
|
||||||
//if (!fromISR) noInterrupts();
|
//if (!fromISR) noInterrupts();
|
||||||
current = analogRead(pin);
|
//current = analogRead(pin);
|
||||||
//if (!fromISR) interrupts();
|
//if (!fromISR) interrupts();
|
||||||
|
PinName name = analogPinToPinName(pin);
|
||||||
return current;
|
mbed::AnalogIn* adc = analogPinToAdcObj(pin);
|
||||||
|
if (adc == NULL) {
|
||||||
|
adc = new mbed::AnalogIn(name);
|
||||||
|
analogPinToAdcObj(pin) = adc;
|
||||||
|
}
|
||||||
|
return (adc->read_u16() >> (16 - 12));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
//#endif
|
//#endif
|
||||||
#define SDA I2C_SDA
|
#define SDA I2C_SDA
|
||||||
#define SCL I2C_SCL
|
#define SCL I2C_SCL
|
||||||
|
#define DCC_EX_TIMER
|
||||||
// these don't work...
|
// these don't work...
|
||||||
//extern const uint16_t PROGMEM port_to_input_PGM[];
|
//extern const uint16_t PROGMEM port_to_input_PGM[];
|
||||||
//extern const uint16_t PROGMEM port_to_output_PGM[];
|
//extern const uint16_t PROGMEM port_to_output_PGM[];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user