本文整理汇总了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);
}
}
示例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
}
}
示例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)
{
}
}
示例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);
}
}
示例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();
}
示例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)
{
}
}
示例7: Peripheral_Config
void Peripheral_Config(void) {
RCC_Config();
GPIO_Config();
USART_Config();
TIM_Config();
DMA_Config();
}
示例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);
}
示例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);
}
}
示例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;
}
}
示例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;
}
}
示例12: Init_sys
/*系统初始化*/
void Init_sys(void)
{
RCC_Config();
NVIC_Config();
GPIO_Config();
USART_Config();
SPI_Config(SPI1);
app_tim(); //应用程序的定时器配置
}
示例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);
}
}
示例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;
}
}
示例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
}