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
main.c
- Committer:
- MartinJohnson
- Date:
- 2016-05-19
- Revision:
- 0:699994a61048
- Child:
- 1:5d95bdb46dfd
File content as of revision 0:699994a61048:
#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; } }