mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-02-27 02:56:04 +01:00
DC mode timer sync STM32
This commit is contained in:
parent
5d1b3a7a03
commit
da66469faa
@ -37,11 +37,15 @@
|
|||||||
#include "DIAG.h"
|
#include "DIAG.h"
|
||||||
#include <wiring_private.h>
|
#include <wiring_private.h>
|
||||||
|
|
||||||
|
// DC mode timers enable the PWM signal on select pins.
|
||||||
|
// Code added to sync timers which have the same frequency.
|
||||||
// Function prototypes
|
// Function prototypes
|
||||||
void refreshDCmodeTimers();
|
void refreshDCmodeTimers();
|
||||||
void resetCounterDCmodeTimers();
|
void resetCounterDCmodeTimers();
|
||||||
|
|
||||||
HardwareTimer *Timer1 = new HardwareTimer(TIM1);
|
HardwareTimer *Timer1 = new HardwareTimer(TIM1);
|
||||||
|
HardwareTimer *Timer2 = new HardwareTimer(TIM2);
|
||||||
|
HardwareTimer *Timer3 = new HardwareTimer(TIM3);
|
||||||
HardwareTimer *Timer4 = new HardwareTimer(TIM4);
|
HardwareTimer *Timer4 = new HardwareTimer(TIM4);
|
||||||
HardwareTimer *Timer9 = new HardwareTimer(TIM9);
|
HardwareTimer *Timer9 = new HardwareTimer(TIM9);
|
||||||
#if defined(TIM13)
|
#if defined(TIM13)
|
||||||
@ -685,6 +689,8 @@ void ADCee::begin() {
|
|||||||
// not exact sync, but timers with the same frequency should be in sync
|
// not exact sync, but timers with the same frequency should be in sync
|
||||||
void refreshDCmodeTimers() {
|
void refreshDCmodeTimers() {
|
||||||
Timer1->refresh();
|
Timer1->refresh();
|
||||||
|
Timer2->refresh();
|
||||||
|
Timer3->refresh();
|
||||||
Timer4->refresh();
|
Timer4->refresh();
|
||||||
Timer9->refresh();
|
Timer9->refresh();
|
||||||
#if defined(TIM13)
|
#if defined(TIM13)
|
||||||
@ -696,6 +702,8 @@ void refreshDCmodeTimers() {
|
|||||||
void resetCounterDCmodeTimers() {
|
void resetCounterDCmodeTimers() {
|
||||||
// Reset the counter for all DC mode timers
|
// Reset the counter for all DC mode timers
|
||||||
TIM1->CNT = 0;
|
TIM1->CNT = 0;
|
||||||
|
TIM2->CNT = 0;
|
||||||
|
TIM3->CNT = 0;
|
||||||
TIM4->CNT = 0;
|
TIM4->CNT = 0;
|
||||||
TIM9->CNT = 0;
|
TIM9->CNT = 0;
|
||||||
#if defined(TIM13)
|
#if defined(TIM13)
|
||||||
|
Loading…
Reference in New Issue
Block a user