Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
5f67b03e
Commit
5f67b03e
authored
Nov 28, 2018
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stm32/servo: Only initialise TIM5 if it is needed, to save power.
parent
4f25a8b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
ports/stm32/servo.c
ports/stm32/servo.c
+4
-2
No files found.
ports/stm32/servo.c
View file @
5f67b03e
...
...
@@ -63,8 +63,6 @@ typedef struct _pyb_servo_obj_t {
STATIC
pyb_servo_obj_t
pyb_servo_obj
[
PYB_SERVO_NUM
];
void
servo_init
(
void
)
{
timer_tim5_init
();
// reset servo objects
for
(
int
i
=
0
;
i
<
PYB_SERVO_NUM
;
i
++
)
{
pyb_servo_obj
[
i
].
base
.
type
=
&
pyb_servo_type
;
...
...
@@ -133,6 +131,10 @@ STATIC void servo_init_channel(pyb_servo_obj_t *s) {
// GPIO configuration
mp_hal_pin_config
(
s
->
pin
,
MP_HAL_PIN_MODE_ALT
,
MP_HAL_PIN_PULL_NONE
,
GPIO_AF2_TIM5
);
if
(
__HAL_RCC_TIM5_IS_CLK_DISABLED
())
{
timer_tim5_init
();
}
// PWM mode configuration
TIM_OC_InitTypeDef
oc_init
;
oc_init
.
OCMode
=
TIM_OCMODE_PWM1
;
...
...
Write
Preview
Markdown
is supported
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