diff options
author | Damien George <damien.p.george@gmail.com> | 2015-07-21 23:37:45 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-07-21 23:39:49 +0100 |
commit | abc24c187614e358faa10ed6a3e239151f70b9f8 (patch) | |
tree | ed64fc0a71077f8d6de04c4eee4544aaa57c1699 /stmhal/timer.c | |
parent | 6f5e0fe9555c935fa0bca81f56d0bfa2993636a2 (diff) | |
download | micropython-abc24c187614e358faa10ed6a3e239151f70b9f8.tar.gz micropython-abc24c187614e358faa10ed6a3e239151f70b9f8.zip |
stmhal: Allow DAC.write_timed to take Timer object in place of freq.
This allows the DAC to use a user-specified Timer for the triggering
(instead of the default Timer(6)), while still supporting original
behaviour.
Addresses issues #1129 and #1388.
Diffstat (limited to 'stmhal/timer.c')
-rw-r--r-- | stmhal/timer.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/stmhal/timer.c b/stmhal/timer.c index 68f295b748..3519c3c150 100644 --- a/stmhal/timer.c +++ b/stmhal/timer.c @@ -470,6 +470,11 @@ STATIC void config_deadtime(pyb_timer_obj_t *self, mp_int_t ticks) { HAL_TIMEx_ConfigBreakDeadTime(&self->tim, &deadTimeConfig); } +TIM_HandleTypeDef *pyb_timer_get_handle(mp_obj_t timer) { + pyb_timer_obj_t *self = timer; + return &self->tim; +} + STATIC void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { pyb_timer_obj_t *self = self_in; |