From 7274274a29866a6c66a50e37f640ced505c617b5 Mon Sep 17 00:00:00 2001 From: OhMeuMenino Date: Fri, 19 May 2017 00:14:52 +0100 Subject: [PATCH 1/3] blink LED --- StartProject/src/main.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/StartProject/src/main.c b/StartProject/src/main.c index 1f9b07c..4ae7230 100644 --- a/StartProject/src/main.c +++ b/StartProject/src/main.c @@ -1,22 +1,35 @@ /* +** Start project. It includes all Standart Peripherals Library ** -** Main.c -** +** This projects configure the GPIO G13 to blink the LED3 (green) ** **********************************************************************/ /* - Last committed: $Revision: 00 $ - Last changed by: $Author: $ - Last changed date: $Date: $ - ID: $Id: $ + Last changed by: OhMeuMenino + Last changed date: May 2017 **********************************************************************/ #include "stm32f4xx_conf.h" int main(void) { - while(1) - { - - } + /* GPIOG Peripheral clock enable */ + RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE); + + /* Configure the PIN13 on PORTG */ + GPIO_InitTypeDef PORTG; + PORTG.GPIO_Pin = GPIO_Pin_13; // Pin 13 + PORTG.GPIO_Mode = GPIO_Mode_OUT; // Output + PORTG.GPIO_OType = GPIO_OType_PP; // Output Type - Push-pull mode + PORTG.GPIO_Speed = GPIO_Speed_100MHz; + PORTG.GPIO_PuPd = GPIO_PuPd_NOPULL; + GPIO_Init(GPIOG, &PORTG); + + int i=1000000; + while(1) + { + GPIO_ToggleBits(GPIOG,13); + for(i=1000000;i>0;i--); + } + } From 6c084da55e174b58a46f6a8f9fc108448142b7c4 Mon Sep 17 00:00:00 2001 From: OhMeuMenino Date: Fri, 19 May 2017 00:15:48 +0100 Subject: [PATCH 2/3] delete readme.txt --- StartProject/readme.txt | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 StartProject/readme.txt diff --git a/StartProject/readme.txt b/StartProject/readme.txt deleted file mode 100644 index cc065b0..0000000 --- a/StartProject/readme.txt +++ /dev/null @@ -1,11 +0,0 @@ -You have to set the correct memory layout for your device in the linker script. -Please check the FLASH and SRAM length. - -e.g. - - -MEMORY -{ - FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x08000 /* 32k */ - RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x01000 /* 4k */ -} \ No newline at end of file From 04177f4624ef96d193adec36a3991469943d1a92 Mon Sep 17 00:00:00 2001 From: OhMeuMenino Date: Fri, 19 May 2017 00:24:03 +0100 Subject: [PATCH 3/3] Update main.c --- StartProject/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StartProject/src/main.c b/StartProject/src/main.c index 4ae7230..cd74fda 100644 --- a/StartProject/src/main.c +++ b/StartProject/src/main.c @@ -28,7 +28,7 @@ int main(void) int i=1000000; while(1) { - GPIO_ToggleBits(GPIOG,13); + GPIO_ToggleBits(GPIOG, GPIO_Pin_13); for(i=1000000;i>0;i--); }