Sample program for STM32F103 variants library. (Bluepill, Maple Mini, Nucleo F103 with external 8MHz crystal.)
Dependencies: STM32F103variants mbed-dev
Diff: stm32f103variants_main.cpp
- Revision:
- 1:56dc19b2d617
- Parent:
- 0:a8f641de0e6c
- Child:
- 2:eeddeeb9b8fb
--- a/stm32f103variants_main.cpp Fri Feb 24 09:21:45 2017 +0000 +++ b/stm32f103variants_main.cpp Tue Mar 14 18:57:32 2017 +0000 @@ -1,25 +1,22 @@ -#define USE_BOARD USE_OTHER //Use this for unmodified Nucleo-F103 and other boards. The library will do nothing and there will be no compile errors. -//#define USE_BOARD USE_BLUEPILL //Use this for STM32F103C8T6 board AKA the Bluepill. -//#define USE_BOARD USE_MAPLE_MINI //Use this for STM32F103CBT6 board AKA the Maple Mini. -//#define USE_BOARD USE_NUCLEO_EXTOSC //Use this for modified Nucleo-F103. (Added 8MHz crystal) - #include "stm32f103variants.h" #include "mbed.h" -DigitalOut led1(LED1); +DigitalOut led1(PC_13); Serial serialPc(PA_9, PA_10); //Tx, Rx int main() { + led1 = 0; confSysClock(); serialPc.baud(460800); serialPc.printf("This is a STM32F103 test.\r\n"); - serialPc.printf("Selected board: %d\r\n", USE_BOARD); serialPc.printf("CPU SystemCoreClock is %d Hz\r\n", SystemCoreClock); - + serialPc.printf("LED=%d\r\n", led1.read()); + while (true) { - led1 != led1; + led1 = !led1; + serialPc.printf("LED=%d\r\n", led1.read()); wait(1.0); } -} \ No newline at end of file +}