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@1:5bc8c8e22eda, 2016-01-25 (annotated)
- Committer:
- mega64
- Date:
- Mon Jan 25 21:44:56 2016 +0000
- Revision:
- 1:5bc8c8e22eda
- Parent:
- 0:5057d688da32
- Child:
- 2:7cc544472c34
test for f100r6 lib
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 | 1:5bc8c8e22eda | 3 | |
mega64 | 1:5bc8c8e22eda | 4 | |
mega64 | 1:5bc8c8e22eda | 5 | #if 0 |
mega64 | 0:5057d688da32 | 6 | DigitalOut myled(PB_0); |
mega64 | 0:5057d688da32 | 7 | |
mega64 | 0:5057d688da32 | 8 | int main() |
mega64 | 0:5057d688da32 | 9 | { |
mega64 | 0:5057d688da32 | 10 | |
mega64 | 0:5057d688da32 | 11 | // sysclk test |
mega64 | 0:5057d688da32 | 12 | HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_SYSCLK, RCC_MCODIV_1); // 24 MHz |
mega64 | 0:5057d688da32 | 13 | |
mega64 | 0:5057d688da32 | 14 | while(1) { |
mega64 | 1:5bc8c8e22eda | 15 | myled = 1; |
mega64 | 1:5bc8c8e22eda | 16 | wait(0.99); |
mega64 | 1:5bc8c8e22eda | 17 | myled = 0; |
mega64 | 1:5bc8c8e22eda | 18 | wait(0.01); |
mega64 | 1:5bc8c8e22eda | 19 | myled = 1; |
mega64 | 1:5bc8c8e22eda | 20 | wait(0.8); |
mega64 | 1:5bc8c8e22eda | 21 | myled = 0; |
mega64 | 1:5bc8c8e22eda | 22 | wait(0.2); |
mega64 | 1:5bc8c8e22eda | 23 | myled = 1; |
mega64 | 1:5bc8c8e22eda | 24 | HAL_Delay(1000); |
mega64 | 0:5057d688da32 | 25 | } |
mega64 | 0:5057d688da32 | 26 | } |
mega64 | 1:5bc8c8e22eda | 27 | #endif |
mega64 | 1:5bc8c8e22eda | 28 | |
mega64 | 1:5bc8c8e22eda | 29 | #if 1 |
mega64 | 1:5bc8c8e22eda | 30 | //Serial pc(PA_9, PA_10); // tx, rx |
mega64 | 1:5bc8c8e22eda | 31 | DigitalOut myled(PB_0); |
mega64 | 1:5bc8c8e22eda | 32 | |
mega64 | 1:5bc8c8e22eda | 33 | int main() |
mega64 | 1:5bc8c8e22eda | 34 | { |
mega64 | 1:5bc8c8e22eda | 35 | myled=0; |
mega64 | 1:5bc8c8e22eda | 36 | printf("Hello World!\n"); |
mega64 | 1:5bc8c8e22eda | 37 | while(1) { |
mega64 | 1:5bc8c8e22eda | 38 | printf("Heartbeat!\n"); |
mega64 | 1:5bc8c8e22eda | 39 | wait(1); |
mega64 | 1:5bc8c8e22eda | 40 | myled=!myled; |
mega64 | 1:5bc8c8e22eda | 41 | } |
mega64 | 1:5bc8c8e22eda | 42 | } |
mega64 | 1:5bc8c8e22eda | 43 | #endif |