Skip to content

Commit 4de8fa0

Browse files
committed
esp32s2: peripherals: store address of timer peripheral in its struct
.. this is helpful if we need to go down to the esp-idf low level I/O routines
1 parent 60c9a57 commit 4de8fa0

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

ports/esp32s2/peripherals/timer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ void peripherals_timer_init(const timer_config_t *config, timer_index_t *timer)
6868
}
6969
}
7070

71+
timer->hw = (timer->group == 0) ? &TIMERG0 : &TIMERG1;
72+
7173
// initialize timer module
7274
timer_init(timer->group, timer->idx, config);
7375
timer_set_counter_value(timer->group, timer->idx, 0);

ports/esp32s2/peripherals/timer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "driver/timer.h"
3131

3232
typedef struct {
33+
timg_dev_t *hw;
3334
timer_idx_t idx;
3435
timer_group_t group;
3536
} timer_index_t;

0 commit comments

Comments
 (0)