示例#1
0
/*
-------------------------------------------------------------------------
*  函数名称:
*  函数功能:
*  输入形参:  	
*  返回值:		 	
---------------------------------------------------------------------------
*/
void Board_Init(void)
{	
	u8 i;	
	//系统时钟配置 									   
	SystemInit();
	//延时函数初始化		   	
	delay_init(72);
	//定时器1初始化		 
	TIM1_config();
  	//舵机初始化
	Motor_Init(); 	
	Servo_Init();
	//串口配置
	USART_Config();	
	//串口中断配置   	
	NVIC_Config();
	//LED初始化		
	LED_Init();
	//按键初始化				
	KEY_Init();	 
	//等待电调中间值确定	
	for(i=0;i<3;i++)	
	{
		delay_ms(1000);
	}   	
}
示例#2
0
/************************************************************************
 * @brief 	main function	
 * @param[in]	None
 * @return		None
 ***********************************************************************/
int main(void)
{
	uint16_t i;
	uint16_t ReData;
	SystemInit();
	USART_Config();
	init_display ();

	USART1_Puts("This msg from USART1\n\r");
	USART2_Puts("This msg from USART2\n\r");
	
	
	while(1)
	{
#if 0	
		
		ReData = USART2_GetChar();
		//USART2_Puts((unsigned char*)ReData);
		USART_SendData(USART2, ReData);
		
#endif
		
#if 1
		
		
		USART2_Puts("*STS#");
		
		GLCD_displayStringLn(Line7, "Sending: *STS#");
		USART2_SmartCardGet(4); //updating data
		if (USART2_BufferCompare((uint8_t *)"*CP#", 4))
		{
			USART2_Puts("*R0802#");
			
			GLCD_displayStringLn(Line8, "Sending: *R0802#");
			USART2_SmartCardGet(12); //updating data
			if (USART2_BufferCompare((uint8_t *)"*RD08024344#", 12))
				{
					GLCD_clearLn(Line9);
					GLCD_displayStringLn(Line9, "Person 1");
					//break;
				}
			
			if (USART2_BufferCompare((uint8_t *)"*RD08024142#", 12))
				{
					GLCD_clearLn(Line9);
					GLCD_displayStringLn(Line9, "Person 2");
					//break;
				}
			
			if (USART2_BufferCompare((uint8_t *)"*RD08024143#", 12))
				{
					GLCD_clearLn(Line9);
					GLCD_displayStringLn(Line9, "Person 3");
					//break;
				}
					
			}
#endif		
		}
}
示例#3
0
/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{    
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f0xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f0xx.c file
  */
  
  /* Initialize LEDs available  ***********************************************/
  STM_EVAL_LEDInit(LED1);
  STM_EVAL_LEDInit(LED2);
  STM_EVAL_LEDInit(LED3);
  STM_EVAL_LEDInit(LED4);
   
  /* USART configuration */
  USART_Config();
  
  /* Wake up from USART STOP mode by Start bit Method */
  WakeUp_StartBitMethod();
  
  /* Configure SystemClock*/
  RestoreConfiguration();
  
  /* Configure and enable the systick timer to generate an interrupt each 1 ms */
  SysTick_Config((SystemCoreClock / 1000));
  
  while (1)
  {
  }
}
示例#4
0
int main(void)
{
    uint8_t tmp;

    InitFifo();
    USART_Config();
    LED_Init();
//    I2C_Configuration();
    Systick_Init();
    mySPI_Init();
    //spi();
    //Delay(1000);
    printf("init SPI test \n\r");
  SPI_send(0x23, 0xc9);                         // resetting the accelerometer internal circuit
  SPI_send(0x20, 0x67);                         // 100Hz data update rate, block data update disable, x/y/z enabled 
  SPI_send(0x24, 0x20);                         // Anti aliasing filter bandwidth 800Hz, 16G (very sensitive), no self-test, 4-wire interface
  SPI_send(0x10, 0x00);                         // Output(X) = Measurement(X) - OFFSET(X) * 32;
  SPI_send(0x11, 0x00);                         // Output(Y) = Measurement(Y) - OFFSET(Y) * 32;
  SPI_send(0x12, 0x00);                         // Output(Z) = Measurement(Z) - OFFSET(Z) * 32;
  while (1)
  {

      //tmp = SPI_read(0x28);
      //printf("x : %x \n\r",tmp);
        tmp = SPI_read(0x29);
      printf("x : %x \n\r",tmp);
      Delay(1000);
  }
}
示例#5
0
void init() {
    SystemInit();

    // Init the LEDs 
    GPIO_Config();                     

    // For FreeRTOS 
    NVIC_Config();

    // Init for debuging
    USART_Config();

    // LED Controller Init
    LEDDecoderInit();

    // Open CRC for emWin
    CRC_Init();    

    // LCD
    STM324xG_LCD_Init();
    sEE_Init();        

    // Touch Screen
    TSC_Config();     

    // emWin
    GUI_Init();      

    // File System
    file_system_init();
}
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f0xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f0xx.c file
     */     

  /* USART configuration */
  USART_Config();
  
  /* Output a message on Hyperterminal using printf function */
  printf("\n\rUSART Printf Example: retarget the C library printf function to the USART\n\r");

  /* Loop until the end of transmission */
  /* The software must wait until TC=1. The TC flag remains cleared during all data
     transfers and it is set by hardware at the last frame’s end of transmission*/
  while (USART_GetFlagStatus(EVAL_COM1, USART_FLAG_TC) == RESET)
  {}
  
  while (1)
  {
  }
}
示例#7
0
void Peripheral_Config(void) {
	RCC_Config();
	GPIO_Config();
	USART_Config();
	TIM_Config();
	DMA_Config();
}
示例#8
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/startup_stm32f429_439xx.s)
       before to branch to application main.
     */
          
  /* USART Configuration */     
  USART_Config();

  /* Display Plain Data */
  Display_PlainData();

/*=====================================================
    Encryption                                          
======================================================*/
  /* Encryption */
  AES128_Encrypt_DMA();
  
  /* Display encrypted Data */
  Display_EncryptedData();

/*=====================================================
    Decryption                                          
======================================================*/
  /* Decryption */
  AES128_Decrypt_DMA();

  /* Display decrypted data */
  Display_DecryptedData();

  while(1);  
}
示例#9
0
int main(void){

//	u8 d4[5];
//	d4[0]='a';
//	d4[1]='b';
//	d4[2]='c';
//	d4[3]='d';
//	d4[4]='\0';

	RCC_Config();
	GPIO_Config();
	USART_Config();
	NVIC_Config();

	while(1){
//		printf("×Ö·û´®Êä³ö d4=%s\r\n",d4);
		printf("Use_EPH_Sum=%d\r\n", GPS_Information.Use_EPH_Sum);
		printf("MSL_Al=%lf\r\n", GPS_Information.MSL_Altitude);
		printf("Longitude=%s\r\n", GPS_Information.Longitude);
		printf("Latitude=%s\r\n", GPS_Information.Latitude);
		printf("NS_Ind=%c\r\n", GPS_Information.NS_Indicator);
		printf("Speed=%lf\r\n", GPS_Information.Speed);
		printf("EW_Ind=%c\r\n", GPS_Information.EW_Indicator);
		printf("Course=%lf\r\n", GPS_Information.Course);
		printf("PDOP=%lf\r\n", GPS_Information.PDOP);
		printf("HDOP=%lf\r\n", GPS_Information.HDOP);
		printf("VDOP=%lf\r\n", GPS_Information.VDOP);
		
	}
}
示例#10
0
/*******************************************************************************
* Function Name  : Virtual_Com_Port_Status_In.
* Description    : Virtual COM Port Status In Routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
void Virtual_Com_Port_Status_In(void)
{
  if (Request == SET_LINE_CODING)
  {
    USART_Config();
    Request = 0;
  }
}
示例#11
0
/*******************************************************************************
* Function Name  : Virtual_Com_Port_Status_In.
* Description    : Virtual COM Port Status In Routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
void Virtual_Com_Port_Status_In(void)
{
	if (Request == SET_LINE_CODING) {
		USART_Config();
		USB_set_linecoding_callback( linecoding.bitrate );
		Request = 0;
	}
}
示例#12
0
/*系统初始化*/
 void Init_sys(void)
{
	RCC_Config();
	NVIC_Config();
	GPIO_Config();
	USART_Config();
	SPI_Config(SPI1);
	app_tim();				//应用程序的定时器配置
}
示例#13
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
	/* Initialize LEDs available on STM32F429I-DISCO */
  STM_EVAL_LEDInit(LED3);
  STM_EVAL_LEDInit(LED4);

  /* Turn on LED3 */
  STM_EVAL_LEDOn(LED3);

  /* USART configuration */
  USART_Config();

  /* Output a message on Hyperterminal using printf function */
  printf("\n\rUSART Printf Example: retarget the C library printf function to the USART\n\r");
	
	/* Setup SysTick Timer for 1 msec interrupts.
	------------------------------------------
	1. The SysTick_Config() function is a CMSIS function which configure:
	- The SysTick Reload register with value passed as function parameter.
	- Configure the SysTick IRQ priority to the lowest value (0x0F).
	- Reset the SysTick Counter register.
	- Configure the SysTick Counter clock source to be Core Clock Source (HCLK).
	- Enable the SysTick Interrupt.
	- Start the SysTick Counter.

	2. You can change the SysTick Clock source to be HCLK_Div8 by calling the
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8) just after the
	SysTick_Config() function call. The SysTick_CLKSourceConfig() is defined
	inside the misc.c file.

	3. You can change the SysTick IRQ priority by calling the
	NVIC_SetPriority(SysTick_IRQn,...) just after the SysTick_Config() function 
	call. The NVIC_SetPriority() is defined inside the core_cm3.h file.

	4. To adjust the SysTick time base, use the following formula:

	Reload Value = SysTick Counter Clock (Hz) x  Desired Time base (s)

	- Reload Value is the parameter to be passed for SysTick_Config() function
	- Reload Value should not exceed 0xFFFFFF
	*/
  
	if (SysTick_Config(SystemCoreClock / 1000)) {
		/* Capture error */
		while (1);
	}

  /* Infinite loop */
  while (1)
  {
		STM_EVAL_LEDToggle(LED4);

		Delay(50);
  }
}
示例#14
0
/*******************************************************************************
* Function Name  : Virtual_Com_Port_Status_In.
* Description    : Virtual COM Port Status In Routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
void Virtual_Com_Port_Status_In(void)
{
  if (Request == SET_LINE_CODING)
  {
// Redifei: UNUSED USART Config
#if 0
    USART_Config();
#endif
    Request = 0;
  }
}
示例#15
0
void  USART_DMA_Config(void)
{
  
  /* USART configuration -----------------------------------------------------*/
  USART_Config(); 
    
    
   /******************************************************************
    DMA TX   
    
    *******************************************************************/
    /* Prepare the DMA to transfer the transaction command (2bytes) from the
         memory to the USART  */ 
    DMA_DeInit(USARTx_TX_DMA_STREAM);
    DMA_InitStructure.DMA_Channel = USARTx_TX_DMA_CHANNEL;
    DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;  
    DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)TxBuffer_dma;
    DMA_InitStructure.DMA_BufferSize = (uint16_t)24;
    DMA_Init(USARTx_TX_DMA_STREAM, &DMA_InitStructure); 
    
    DMA_ITConfig(USARTx_TX_DMA_STREAM, DMA_IT_TC , ENABLE);
    
    /* Enable the USART DMA requests */   
    USART_DMACmd(USARTx, USART_DMAReq_Tx, ENABLE);
      
    /* Clear the TC bit in the SR register by writing 0 to it */
    USART_ClearFlag(USARTx, USART_FLAG_TC);         
    
   
	
/******************************************************************
    DMA RX
    
*******************************************************************/       
#if 1
    DMA_DeInit(USARTx_RX_DMA_STREAM);
    DMA_InitStructure.DMA_Channel = USARTx_RX_DMA_CHANNEL;
    DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
	DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;  
    DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)RxBuffer_dma;
    DMA_InitStructure.DMA_BufferSize = (uint16_t)24;
    DMA_Init(USARTx_RX_DMA_STREAM, &DMA_InitStructure);
    
    /******        DMA ÖжÏÅäÖà        ************************/
    DMA_ITConfig(USARTx_RX_DMA_STREAM, DMA_IT_TC , ENABLE);
    /* Enable the USART Rx DMA request  */
    USART_DMACmd(USARTx, USART_DMAReq_Rx, ENABLE);  
    /* Enable the DMA RX Stream*/ 
    DMA_Cmd(USARTx_RX_DMA_STREAM, ENABLE);   
    

#endif
  
}
示例#16
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontrollers clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f30x.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f30x.c file
     */ 
  
  /* USART configuration -----------------------------------------------------*/
  USART_Config();
  
  /* SysTick configuration ---------------------------------------------------*/
  SysTickConfig();
  
  /* Initialize LEDs mounted on STM32303C-EVAL board */
  STM_EVAL_LEDInit(LED1);
  STM_EVAL_LEDInit(LED2);
  STM_EVAL_LEDInit(LED3);
 
  /* Configure the CRC peripheral to use the polynomial x8 + x7 + x6 + x4 + x2 + 1 */
  CRC_Config(0xD5);
  
#ifdef MODE_TRANSMITTER
  /* ------------------ USART in mode Tramitter ------------------------------*/

  /* Configure the external interrupt "Joystick SEL" button */
  STM_EVAL_PBInit(BUTTON_SEL, BUTTON_MODE_EXTI);

  /* Forever loop */
  while (1)
  {
    
    /*Wait "JOY_SEL" to start data transfer */
    if ((PressedButton != JOY_NONE))
    {
      /* Enable the USARTx transmit data register empty interrupt */
      USART_ITConfig(USARTx, USART_IT_TXE, ENABLE);
      /* Set PressedButton to default value */
      PressedButton = JOY_NONE;
    }
  }
#else
  /* ------------------ USART in mode Receiver -------------------------------*/
  /* Enable the USARTx receive data register not empty interrupt */
  USART_ITConfig(USARTx, USART_IT_RXNE, ENABLE);

  /* Infinite loop */
  while(1)
  {
  }
  
#endif /* MODE_TRANSMITTER */
}
示例#17
0
void MCU_Init(void)
{
	RCC_Configuration();
	NVIC_Configuration();
	GPIO_Configuration();
	//TIM2_Configuration();
	SysTick_Init();
	SpiInit();
	USART_Config();
	ADC1_Init();
//	IWDG_Configuration();
}	
示例#18
0
static void periphInit()
{
	USART_Config(BT_USART, BT_BaudRate);
	FileManager_Init();
	PWM_Init(HEATER_PWM_FREQ);
	Move_Init();
	Extruder_Init();
	HeatBed_Init();
	USBDevice_Config();
	Command_Init();
	HostCtrl_Init();
}
示例#19
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f30x.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f30x.c file
     */
    
  /* Initialize LEDs available on STM32303C-EVAL board ************************/
  STM_EVAL_LEDInit(LED1);
  STM_EVAL_LEDInit(LED2);
  STM_EVAL_LEDInit(LED3);
  STM_EVAL_LEDInit(LED4);
  
  /* Enable PWR APB clock */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);

  /* USART configuration to Wake up from STOP mode by Start bit Method */
  USART_Config();

  /* Waiting Wake Up interrupt */
  while(InterruptCounter == 0x00)
  {}
  
  /* Disable USART peripheral in STOP mode */ 
  USART_STOPModeCmd(USART1, DISABLE);
  
  while(USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == RESET)
  {}
  DataReceived = USART_ReceiveData(USART1);
  
  /* Clear the TE bit (if a transmission is on going or a data is in the TDR, it will be sent before
  effectively disabling the transmission) */
  USART_DirectionModeCmd(USART1, USART_Mode_Tx, DISABLE);
  
  /* Check the Transfer Complete Flag */
  while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET)
  {}
  
  /* USART Disable */
  USART_Cmd(USART1, DISABLE);
    
  /* Configure SystemClock*/
  RestoreConfiguration();
  
  /* Configure and enable the systick timer to generate an interrupt each 1 ms */
  SysTick_Config((SystemCoreClock / 1000));
  
  while(1)
  {}
}
示例#20
0
文件: main.c 项目: szymon2103/Stm32
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured,
       this is done through SystemInit() function which is called from startup
       files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/startup_stm32f429_439xx.s)
       before to branch to application main.
     */

  /* USARTx configured as follows:
        - BaudRate = 115200 baud
        - Word Length = 8 Bits
        - One Stop Bit
        - No parity
        - Hardware flow control disabled (RTS and CTS signals)
        - Receive and transmit enabled
  */
  USART_Config();

  /* Enable CRYP clock */
  RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_CRYP, ENABLE);

  while(1)
  {
    /* Display Plain Text */
    Display_PlainData(PLAINTEXT_SIZE);

    /********************************************************************/
    /* !!!! This example runs only on STM32F437x/STM32F439x Devices !!! */
    /********************************************************************/

    /* Encrypt the plaintext message */
    if(CRYP_AES_GCM(MODE_ENCRYPT, InitVector, AES128key, KEY_SIZE, PlainText, PLAINTEXT_SIZE, HeaderMessage, HEADER_SIZE, OutputText, TAG) == SUCCESS)
    {
      /* Display encrypted Data */
      Display_EncryptedData(AES_MODE_GCM, KEY_SIZE, PLAINTEXT_SIZE);
      /* Display computed TAG, TAG size is 16 */
      Display_TAG(TAG);
    }

    /* Decrypt the cyphertext message */
    if(CRYP_AES_GCM(MODE_DECRYPT, InitVector, AES128key, KEY_SIZE, ExpectedCypherText, PLAINTEXT_SIZE, HeaderMessage, HEADER_SIZE, OutputText, TAG) == SUCCESS)
    {
      /* Display encrypted Data */
      Display_DecryptedData(AES_MODE_GCM, KEY_SIZE, PLAINTEXT_SIZE);
      /* Display computed TAG, TAG size is 16 */
      Display_TAG(TAG);
    }

    PressToContinue();
    printf("\n\r Example restarted...\n ");
  }
}
示例#21
0
int main(void)
{
    GPIO_Config();
    USART_Config();

    USART_SendString("Hello");
    USART_SendByte('!');
    USART_SendString("\r\n");

    xTaskCreate(vLedTask,(signed char*) "LedTask", configMINIMAL_STACK_SIZE, (void *) NULL, tskIDLE_PRIORITY + 2, NULL);
    vTaskStartScheduler();

}
示例#22
0
//核心组件初始化,包括串口(用于打印调试信息)
static void coreInit()
{
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	
	SystemCoreClockUpdate();
	SysTick_Init();
	LED_Config();
	USART_Config(Debug_USART, Debug_BaudRate);

	//enable remap for max6675 pins
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
	GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
}
示例#23
0
void Config_Init()
{
	//初始化LED
	LED_Init();
	//初始化串口引脚
	USART2_Init();
	USART6_Init();
	//初始化屏幕引脚
	LCD_GPIOInit();
	//配置uart
	USART_Config();
	
}
示例#24
0
文件: main.c 项目: hak1985/stm32-diy
void UART_Test()
{
	unsigned short ch = 0x66;

	USART_Config();
	while(1)
	{
		USART_SendChar(ch);

		ch = USART_ReadChar();

		OSTimeDlyHMSM(0, 0, 0, 10);
	}
}
示例#25
0
文件: bsp.c 项目: Lib-Tech/New_Pro
void BSP_Init(void)
{
	/* System Clocks Configuration --72M*/
	RCC_Configuration();   	
	GPIO_Configuration();	
	/* NVIC configuration */
	/*嵌套向量中断控制器 
	  说明了USART1抢占优先级级别0(最多1位) ,和子优先级级别0(最多7位) */ 
	NVIC_Configuration();	
	USART_Config(USART1,115200);		  //串口1初始化
	SPI_DEV_Init();
	
	//Init_AD9850();
}
示例#26
0
/**********************************************************************************************************
*	函 数 名: main
*	功能说明: 标准c程序入口。
*	形    参:无
*	返 回 值: 无
**********************************************************************************************************/
int main(void)
{
	// bsp_Init();

 
	NVIC_Config();
    USART_Config();
    while(1)
    {
        while(RESET == USART_GetFlagStatus(USART1,USART_FLAG_TXE));
        USART_SendData(USART1,'b');
        while(RESET == USART_GetFlagStatus(USART1,USART_FLAG_TXE));
        USART_SendData(USART1,'a');
			 //bsp_LedToggle(1);
        delay_second();
    }
}
示例#27
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f2xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f2xx.c file
     */     
       
  /* USARTx configured as follow:
        - BaudRate = 115200 baud  
        - Word Length = 8 Bits
        - One Stop Bit
        - No parity
        - Hardware flow control disabled (RTS and CTS signals)
        - Receive and transmit enabled
  */
  /* USART Configuration */
  USART_Config();

  /* Display Plain Data*/
  Display_PlainData();

/*=====================================================
    Encryption
======================================================*/

  /* Encrypt */
  TDES_Encrypt_DMA();

  /* Display encrypted Data*/
  Display_EncryptedData();

/*=====================================================
    Decryption
======================================================*/

  /* Decrypt */
  TDES_Decrypt_DMA();

  /* Display decrypted data*/
  Display_DecryptedData();

  while(1);
}
示例#28
0
/*
-------------------------------------------------------------------------
*  函数名称:void Board_Init(void)
*  函数功能:调用底层硬件初始化函数,供main()函数调用
*  输入形参:无  	
*  返回值:无		 	
---------------------------------------------------------------------------
*/
void Board_Init(void)
{	
	u8 i;										   
	SystemInit();		//系统时钟配置    	
	delay_init(72);		//延时函数初始化 
	TIM1_config();
	TIM4_Mode_Config();
	Motor_Init(); 		//舵机初始化
	Servo_Init(); 
	USART_Config();	   	//串口配置
	LED_Init();			//按键初始化	
	KEY_Init();	 	
	for(i=0;i<3;i++)	//等待电调中间值确定
	{
		delay_ms(1000);
	}   	
	OV7670_Init();		//最后进行摄像头初始化
}
示例#29
0
文件: main.c 项目: jh247247/vassal
int main(int argc, char *argv[])
{
  //BOOTLOADER_reset();

  int r;
  __enable_irq();
  //NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x4000); // make sure that
  // interrupts work
  clock_init(); // hey, you can overclock later here. maybe.



  JSON_init();
  USART_Config();
  TIM_init();

  LCD_Configuration();
  LCD_Initialization();
  LCD_Clear(LCD_Black);

  USART_PutString(HOST_USART,"***** INIT DONE *****\n");

  while(1) {

    r = JSON_render();

    // todo: better error reporting
    if(r == 3) {
      // no free bufs
      continue;
    } else if(r != 0) {
      JSON_init(); // reset buffers in case of errors
      char abuf[32];
      itoa(abuf, r, 10);
      USART_PutString(HOST_USART, abuf);
      USART_PutChar(HOST_USART, 'N');
      USART_PutChar(HOST_USART, '\n');
    }
    //USART1_PutChar('A');
    __asm__("WFI"); // sleep for a bit.
  }
  return 0;
}
示例#30
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/startup_stm32f429_439xx.s)
       before to branch to application main.
     */
                
  /* USART configuration */
  USART_Config();
  /* Enable HASH clock */
  RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_HASH, ENABLE);
     
  /* Display the original message */
  Display_MainMessage();
/*=============================================================================
  HMAC SHA-1 Digest Computation
==============================================================================*/

  /* HMAC SHA-1 Digest Computation */
  HMAC_SHA1((uint8_t*)Key, KEY_TAB_SIZE,
            (uint8_t*)Input, INPUT_TAB_SIZE,
            Sha1output);


  /* Display the HMAC SHA1 digest */
  Display_SHA1Digest();

/*=============================================================================
  HMAC MD5 Digest Computation
==============================================================================*/

  /* HMAC MD5 Digest Computation */
  HMAC_MD5((uint8_t*)Key, KEY_TAB_SIZE, 
           (uint8_t*)Input, INPUT_TAB_SIZE,
           Md5output); 

  /* Display the HMAC MD5 digest */
  Display_MD5Digest();

  while(1);  
}