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
00001 00002 #include <stm32f3_discovery.h> 00003 00004 volatile unsigned sysTiming; 00005 volatile unsigned sysTicks = 0; 00006 00007 void SysTick_Handler(void) { 00008 sysTicks++; 00009 if (sysTiming > 0) --sysTiming; 00010 } 00011 00012 void sysDelayMs(unsigned dly) { 00013 sysTiming = dly; 00014 while (sysTiming > 0) __wfi(); 00015 00016 } 00017 00018 int main(void) { 00019 00020 SysTick_Config((SystemCoreClock / 1000)); 00021 RCC->AHBENR |= RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOA; 00022 GPIOE->MODER = (GPIOE->MODER&0xffff) | 0x55550000; // output mode for PE8-15 00023 GPIOA->MODER = (GPIOA->MODER&0xfffffffc) ; // input mode for PA0 00024 00025 GPIOE->BSRR=0xff00; 00026 sysDelayMs(500); 00027 int b=0; 00028 while(1) { 00029 GPIOE->BSRR=1<<(b+8); 00030 while(GPIOA->IDR&1); 00031 sysDelayMs(100); 00032 GPIOE->BSRR=1<<(b+8+16); 00033 b=(b+1)%8; 00034 } 00035 } 00036 00037
Generated on Wed Jul 20 2022 13:26:45 by
1.7.2