Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
bcb3ab45
Commit
bcb3ab45
authored
Jun 17, 2014
by
Damien George
Browse files
stmhal: Toggle LED using ODR ^= pin_mask.
parent
25479281
Changes
1
Hide whitespace changes
Inline
Side-by-side
stmhal/led.c
View file @
bcb3ab45
...
...
@@ -148,18 +148,9 @@ void led_toggle(pyb_led_t led) {
}
#endif
// toggle the output data register to toggle the LED state
const
pin_obj_t
*
led_pin
=
pyb_led_obj
[
led
-
1
].
led_pin
;
GPIO_TypeDef
*
gpio
=
led_pin
->
gpio
;
// We don't know if we're turning the LED on or off, but we don't really
// care. Just invert the state.
if
(
gpio
->
ODR
&
led_pin
->
pin_mask
)
{
// pin is high, make it low
gpio
->
BSRRH
=
led_pin
->
pin_mask
;
}
else
{
// pin is low, make it high
gpio
->
BSRRL
=
led_pin
->
pin_mask
;
}
led_pin
->
gpio
->
ODR
^=
led_pin
->
pin_mask
;
}
int
led_get_intensity
(
pyb_led_t
led
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment