Created
January 10, 2013 18:22
-
-
Save lbuchy/4504477 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stm32f4xx_conf.h" | |
static const int k_delayTicks = 1000000; | |
void delay(int cnt) | |
{ | |
int i = 0; | |
while(i++ < cnt) {} | |
} | |
void initLeds() | |
{ | |
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); | |
GPIO_InitTypeDef GPIO_InitStructure; | |
// Configure PD12 in output pushpull mode | |
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; | |
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; | |
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; | |
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; | |
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; | |
GPIO_Init(GPIOD, &GPIO_InitStructure); | |
} | |
int main(void) | |
{ | |
initLeds(); | |
for (;;) { | |
delay(k_delayTicks); | |
GPIO_ToggleBits(GPIOD, GPIO_Pin_13); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment