1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-24 13:21:23 +01:00

Merge branch 'PORTX_HAL' of https://github.com/DCC-EX/CommandStation-EX into PORTX_HAL

This commit is contained in:
Harald Barth 2022-08-17 09:20:18 +02:00
commit 86538a4902

View File

@ -37,22 +37,25 @@ HardwareSerial Serial1(PA10, PA15); // Rx=PA10, Tx=PA15
INTERRUPT_CALLBACK interruptHandler=0; INTERRUPT_CALLBACK interruptHandler=0;
// Let's use STM32's timer #1 until disabused of this notion // Let's use STM32's timer #1 until disabused of this notion
HardwareTimer timer(TIM1); HardwareTimer timer(TIM11);
// Timer IRQ handler // Timer IRQ handler
void Timer1_Handler() { void Timer11_Handler() {
interruptHandler(); interruptHandler();
} }
void DCCTimer::begin(INTERRUPT_CALLBACK callback) { void DCCTimer::begin(INTERRUPT_CALLBACK callback) {
interruptHandler=callback; interruptHandler=callback;
noInterrupts(); noInterrupts();
// adc_set_sample_rate(ADC_SAMPLETIME_480CYCLES);
timer.pause(); timer.pause();
timer.setPrescaleFactor(1); timer.setPrescaleFactor(1);
// timer.setOverflow(CLOCK_CYCLES * 2); // timer.setOverflow(CLOCK_CYCLES * 2);
timer.setOverflow(DCC_SIGNAL_TIME, MICROSEC_FORMAT); timer.setOverflow(DCC_SIGNAL_TIME, MICROSEC_FORMAT);
timer.attachInterrupt(Timer1_Handler); timer.attachInterrupt(Timer11_Handler);
timer.refresh(); timer.refresh();
timer.resume(); timer.resume();