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


C++ USART_DeInit函数代码示例

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


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

示例1: RN42_conf

/**
  * @brief  Configures the USART1 to talk to the RN42, and sets it up. Note that this should only be used to configure new modules!
  * @param  None
  * @retval None
  */
void RN42_conf(void) {
	USART_InitTypeDef   USART_InitStructure;
	//Wait for buffer to empty
	while(anything_in_buff(&Usart1_tx_buff))
		__WFI();
	USART_Cmd(USART1_USART, DISABLE);
	USART_DeInit(USART1_USART);
	//Set the config for default RN42 settings
	USART_InitStructure.USART_WordLength = USART_WordLength_8b;
	USART_InitStructure.USART_StopBits = USART_StopBits_1;
	USART_InitStructure.USART_Parity = USART_Parity_No;
	USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
	USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;
	USART_InitStructure.USART_BaudRate  = USART1_BAUD;//use the default
	USART_Init(USART1_USART, &USART_InitStructure );
	USART_Cmd(USART1_USART, ENABLE);
	Usart_Send_Str((char*)"$$$");Delay(150000);
	Usart_Send_Str((char*)"$$$");Delay(150000);
	Usart_Send_Str((char*)"\nD\n");Delay(150000);
	Usart_Send_Str((char*)"SH,0000\n");Delay(100000);
	Usart_Send_Str((char*)"S~,0\n");Delay(100000);
	Usart_Send_Str((char*)"SL,E\n");Delay(100000);
	Usart_Send_Str((char*)"R,1\n");	//causes the setting to take effect
	//Wait for buffer to empty
	while(anything_in_buff(&Usart1_tx_buff))
		__WFI();
	USART_InitStructure.USART_WordLength = USART_WordLength_9b;
	USART_InitStructure.USART_Parity = USART_Parity_Even;
	USART_Cmd(USART1_USART, DISABLE);
	USART_DeInit(USART1_USART);
	USART_Init(USART1_USART, &USART_InitStructure );//now the module should be configured
	USART_Cmd(USART1_USART, ENABLE);
}
开发者ID:akohlsmith,项目名称:Equine,代码行数:38,代码来源:rn42_command.c

示例2: UartMcuInit

void UartMcuInit( Uart_t *obj, uint8_t uartId, PinNames tx, PinNames rx )
{
    obj->UartId = uartId;

    switch ( obj->UartId )
    {
    case UART_1:
        RCC_APB2PeriphClockCmd( RCC_APB2Periph_USART1, ENABLE );

        USART_DeInit( USART1 );

        GpioInit( &obj->Tx, tx, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );
        GpioInit( &obj->Rx, rx, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );

        GPIO_PinAFConfig( obj->Tx.port, ( obj->Tx.pin & 0x0F ), GPIO_AF_USART1 );
        GPIO_PinAFConfig( obj->Rx.port, ( obj->Rx.pin & 0x0F ), GPIO_AF_USART1 );
        break;
    case UART_2:
        RCC_APB1PeriphClockCmd( RCC_APB1Periph_USART2, ENABLE );

        USART_DeInit( USART2 );

        GpioInit( &obj->Tx, tx, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );
        GpioInit( &obj->Rx, rx, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );

        GPIO_PinAFConfig( obj->Tx.port, ( obj->Tx.pin & 0x0F ), GPIO_AF_USART2 );
        GPIO_PinAFConfig( obj->Rx.port, ( obj->Rx.pin & 0x0F ), GPIO_AF_USART2 );
        break;
    }
}
开发者ID:davincicloud-kr,项目名称:im-l200,代码行数:30,代码来源:uart-board.c

示例3: IAP_DevDeInit

/*******************************************************************************
 * 名    称: IAP_DevDeInit()
 * 功    能: 设备恢复默认值
 * 入口参数:
 * 出口参数: 无
 * 作   者: 无名沈
 * 创建日期: 2014-04-23
 * 修    改: 
 * 修改日期: 
 *******************************************************************************/
void IAP_DevDeInit(void)
{    
    /***********************************************
    * 描述: 端口恢复默认
    */
    GPIO_DeInit(GPIOA);
    GPIO_DeInit(GPIOB);
    GPIO_DeInit(GPIOC);
    GPIO_DeInit(GPIOD);
    GPIO_DeInit(GPIOE);
    
    /***********************************************
    * 描述: 串口恢复默认
    */
    USART_DeInit(USART1);
    USART_DeInit(USART2);
    USART_DeInit(USART3);
        
    /***********************************************
    * 描述: 定时器恢复默认
    */
    TIM_DeInit(TIM1);
    TIM_DeInit(TIM2);
    TIM_DeInit(TIM2);
    TIM_DeInit(TIM3);
    TIM_DeInit(TIM4);
    TIM_DeInit(TIM5);
    TIM_DeInit(TIM6);
    TIM_DeInit(TIM7);
    TIM_DeInit(TIM8);
}
开发者ID:redmorningcn,项目名称:NC136B-320,代码行数:41,代码来源:iap.c

示例4: Usart_Configuration

void Usart_Configuration(void)
{
	USART_InitTypeDef USART_InitStruct;

	UsartRcc_Configuration();
	UsartGPIO_Configuration();
	NVIC_Configuration();
	USART_DeInit(USART1);
	USART_DeInit(USART2);

	USART_InitStruct.USART_BaudRate = 9600;
	USART_InitStruct.USART_StopBits = USART_StopBits_1;
	USART_InitStruct.USART_WordLength = USART_WordLength_9b;
	USART_InitStruct.USART_Parity = USART_Parity_Odd;
	USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
	USART_InitStruct.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;
	
	USART_Init(USART1, &USART_InitStruct); 		 
	USART_ClearFlag(USART1,USART_FLAG_TC);
	USART_Cmd(USART1, ENABLE);	
		

	USART_Init(USART2, &USART_InitStruct);	
	USART_ClearFlag(USART2,USART_FLAG_TC);
	USART_Cmd(USART2, ENABLE);
}
开发者ID:xuyingjun,项目名称:learngit,代码行数:26,代码来源:stm32f10_usart.c

示例5: USARTA_Test_Init

//-----------------------------------------------------------------
//   USART 1 initialization
//   USART 1 on ev board Corresponds to USART 1(1 of 1~3) of MCU
//-----------------------------------------------------------------
void USARTA_Test_Init(u8 i)
{
  USART_InitTypeDef USART_InitStructure;

  GPIO_InitTypeDef GPIO_InitStructure;

  // USART1 IO configuration ------------------------------------//
  // Enable GPIOA clock
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);

  // Set PA9/PA10 as PP AF - USART_TXD,RXD
  GPIO_InitStructure.GPIO_Pin = USARTATX_PIN;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_Init(USARTATX_PORT, &GPIO_InitStructure);
  
  GPIO_InitStructure.GPIO_Pin = USARTARX_PIN;  
  GPIO_Init(USARTARX_PORT, &GPIO_InitStructure);
  // SET PA9/PA10 for USART
  GPIO_PinAFConfig(USARTATX_PORT, GPIO_PinSource9, GPIO_AF_USART1);
  GPIO_PinAFConfig(USARTARX_PORT, GPIO_PinSource10,GPIO_AF_USART1);

  // DeInit USART
  USART_DeInit(USART_A);
  // USART configuration --------------------------------------//
  // USART configured as follow:
  //      - BaudRate = 115200 or other baud  
  //      - Word Length = 8 Bits
  //      - 1 Stop Bit
  //      - No parity
  //      - Hardware flow control disabled (RTS and CTS signals)
  //      - Receive and transmit enabled
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
  // de-init USART1 to avoid the impact of USART3_IrDA
  USART_DeInit(USART1);
  
  Usart_Baud = USART_BAUD[i % (sizeof(USART_BAUD)/sizeof(u32))];
  USART_InitStructure.USART_BaudRate = Usart_Baud;
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;// DANA change
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
  USART_Init(USART_A, &USART_InitStructure);

  // Enable USART_A
  USART_Cmd(USART_A, ENABLE);
  // short delay seems mandatory before sending 1st byte
//  delay_10us(10);
}
开发者ID:jfazli,项目名称:PE208,代码行数:55,代码来源:usart_1.c

示例6: goSleep

void goSleep(void) {
  TM_RTC_Interrupts(TM_RTC_Int_Disable);
  TM_USART_Puts(MENU_USART,"Going to sleep state now!\n\r");
  USART_DeInit(MENU_USART);
  USART_DeInit(GSM_USART);
  USART_DeInit(GPS_USART);
  I2C_DeInit(I2C3);
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE, DISABLE);
  TM_RTC_Interrupts(TM_RTC_Int_1s); // 500ms;1,2,5,10,15,30,60 seconds to choose from
  TM_LOWPOWER_Standby();
  //TM_LOWPOWER_StopUntilInterrupt();
  //TM_LOWPOWER_SleepUntilInterrupt(1);
  //TM_LOWPOWER_EnableWakeUpPin();
}
开发者ID:fibrain,项目名称:Remote_Dev,代码行数:14,代码来源:cmdline_functions.c

示例7: init_UART

bool init_UART(UART_DESC * _urt, u8 _usartNumber){

	USART_InitTypeDef USART_InitStruct;
	_urt->usart_No = _usartNumber;
	
	USART_StructInit(&USART_InitStruct);	 	//8bit, parity_none, stopbit_1 ..

	switch(_urt->usart_No){
		case 2:
			USART_InitStruct.USART_BaudRate = 115200;
			RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
			_urt->usartBase = (USART_TypeDef*)USART2_BASE;
			uartRegister[2] = _urt;
			break;
		default:
			return FALSE;	
	}

	USART_DeInit(_urt->usartBase);
	USART_Init(_urt->usartBase, &USART_InitStruct);

	init_Comm(&_urt->parent);

	_urt->Tick = _urt->parent.Tick;
	_urt->parent.Tick = &UART_Tick;

	USART_ITConfig(_urt->usartBase, USART_IT_RXNE, ENABLE);
	NVIC_IntEnable(USART2_IRQn,0x02);

	initHW_UART(_urt);
	USART_Cmd(_urt->usartBase, ENABLE);

	return TRUE;
}
开发者ID:azermert,项目名称:pto38team,代码行数:34,代码来源:uart.c

示例8: UartInit

void UartInit(uint32 BaudRate)
{
    GPIO_InitTypeDef GPIO_InitStructure;
    USART_InitTypeDef USART_InitStructure;
    /* Enable GPIO clock */
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);

    /* Configure USART Tx as alternate function push-pull */
    GPIO_InitStructure.GPIO_Pin =GPIO_Pin_9;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOA, &GPIO_InitStructure);

    //  /* Configure USART Rx as input floating */
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
    GPIO_Init(GPIOA, &GPIO_InitStructure);
    USART_DeInit(USART1);//复位USART1
    USART_InitStructure.USART_BaudRate = BaudRate;
    USART_InitStructure.USART_WordLength = USART_WordLength_8b;
    USART_InitStructure.USART_StopBits = USART_StopBits_1;
    USART_InitStructure.USART_Parity = USART_Parity_No;
    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
    USART_InitStructure.USART_Mode =   USART_Mode_Tx|USART_Mode_Rx;

    /* USART configuration */
    USART_Init(USART1, &USART_InitStructure);
    USART_ITConfig(USART1, USART_IT_RXNE, ENABLE); //接收中断使能

    /* Enable USART */
    USART_Cmd(USART1, ENABLE);
}
开发者ID:Derrick1024,项目名称:Q_WASH,代码行数:33,代码来源:hmi_user_uart.c

示例9: consoleInit

//
// Put any initialization code here
//
void consoleInit() {
	USART_InitTypeDef usartStruct;
	galvoInit();

	// Init Laser (as GPIO OUTPUT)
	RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
	GPIO_Init(GPIOD, &(GPIO_InitTypeDef){GPIO_Pin_8, GPIO_Mode_OUT, GPIO_OType_PP, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL});
	GPIO_ResetBits(GPIOD, GPIO_Pin_8);

	// Init Serial
	// But don't set AF for pin until we turn the laser 'on'
	
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
	RCC_APB1PeriphClockLPModeCmd(RCC_APB1Periph_USART3, ENABLE);

	GPIO_PinAFConfig(GPIOD, GPIO_PinSource8 ,GPIO_AF_USART3);

	USART_DeInit(USART3);
	USART_StructInit(&usartStruct);

	usartStruct.USART_BaudRate = 4800;
	usartStruct.USART_Mode = USART_Mode_Tx;

	USART_Init(USART3, &usartStruct);

	USART_Cmd(USART3, ENABLE);
}
开发者ID:alvarop,项目名称:laserturret,代码行数:30,代码来源:console.c

示例10: while

ElectronSerialPipe::~ElectronSerialPipe(void)
{
    // wait for transmission of outgoing data
    while (_pipeTx.readable())
    {
        char c = _pipeTx.getc();
        USART_SendData(USART3, c);
    }

    // Disable the USART
    USART_Cmd(USART3, DISABLE);

    // Deinitialise USART
    USART_DeInit(USART3);

    // Disable USART Receive and Transmit interrupts
    USART_ITConfig(USART3, USART_IT_RXNE, DISABLE);
    USART_ITConfig(USART3, USART_IT_TXE, DISABLE);

    NVIC_InitTypeDef NVIC_InitStructure;

    // Disable the USART Interrupt
    NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelCmd = DISABLE;

    NVIC_Init(&NVIC_InitStructure);

    // Disable USART Clock
    RCC->APB1ENR &= ~RCC_APB1Periph_USART3;

    // clear any received data
    // ... should be handled with ~Pipe deconstructor
}
开发者ID:geekbozu,项目名称:firmware,代码行数:33,代码来源:electronserialpipe_hal.cpp

示例11: BspUsart1Init

void BspUsart1Init(void)
{
    GPIO_InitTypeDef GpioInitdef;
    USART_InitTypeDef UsartInitdef;

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_USART1, ENABLE);  

    GpioInitdef.GPIO_Pin = GPIO_Pin_9; //
    GpioInitdef.GPIO_Speed = GPIO_Speed_10MHz;
    GpioInitdef.GPIO_Mode = GPIO_Mode_AF_PP;
    GPIO_Init(GPIOA, &GpioInitdef);

    GpioInitdef.GPIO_Pin = GPIO_Pin_10; //
    GpioInitdef.GPIO_Speed = GPIO_Speed_10MHz;
    GpioInitdef.GPIO_Mode = GPIO_Mode_IN_FLOATING;
    GPIO_Init(GPIOA, &GpioInitdef);    

    USART_DeInit(USART1);

    USART_StructInit(&UsartInitdef);
    UsartInitdef.USART_BaudRate = 115200;
    UsartInitdef.USART_StopBits = USART_StopBits_1;
    UsartInitdef.USART_WordLength = USART_WordLength_8b;
    UsartInitdef.USART_Parity = USART_Parity_No;

    UsartInitdef.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
    USART_Init(USART1, &UsartInitdef);

    USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
    USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);

    USART_Cmd(USART1, ENABLE);
}
开发者ID:Niyunfeng,项目名称:stm32f103_bootloader,代码行数:33,代码来源:uart.c

示例12: usart1_init

void usart1_init()
{
	//GPIO端口设置
	GPIO_InitTypeDef GPIO_InitStructure;
	USART_InitTypeDef USART_InitStructure;

	RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1|RCC_APB2Periph_GPIOA, ENABLE);	//使能USART1,GPIOA时钟
	USART_DeInit(USART1);  //复位串口1
	//USART1_TX   PA.9
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; //PA.9
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;	//复用推挽输出
	GPIO_Init(GPIOA, &GPIO_InitStructure); //初始化PA9

	//USART1_RX	  PA.10
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;//浮空输入
	GPIO_Init(GPIOA, &GPIO_InitStructure);  //初始化PA10

	//USART 初始化设置
	USART_InitStructure.USART_BaudRate = 9600;//一般设置为9600;
	USART_InitStructure.USART_WordLength = USART_WordLength_8b;//字长为8位数据格式
	USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
	USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
	USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
	USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;	//收发模式

	USART_Init(USART1, &USART_InitStructure); //初始化串口
	USART_Cmd(USART1, ENABLE);                    //使能串口 
}
开发者ID:jinshuhuai,项目名称:nRF24L01,代码行数:30,代码来源:spi.c

示例13: UART_Config

/**
 * Initialize a USART based on the passed configuration structure
 */
void UART_Config(CONFIG_USART_ConfigState *cfg) {
	USART_InitTypeDef USART_InitStructure;

	FIFO_InitStruct(cfg->rx_fifo, cfg->rx_buf, cfg->rx_buf_size);

	// turn on peripheral clocks
	RCC_AHBPeriphClockCmd(cfg->ahb1, ENABLE);
	RCC_APB1PeriphClockCmd(cfg->apb1, ENABLE);
	RCC_APB2PeriphClockCmd(cfg->apb2, ENABLE);

	// configure pins
	CONFIG_pins(cfg->pins, cfg->num_pins);

	// configure USART
	USART_DeInit(cfg->USARTx);
	USART_InitStructure.USART_BaudRate = cfg->baud;
    USART_InitStructure.USART_WordLength = USART_WordLength_8b;
    USART_InitStructure.USART_StopBits = USART_StopBits_1;
    USART_InitStructure.USART_Parity = USART_Parity_No;
    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
    USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
	USART_Init(cfg->USARTx, &USART_InitStructure);

	// enable RX interrupt
	//USART_ITConfig(cfg->USARTx, USART_IT_RXNE, ENABLE);

	// enable the USART
	USART_Cmd(cfg->USARTx, ENABLE);
	cfg->configured = true;
	cfg->configured = true;
	cfg->configured = true;
	cfg->configured = true;
}
开发者ID:2thetop,项目名称:anypixel,代码行数:36,代码来源:uart.c

示例14: uart1_init

void uart1_init(void)
{
    USART_DeInit(USART1);

		//Tx
  	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
		GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  	GPIO_Init(GPIOA, &GPIO_InitStructure);
	
		//Rx
  	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
  	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  	GPIO_Init(GPIOA, &GPIO_InitStructure);


    USART_InitStructure.USART_BaudRate = 115200;
    USART_InitStructure.USART_WordLength = USART_WordLength_8b;
    USART_InitStructure.USART_StopBits = USART_StopBits_1;
    USART_InitStructure.USART_Parity = USART_Parity_No;
		USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
		USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
    
		USART_Init(USART1,&USART_InitStructure);
		USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
		//USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
		USART_Cmd(USART1, ENABLE);
}
开发者ID:GaoMjun,项目名称:balancer,代码行数:28,代码来源:uart1.c

示例15: USART_Configuration

void USART_Configuration(USART_TypeDef* USART,u32 bps,u16 databit,u16 paritybit)
{
	USART_InitTypeDef USART_InitStructure;
	USART_ClockInitTypeDef USART_ClockInitStructure;
	
	USART_DeInit(USART);
 	if(USART==USART1)RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
	if(USART==USART2)RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
	if(USART==USART3)RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);

	USART_InitStructure.USART_BaudRate            = bps;
	USART_InitStructure.USART_WordLength          = databit;
	USART_InitStructure.USART_StopBits            = USART_StopBits_1;
	USART_InitStructure.USART_Parity              = paritybit ;
	
	USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
	USART_InitStructure.USART_Mode                = USART_Mode_Rx | USART_Mode_Tx;
	
	USART_ClockInitStructure.USART_Clock          = USART_Clock_Disable;
	USART_ClockInitStructure.USART_CPOL           = USART_CPOL_High;
	USART_ClockInitStructure.USART_CPHA           = USART_CPHA_2Edge;
	USART_ClockInitStructure.USART_LastBit        = USART_LastBit_Disable;
	
	USART_Init(USART, &USART_InitStructure);
	USART_ClockInit(USART, &USART_ClockInitStructure);
	if(USART==USART1){
		USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
		NVIC_Configuration(USART1_IRQChannel,0);
	}
	USART_Cmd(USART, ENABLE);
}
开发者ID:bg8wj,项目名称:icar-firmware,代码行数:31,代码来源:init.c


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