forked from libopencm3/libopencm3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update example to use timers as well.
This example now exercises timers, EXTI, gpio, irqs as well as demonstrating printf. It only needs a serial cable in addition to the 32L discovery board
- Loading branch information
Showing
3 changed files
with
163 additions
and
79 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
examples/stm32/l1/stm32l-discovery/button-irq-printf/README
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,32 @@ | |||
* Prints to the screen when the button is pushed/released (irq driven) | * Prints to the screen when the button is pushed/released (irq driven) | ||
115200@8n1 console on PA2 (tx only) | 115200@8n1 console on PA2 (tx only) | ||
* uses basic timer 6 with overflows to generate a 1ms counter (not an ideal | |||
use, but shows some api methods and can be demoed on the disco board) | |||
* uses basic timer 7 with the exti interrupts to do ghetto input capture. | |||
Not as fast or precise as the real input capture modes, but can be used | |||
on any gpio pin. | |||
|
|||
example output: | |||
|
|||
hi guys! | |||
TICK 0 | |||
TICK 1 | |||
TICK 2 | |||
Pushed down! | |||
held: 443 ms | |||
Pushed down! | |||
TICK 3 | |||
held: 217 ms | |||
Pushed down! | |||
held: 99 ms | |||
Pushed down! | |||
TICK 4 | |||
held: 73 ms | |||
Pushed down! | |||
held: 60 ms | |||
TICK 5 | |||
Pushed down! | |||
held: 98 ms | |||
Pushed down! | |||
|
|||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters