Last active
December 10, 2015 22:38
-
-
Save lbuchy/4504145 to your computer and use it in GitHub Desktop.
Basic blink setup for the stm32f4 microcontroller
This file contains 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" | |
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() | |
{ | |
initLeds(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment