From 32e57dac2e61e79b029593eb4d34d727bcc10678 Mon Sep 17 00:00:00 2001 From: iperry Date: Thu, 17 Dec 2009 02:37:07 +0000 Subject: Initial commit of library code, moved from leaftest repo git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@69 749a229e-a60e-11de-b98f-4500b42dc123 --- .../examples/FSMC/NOR_CodeExecute/binary/main.c | 112 +++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100755 src/stm32lib/examples/FSMC/NOR_CodeExecute/binary/main.c (limited to 'src/stm32lib/examples/FSMC/NOR_CodeExecute/binary/main.c') diff --git a/src/stm32lib/examples/FSMC/NOR_CodeExecute/binary/main.c b/src/stm32lib/examples/FSMC/NOR_CodeExecute/binary/main.c new file mode 100755 index 0000000..1c7c69d --- /dev/null +++ b/src/stm32lib/examples/FSMC/NOR_CodeExecute/binary/main.c @@ -0,0 +1,112 @@ +/******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** +* File Name : main.c +* Author : MCD Application Team +* Version : V2.0.1 +* Date : 06/13/2008 +* Description : Main program body. +******************************************************************************** +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f10x_lib.h" + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +GPIO_InitTypeDef GPIO_InitStructure; + +/* Private function prototypes -----------------------------------------------*/ +void Delay(vu32 nCount); + +/* Private functions ---------------------------------------------------------*/ + +/******************************************************************************* +* Function Name : main +* Description : Main program. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +int main(void) +{ +#ifdef DEBUG + debug(); +#endif + + /* Enable GPIOF clock */ + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOF, ENABLE); + + /* Configure IO connected to LD1, LD2, LD3 and LD4 leds */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_Init(GPIOF, &GPIO_InitStructure); + + while (1) + { + /* Turn on LD1 */ + GPIO_SetBits(GPIOF, GPIO_Pin_6); + /* Insert delay */ + Delay(0xAFFFF); + + /* Turn on LD2 and LD3 */ + GPIO_SetBits(GPIOF, GPIO_Pin_7 | GPIO_Pin_8); + /* Turn off LD1 */ + GPIO_ResetBits(GPIOF, GPIO_Pin_6); + /* Insert delay */ + Delay(0xAFFFF); + + /* Turn on LD4 */ + GPIO_SetBits(GPIOF, GPIO_Pin_9); + /* Turn off LD2 and LD3 */ + GPIO_ResetBits(GPIOF, GPIO_Pin_8 | GPIO_Pin_7); + /* Insert delay */ + Delay(0xAFFFF); + + /* Turn off LD4 */ + GPIO_ResetBits(GPIOF, GPIO_Pin_9); + } +} + +/******************************************************************************* +* Function Name : Delay +* Description : Inserts a delay time. +* Input : nCount: specifies the delay time length. +* Output : None +* Return : None +*******************************************************************************/ +void Delay(vu32 nCount) +{ + for(; nCount != 0; nCount--); +} + +#ifdef DEBUG +/******************************************************************************* +* Function Name : assert_failed +* Description : Reports the name of the source file and the source line number +* where the assert_param error has occurred. +* Input : - file: pointer to the source file name +* - line: assert_param error line source number +* Output : None +* Return : None +*******************************************************************************/ +void assert_failed(u8* file, u32 line) +{ + /* User can add his own implementation to report the file name and line number, + ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ + + /* Infinite loop */ + while (1) + { + } +} +#endif + +/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ -- cgit v1.2.3