当前位置: 首页>>代码示例>>C++>>正文


C++ USART_Config函数代码示例

本文整理汇总了C++中USART_Config函数的典型用法代码示例。如果您正苦于以下问题:C++ USART_Config函数的具体用法?C++ USART_Config怎么用?C++ USART_Config使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了USART_Config函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Board_Init

/*
-------------------------------------------------------------------------
*  函数名称:
*  函数功能:
*  输入形参:  	
*  返回值:		 	
---------------------------------------------------------------------------
*/
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);
	}   	
}
开发者ID:KoenChiu,项目名称:Camera-Car,代码行数:34,代码来源:Application.c

示例2: main

/************************************************************************
 * @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		
		}
}
开发者ID:12019,项目名称:library-management-stm32f107,代码行数:65,代码来源:main.c

示例3: main

/**
  * @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)
  {
  }
}
开发者ID:beattie,项目名称:FreeRTOS-Nucleo-f091rc,代码行数:36,代码来源:main.c

示例4: main

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);
  }
}
开发者ID:danghuutoan,项目名称:template,代码行数:29,代码来源:main.c

示例5: init

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();
}
开发者ID:bobogei81123,项目名称:jjj,代码行数:31,代码来源:initial.c

示例6: main

/**
  * @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)
  {
  }
}
开发者ID:Lee-Kevin,项目名称:MotorBridgeCapeFirmwareSourceCode,代码行数:30,代码来源:main.c

示例7: Peripheral_Config

void Peripheral_Config(void) {
	RCC_Config();
	GPIO_Config();
	USART_Config();
	TIM_Config();
	DMA_Config();
}
开发者ID:shentqlf,项目名称:ws2812b_with_STM32,代码行数:7,代码来源:main.c

示例8: main

/**
  * @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);  
}
开发者ID:scottmnowakowski,项目名称:sensor_suite,代码行数:39,代码来源:main.c

示例9: main

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);
		
	}
}
开发者ID:InfiniteYuan1,项目名称:STM32,代码行数:30,代码来源:mian.c

示例10: Virtual_Com_Port_Status_In

/*******************************************************************************
* 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;
  }
}
开发者ID:Maelok,项目名称:project_stm32_stdperiph,代码行数:15,代码来源:usb_prop.c

示例11: Virtual_Com_Port_Status_In

/*******************************************************************************
* 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;
	}
}
开发者ID:iruka-,项目名称:ARM_BOOTLOADER,代码行数:15,代码来源:usb_prop.c

示例12: Init_sys

/*系统初始化*/
 void Init_sys(void)
{
	RCC_Config();
	NVIC_Config();
	GPIO_Config();
	USART_Config();
	SPI_Config(SPI1);
	app_tim();				//应用程序的定时器配置
}
开发者ID:mokuzaru,项目名称:x808_sim808,代码行数:10,代码来源:function.c

示例13: main

/**
  * @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);
  }
}
开发者ID:lostemp,项目名称:stm32f4-disco,代码行数:60,代码来源:main.c

示例14: Virtual_Com_Port_Status_In

/*******************************************************************************
* 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;
  }
}
开发者ID:The-Red,项目名称:Redifei-STM32-Library,代码行数:18,代码来源:usb_prop.c

示例15: USART_DMA_Config

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
  
}
开发者ID:wangxubo1988,项目名称:Center_System,代码行数:54,代码来源:usart_dma.c


注:本文中的USART_Config函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。