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
This commit is contained in:
Jeff Epler 2021-05-13 11:13:52 -05:00
parent 60c9a57815
commit 4de8fa09ab
2 changed files with 3 additions and 0 deletions

View File

@ -68,6 +68,8 @@ void peripherals_timer_init(const timer_config_t *config, timer_index_t *timer)
}
}
timer->hw = (timer->group == 0) ? &TIMERG0 : &TIMERG1;
// initialize timer module
timer_init(timer->group, timer->idx, config);
timer_set_counter_value(timer->group, timer->idx, 0);

View File

@ -30,6 +30,7 @@
#include "driver/timer.h"
typedef struct {
timg_dev_t *hw;
timer_idx_t idx;
timer_group_t group;
} timer_index_t;