Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
5e6419cb
Commit
5e6419cb
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Plain Diff
Merge branch 'dhylands-add-timer-deinit'
parents
9cd96cf2
e70b5dbe
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
stmhal/main.c
+1
-0
1 addition, 0 deletions
stmhal/main.c
stmhal/timer.c
+21
-3
21 additions, 3 deletions
stmhal/timer.c
stmhal/timer.h
+2
-0
2 additions, 0 deletions
stmhal/timer.h
with
24 additions
and
3 deletions
stmhal/main.c
+
1
−
0
View file @
5e6419cb
...
@@ -549,6 +549,7 @@ soft_reset:
...
@@ -549,6 +549,7 @@ soft_reset:
storage_flush
();
storage_flush
();
printf
(
"PYB: soft reboot
\n
"
);
printf
(
"PYB: soft reboot
\n
"
);
timer_deinit
();
first_soft_reset
=
false
;
first_soft_reset
=
false
;
goto
soft_reset
;
goto
soft_reset
;
...
...
This diff is collapsed.
Click to expand it.
stmhal/timer.c
+
21
−
3
View file @
5e6419cb
...
@@ -107,6 +107,9 @@ static uint32_t tim3_counter = 0;
...
@@ -107,6 +107,9 @@ static uint32_t tim3_counter = 0;
STATIC
pyb_timer_obj_t
*
pyb_timer_obj_all
[
14
];
STATIC
pyb_timer_obj_t
*
pyb_timer_obj_all
[
14
];
#define PYB_TIMER_OBJ_ALL_NUM MP_ARRAY_SIZE(pyb_timer_obj_all)
#define PYB_TIMER_OBJ_ALL_NUM MP_ARRAY_SIZE(pyb_timer_obj_all)
STATIC
mp_obj_t
pyb_timer_deinit
(
mp_obj_t
self_in
);
STATIC
mp_obj_t
pyb_timer_callback
(
mp_obj_t
self_in
,
mp_obj_t
callback
);
void
timer_init0
(
void
)
{
void
timer_init0
(
void
)
{
tim3_counter
=
0
;
tim3_counter
=
0
;
for
(
uint
i
=
0
;
i
<
PYB_TIMER_OBJ_ALL_NUM
;
i
++
)
{
for
(
uint
i
=
0
;
i
<
PYB_TIMER_OBJ_ALL_NUM
;
i
++
)
{
...
@@ -114,6 +117,16 @@ void timer_init0(void) {
...
@@ -114,6 +117,16 @@ void timer_init0(void) {
}
}
}
}
// unregister all interrupt sources
void
timer_deinit
(
void
)
{
for
(
uint
i
=
0
;
i
<
PYB_TIMER_OBJ_ALL_NUM
;
i
++
)
{
pyb_timer_obj_t
*
tim
=
pyb_timer_obj_all
[
i
];
if
(
tim
!=
NULL
)
{
pyb_timer_deinit
(
tim
);
}
}
}
// TIM3 is set-up for the USB CDC interface
// TIM3 is set-up for the USB CDC interface
void
timer_tim3_init
(
void
)
{
void
timer_tim3_init
(
void
)
{
// set up the timer for USBD CDC
// set up the timer for USBD CDC
...
@@ -369,10 +382,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_init_obj, 1, pyb_timer_init);
...
@@ -369,10 +382,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_init_obj, 1, pyb_timer_init);
/// \method deinit()
/// \method deinit()
/// Deinitialises the timer.
/// Deinitialises the timer.
///
///
/// *This function is not yet implemented.*
/// Disables the callback (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
;
// TODO implement me
// Disable the interrupt
pyb_timer_callback
(
self_in
,
mp_const_none
);
HAL_TIM_Base_DeInit
(
&
self
->
tim
);
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
);
...
...
This diff is collapsed.
Click to expand it.
stmhal/timer.h
+
2
−
0
View file @
5e6419cb
...
@@ -40,4 +40,6 @@ void timer_tim3_init(void);
...
@@ -40,4 +40,6 @@ void timer_tim3_init(void);
void
timer_tim5_init
(
void
);
void
timer_tim5_init
(
void
);
void
timer_tim6_init
(
uint
freq
);
void
timer_tim6_init
(
uint
freq
);
void
timer_deinit
(
void
);
void
timer_irq_handler
(
uint
tim_id
);
void
timer_irq_handler
(
uint
tim_id
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment