simple tests for STM32F100R6 microcontroller with dedicated library
Dependencies: mbed-STM32F100R6
To compile a program with this library, use NUCLEO-F103RB as the target name. !
Change only one "#if" to "#if 1" to select the desired test. Others "#if" must be "#if 0".
main.cpp@0:5057d688da32, 2016-01-01 (annotated)
- Committer:
- mega64
- Date:
- Fri Jan 01 23:47:27 2016 +0000
- Revision:
- 0:5057d688da32
- Child:
- 1:5bc8c8e22eda
ok sysclk
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mega64 | 0:5057d688da32 | 1 | #include "mbed.h" |
mega64 | 0:5057d688da32 | 2 | |
mega64 | 0:5057d688da32 | 3 | DigitalOut myled(PB_0); |
mega64 | 0:5057d688da32 | 4 | |
mega64 | 0:5057d688da32 | 5 | int main() |
mega64 | 0:5057d688da32 | 6 | { |
mega64 | 0:5057d688da32 | 7 | |
mega64 | 0:5057d688da32 | 8 | // sysclk test |
mega64 | 0:5057d688da32 | 9 | HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_SYSCLK, RCC_MCODIV_1); // 24 MHz |
mega64 | 0:5057d688da32 | 10 | |
mega64 | 0:5057d688da32 | 11 | while(1) { |
mega64 | 0:5057d688da32 | 12 | myled = 1; // LED is ON |
mega64 | 0:5057d688da32 | 13 | wait(0.99); // 200 ms |
mega64 | 0:5057d688da32 | 14 | myled = 0; // LED is OFF |
mega64 | 0:5057d688da32 | 15 | wait(0.01); // 1 sec |
mega64 | 0:5057d688da32 | 16 | myled = 1; // LED is ON |
mega64 | 0:5057d688da32 | 17 | wait(0.8); // 200 ms |
mega64 | 0:5057d688da32 | 18 | myled = 0; // LED is OFF |
mega64 | 0:5057d688da32 | 19 | wait(0.2); // 1 sec |
mega64 | 0:5057d688da32 | 20 | //HAL_Delay(1000); |
mega64 | 0:5057d688da32 | 21 | } |
mega64 | 0:5057d688da32 | 22 | } |