Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: STM32F3-Discovery
Diff: main.c
- Revision:
- 0:699994a61048
- Child:
- 1:5d95bdb46dfd
diff -r 000000000000 -r 699994a61048 main.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.c Thu May 19 20:48:30 2016 +0000
@@ -0,0 +1,38 @@
+
+#include <stm32f3_discovery.h>
+
+volatile unsigned sysTiming;
+volatile unsigned sysTicks = 0;
+
+void SysTick_Handler(void) {
+ sysTicks++;
+ if (sysTiming > 0) --sysTiming;
+}
+
+void sysDelayMs(unsigned dly) {
+ sysTiming = dly;
+ while (sysTiming > 0) __wfi();
+
+}
+
+int main(void) {
+
+ SysTick_Config((SystemCoreClock / 1000));
+ RCC->AHBENR |= RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOA;
+ GPIOE->MODER = (GPIOE->MODER&0xffff) | 0x55550000; // output mode for PE8-15
+ GPIOA->MODER = (GPIOA->MODER&0xfffffffc) ; // input mode for PA0
+
+ GPIOE->BSRR=0xff00;
+ sysDelayMs(500);
+ int b=0;
+ for(int i=0;i<1000;i++) {
+ GPIOE->BSRR=1<<(b+8);
+ while(GPIOA->IDR&1);
+// for(int j=0;j<1000000;j++);
+ sysDelayMs(100);
+ GPIOE->BSRR=1<<(b+8+16);
+ b=(b+1)%8;
+ }
+}
+
+