Skip to content

Commit 83b3e60

Browse files
committed
UNO R4 - Use GPT timers
1 parent 3c7b18a commit 83b3e60

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/AudioPWM/PWMAudioRenesas.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class PWMDriverRenesas : public DriverPWMBase {
6666

6767
/// when we get the first write -> we activate the timer to start with the output of data
6868
virtual void startTimer() override {
69+
TRACED();
6970
if (!is_timer_started){
7071
TRACED();
7172
ticker.setCallbackParameter(this);

src/AudioTimer/AudioTimerRenesas.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class TimerAlarmRepeatingDriverRenesas : public TimerAlarmRepeatingDriverBase {
7878
protected:
7979
FspTimer audio_timer;
8080
my_repeating_timer_callback_t instanceCallback = nullptr;
81-
uint8_t timer_type = 1; // Should be 0 - but this is currently not working
81+
uint8_t timer_type = 0; // Should be 0 - but this is currently not working
8282

8383
// starts Asynchronous General Purpose Timer (AGT) timer
8484
bool startAGTTimer(float rate){
@@ -102,23 +102,23 @@ class TimerAlarmRepeatingDriverRenesas : public TimerAlarmRepeatingDriverBase {
102102
if (tindex==0){
103103
LOGE("Using pwm reserved timer");
104104
FspTimer::force_use_of_pwm_reserved_timer();
105-
int8_t tindex = FspTimer::get_available_timer(timer_type);
105+
tindex = FspTimer::get_available_timer(timer_type);
106106
}
107107
if (tindex==0){
108108
LOGE("no timer");
109109
return false;
110110
}
111111
LOGI("timer idx: %d", tindex);
112-
if(!audio_timer.begin(TIMER_MODE_PERIODIC, timer_type, tindex, rate, 0.0f, staticCallback)){
112+
if(!audio_timer.begin(TIMER_MODE_PERIODIC, timer_type, tindex, rate, 0.0f, staticCallback, this)){
113113
LOGE("error:begin");
114114
return false;
115115
}
116116

117-
TimerIrqCfg_t cfg;
118-
cfg.base_cfg = audio_timer.get_cfg();
119-
if (!IRQManager::getInstance().addTimerOverflow(cfg)){
120-
LOGE("error:addTimerOverflow");
117+
if (!audio_timer.setup_overflow_irq()){
118+
LOGE("error:setup_overflow_irq");
119+
return false;
121120
}
121+
122122
if (!audio_timer.open()){
123123
LOGE("error:open");
124124
return false;

0 commit comments

Comments
 (0)