Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
418ec8bb
Commit
418ec8bb
authored
Feb 13, 2015
by
Damien George
Browse files
stmhal: Properly deinit timer object.
Addresses issue #1113.
parent
192d536f
Changes
1
Hide whitespace changes
Inline
Side-by-side
stmhal/timer.c
View file @
418ec8bb
...
@@ -668,12 +668,7 @@ STATIC mp_obj_t pyb_timer_init(mp_uint_t n_args, const mp_obj_t *args, mp_map_t
...
@@ -668,12 +668,7 @@ STATIC mp_obj_t pyb_timer_init(mp_uint_t n_args, const mp_obj_t *args, mp_map_t
}
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_KW
(
pyb_timer_init_obj
,
1
,
pyb_timer_init
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_KW
(
pyb_timer_init_obj
,
1
,
pyb_timer_init
);
/// \method deinit()
// timer.deinit()
/// Deinitialises the timer.
///
/// Disables the callback (and the associated irq).
/// Disables any channel callbacks (and the associated irq).
/// Stops the timer, and disables the timer peripheral.
STATIC
mp_obj_t
pyb_timer_deinit
(
mp_obj_t
self_in
)
{
STATIC
mp_obj_t
pyb_timer_deinit
(
mp_obj_t
self_in
)
{
pyb_timer_obj_t
*
self
=
self_in
;
pyb_timer_obj_t
*
self
=
self_in
;
...
@@ -691,7 +686,9 @@ STATIC mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
...
@@ -691,7 +686,9 @@ STATIC mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
prev_chan
->
next
=
NULL
;
prev_chan
->
next
=
NULL
;
}
}
HAL_TIM_Base_DeInit
(
&
self
->
tim
);
self
->
tim
.
Instance
->
CCER
=
0x0000
;
// disable all capture/compare outputs
self
->
tim
.
Instance
->
CR1
=
0x0000
;
// disable the timer and reset its state
return
mp_const_none
;
return
mp_const_none
;
}
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
pyb_timer_deinit_obj
,
pyb_timer_deinit
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
pyb_timer_deinit_obj
,
pyb_timer_deinit
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment