亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? stm32f10x_usart.c

?? STM32不完全手冊 例程源碼 29個
?? C
?? 第 1 頁 / 共 3 頁
字號:
* Description    : Enables or disables the specified USART interrupts.
* Input          : - USARTx: Select the USART or the UART peripheral. 
*                    This parameter can be one of the following values:
*                     - USART1, USART2, USART3, UART4 or UART5.
*                  - USART_IT: specifies the USART interrupt sources to be
*                    enabled or disabled.
*                    This parameter can be one of the following values:
*                       - USART_IT_CTS:  CTS change interrupt (not available for
*                                        UART4 and UART5)
*                       - USART_IT_LBD:  LIN Break detection interrupt
*                       - USART_IT_TXE:  Tansmit Data Register empty interrupt
*                       - USART_IT_TC:   Transmission complete interrupt
*                       - USART_IT_RXNE: Receive Data register not empty 
*                                        interrupt
*                       - USART_IT_IDLE: Idle line detection interrupt
*                       - USART_IT_PE:   Parity Error interrupt
*                       - USART_IT_ERR:  Error interrupt(Frame error, noise
*                                        error, overrun error)
*                  - NewState: new state of the specified USARTx interrupts.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void USART_ITConfig(USART_TypeDef* USARTx, u16 USART_IT, FunctionalState NewState)
{
  u32 usartreg = 0x00, itpos = 0x00, itmask = 0x00;
  u32 usartxbase = 0x00;

  /* Check the parameters */
  assert_param(IS_USART_ALL_PERIPH(USARTx));
  assert_param(IS_USART_CONFIG_IT(USART_IT));
  assert_param(IS_USART_PERIPH_IT(USARTx, USART_IT)); /* The CTS interrupt is not available for UART4 and UART5 */     
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  usartxbase = (*(u32*)&(USARTx));

  /* Get the USART register index */
  usartreg = (((u8)USART_IT) >> 0x05);

  /* Get the interrupt position */
  itpos = USART_IT & IT_Mask;

  itmask = (((u32)0x01) << itpos);
    
  if (usartreg == 0x01) /* The IT is in CR1 register */
  {
    usartxbase += 0x0C;
  }
  else if (usartreg == 0x02) /* The IT is in CR2 register */
  {
    usartxbase += 0x10;
  }
  else /* The IT is in CR3 register */
  {
    usartxbase += 0x14; 
  }
  if (NewState != DISABLE)
  {
    *(vu32*)usartxbase  |= itmask;
  }
  else
  {
    *(vu32*)usartxbase &= ~itmask;
  }
}

/*******************************************************************************
* Function Name  : USART_DMACmd
* Description    : Enables or disables the USART抯 DMA interface.
* Input          : - USARTx: Select the USART or the UART peripheral. 
*                    This parameter can be one of the following values:
*                     - USART1, USART2, USART3 or UART4.
*                    Note: The DMA mode is not available for UART5.
*                  - USART_DMAReq: specifies the DMA request.
*                    This parameter can be any combination of the following values:
*                       - USART_DMAReq_Tx: USART DMA transmit request
*                       - USART_DMAReq_Rx: USART DMA receive request
*                  - NewState: new state of the DMA Request sources.
*                   This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void USART_DMACmd(USART_TypeDef* USARTx, u16 USART_DMAReq, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_USART_1234_PERIPH(USARTx));
  assert_param(IS_USART_DMAREQ(USART_DMAReq));  
  assert_param(IS_FUNCTIONAL_STATE(NewState)); 

  if (NewState != DISABLE)
  {
    /* Enable the DMA transfer for selected requests by setting the DMAT and/or
       DMAR bits in the USART CR3 register */
    USARTx->CR3 |= USART_DMAReq;
  }
  else
  {
    /* Disable the DMA transfer for selected requests by clearing the DMAT and/or
       DMAR bits in the USART CR3 register */
    USARTx->CR3 &= (u16)~USART_DMAReq;
  }
}

/*******************************************************************************
* Function Name  : USART_SetAddress
* Description    : Sets the address of the USART node.
* Input          : - USARTx: Select the USART or the UART peripheral. 
*                    This parameter can be one of the following values:
*                     - USART1, USART2, USART3, UART4 or UART5.
*                  - USART_Address: Indicates the address of the USART node.
* Output         : None
* Return         : None
*******************************************************************************/
void USART_SetAddress(USART_TypeDef* USARTx, u8 USART_Address)
{
  /* Check the parameters */
  assert_param(IS_USART_ALL_PERIPH(USARTx));
  assert_param(IS_USART_ADDRESS(USART_Address)); 
    
  /* Clear the USART address */
  USARTx->CR2 &= CR2_Address_Mask;
  /* Set the USART address node */
  USARTx->CR2 |= USART_Address;
}

/*******************************************************************************
* Function Name  : USART_WakeUpConfig
* Description    : Selects the USART WakeUp method.
* Input          : - USARTx: Select the USART or the UART peripheral. 
*                    This parameter can be one of the following values:
*                     - USART1, USART2, USART3, UART4 or UART5.
*                  - USART_WakeUp: specifies the USART wakeup method.
*                    This parameter can be one of the following values:
*                        - USART_WakeUp_IdleLine: WakeUp by an idle line detection
*                        - USART_WakeUp_AddressMark: WakeUp by an address mark
* Output         : None
* Return         : None
*******************************************************************************/
void USART_WakeUpConfig(USART_TypeDef* USARTx, u16 USART_WakeUp)
{
  /* Check the parameters */
  assert_param(IS_USART_ALL_PERIPH(USARTx));
  assert_param(IS_USART_WAKEUP(USART_WakeUp));
  
  USARTx->CR1 &= CR1_WAKE_Mask;
  USARTx->CR1 |= USART_WakeUp;
}

/*******************************************************************************
* Function Name  : USART_ReceiverWakeUpCmd
* Description    : Determines if the USART is in mute mode or not.
* Input          : - USARTx: Select the USART or the UART peripheral. 
*                    This parameter can be one of the following values:
*                     - USART1, USART2, USART3, UART4 or UART5.
*                  - NewState: new state of the USART mute mode.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void USART_ReceiverWakeUpCmd(USART_TypeDef* USARTx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_USART_ALL_PERIPH(USARTx));
  assert_param(IS_FUNCTIONAL_STATE(NewState)); 
  
  if (NewState != DISABLE)
  {
    /* Enable the USART mute mode  by setting the RWU bit in the CR1 register */
    USARTx->CR1 |= CR1_RWU_Set;
  }
  else
  {
    /* Disable the USART mute mode by clearing the RWU bit in the CR1 register */
    USARTx->CR1 &= CR1_RWU_Reset;
  }
}

/*******************************************************************************
* Function Name  : USART_LINBreakDetectLengthConfig
* Description    : Sets the USART LIN Break detection length.
* Input          : - USARTx: Select the USART or the UART peripheral. 
*                    This parameter can be one of the following values:
*                     - USART1, USART2, USART3, UART4 or UART5.
*                  - USART_LINBreakDetectLength: specifies the LIN break
*                    detection length.
*                    This parameter can be one of the following values:
*                       - USART_LINBreakDetectLength_10b: 10-bit break detection
*                       - USART_LINBreakDetectLength_11b: 11-bit break detection
* Output         : None
* Return         : None
*******************************************************************************/
void USART_LINBreakDetectLengthConfig(USART_TypeDef* USARTx, u16 USART_LINBreakDetectLength)
{
  /* Check the parameters */
  assert_param(IS_USART_ALL_PERIPH(USARTx));
  assert_param(IS_USART_LIN_BREAK_DETECT_LENGTH(USART_LINBreakDetectLength));
  
  USARTx->CR2 &= CR2_LBDL_Mask;
  USARTx->CR2 |= USART_LINBreakDetectLength;  
}

/*******************************************************************************
* Function Name  : USART_LINCmd
* Description    : Enables or disables the USART抯 LIN mode.
* Input          : - USARTx: Select the USART or the UART peripheral. 
*                    This parameter can be one of the following values:
*                     - USART1, USART2, USART3, UART4 or UART5.
*                  - NewState: new state of the USART LIN mode.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void USART_LINCmd(USART_TypeDef* USARTx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_USART_ALL_PERIPH(USARTx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));
  
  if (NewState != DISABLE)
  {
    /* Enable the LIN mode by setting the LINEN bit in the CR2 register */
    USARTx->CR2 |= CR2_LINEN_Set;
  }
  else
  {
    /* Disable the LIN mode by clearing the LINEN bit in the CR2 register */
    USARTx->CR2 &= CR2_LINEN_Reset;
  }
}

/*******************************************************************************
* Function Name  : USART_SendData
* Description    : Transmits single data through the USARTx peripheral.
* Input          : - USARTx: Select the USART or the UART peripheral. 
*                    This parameter can be one of the following values:
*                     - USART1, USART2, USART3, UART4 or UART5.
*                  - Data: the data to transmit.
* Output         : None
* Return         : None
*******************************************************************************/
void USART_SendData(USART_TypeDef* USARTx, u16 Data)
{
  /* Check the parameters */
  assert_param(IS_USART_ALL_PERIPH(USARTx));
  assert_param(IS_USART_DATA(Data)); 
    
  /* Transmit Data */
  USARTx->DR = (Data & (u16)0x01FF);
}

/*******************************************************************************
* Function Name  : USART_ReceiveData
* Description    : Returns the most recent received data by the USARTx peripheral.
* Input          : - USARTx: Select the USART or the UART peripheral. 
*                    This parameter can be one of the following values:
*                     - USART1, USART2, USART3, UART4 or UART5.
* Output         : None
* Return         : The received data.
*******************************************************************************/
u16 USART_ReceiveData(USART_TypeDef* USARTx)
{
  /* Check the parameters */
  assert_param(IS_USART_ALL_PERIPH(USARTx));
  
  /* Receive Data */
  return (u16)(USARTx->DR & (u16)0x01FF);
}

/*******************************************************************************
* Function Name  : USART_SendBreak
* Description    : Transmits break characters.
* Input          : - USARTx: Select the USART or the UART peripheral. 
*                    This parameter can be one of the following values:
*                     - USART1, USART2, USART3, UART4 or UART5.
* Output         : None
* Return         : None
*******************************************************************************/
void USART_SendBreak(USART_TypeDef* USARTx)
{
  /* Check the parameters */
  assert_param(IS_USART_ALL_PERIPH(USARTx));
  
  /* Send break characters */
  USARTx->CR1 |= CR1_SBK_Set;
}

/*******************************************************************************
* Function Name  : USART_SetGuardTime
* Description    : Sets the specified USART guard time.
* Input          : - USARTx: where x can be 1, 2 or 3 to select the USART
*                    peripheral.
*                  Note: The guard time bits are not available for UART4 and UART5.
*                  - USART_GuardTime: specifies the guard time.
* Output         : None
* Return         : None
*******************************************************************************/
void USART_SetGuardTime(USART_TypeDef* USARTx, u8 USART_GuardTime)
{    
  /* Check the parameters */
  assert_param(IS_USART_123_PERIPH(USARTx));
  
  /* Clear the USART Guard time */
  USARTx->GTPR &= GTPR_LSB_Mask;
  /* Set the USART guard time */
  USARTx->GTPR |= (u16)((u16)USART_GuardTime << 0x08);
}

/*******************************************************************************
* Function Name  : USART_SetPrescaler
* Description    : Sets the system clock prescaler.
* Input          : - USARTx: Select the USART or the UART peripheral. 
*                    This parameter can be one of the following values:
*                     - USART1, USART2, USART3, UART4 or UART5.
*                  Note: The function is used for IrDA mode with UART4 and UART5.
*                  - USART_Prescaler: specifies the prescaler clock.
* Output         : None
* Return         : None
*******************************************************************************/
void USART_SetPrescaler(USART_TypeDef* USARTx, u8 USART_Prescaler)
{ 
  /* Check the parameters */
  assert_param(IS_USART_ALL_PERIPH(USARTx));
  
  /* Clear the USART prescaler */
  USARTx->GTPR &= GTPR_MSB_Mask;
  /* Set the USART prescaler */
  USARTx->GTPR |= USART_Prescaler;
}

/*******************************************************************************

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合一个色综合亚洲| 成人网在线免费视频| 欧美性猛交xxxxxx富婆| 一区二区视频免费在线观看| 91久久香蕉国产日韩欧美9色| 亚洲最大的成人av| 欧美羞羞免费网站| 日韩中文字幕av电影| 日韩欧美国产综合| 国产在线一区二区| 国产精品美女久久久久久久| 在线免费观看日本一区| 亚洲成人av电影| www成人在线观看| 成人国产精品免费| 亚洲午夜久久久久久久久电影网 | 一本在线高清不卡dvd| 亚洲图片一区二区| 精品福利一区二区三区免费视频| 国产精品中文欧美| 亚洲激情男女视频| 日韩欧美专区在线| 成人激情开心网| 亚洲一区二区高清| 久久网这里都是精品| 色欧美88888久久久久久影院| 婷婷六月综合网| 国产欧美一区二区三区网站| 91精品1区2区| 国产一区二区免费看| 一区二区三区91| 久久蜜臀精品av| 欧美日韩国产美女| 懂色av一区二区三区免费看| 性久久久久久久久| 中文字幕乱码亚洲精品一区| 欧美精品日日鲁夜夜添| 国产福利精品导航| 天天综合天天综合色| 亚洲欧美综合网| 欧美成人精品福利| 在线精品视频小说1| 国产麻豆精品在线观看| 天天操天天色综合| 国产精品久久三区| 精品日韩99亚洲| 欧美性猛交一区二区三区精品| 高清国产午夜精品久久久久久| 日韩国产欧美在线播放| 亚洲视频 欧洲视频| 2024国产精品视频| 欧美一区中文字幕| 欧美视频三区在线播放| 成人国产精品免费观看| 国内精品第一页| 日韩vs国产vs欧美| 亚洲国产成人高清精品| 18涩涩午夜精品.www| 久久久久久久久97黄色工厂| 日韩一级片在线观看| 欧美福利电影网| 色av成人天堂桃色av| 91老师片黄在线观看| 成人激情视频网站| 国产91精品精华液一区二区三区 | 欧美色综合网站| 91丨九色丨蝌蚪丨老版| 国产成人综合视频| 久久69国产一区二区蜜臀| 热久久久久久久| 美女在线视频一区| 日韩精品欧美精品| 亚洲第一av色| 亚洲成av人**亚洲成av**| 一区二区成人在线观看| 伊人婷婷欧美激情| 一区二区三区在线观看国产| 一区二区三区日韩欧美精品| 亚洲伦理在线免费看| 亚洲色图欧美在线| 亚洲品质自拍视频网站| 一区二区三区在线免费播放| 亚洲综合成人网| 午夜日韩在线电影| 天天色天天操综合| 蜜臀av一区二区在线观看| 麻豆国产91在线播放| 狠狠色丁香婷婷综合| 国产成人综合网| 91亚洲国产成人精品一区二区三| 色婷婷av一区二区三区gif| 在线观看国产日韩| 51精品秘密在线观看| 日韩午夜电影在线观看| 久久久不卡网国产精品一区| 国产亚洲成aⅴ人片在线观看| 国产精品拍天天在线| 亚洲欧美一区二区三区久本道91| 亚洲成在人线免费| 久久99精品国产91久久来源| 成人免费看黄yyy456| 91美女视频网站| 91精品国产综合久久精品图片| 欧美zozo另类异族| 中文字幕欧美日本乱码一线二线| 一区二区三区色| 久久福利视频一区二区| 国产精品18久久久久久久久| 91一区二区在线观看| 欧美一区二区视频在线观看| 久久久久九九视频| 亚洲一区视频在线观看视频| 久久精品国产精品亚洲红杏| av午夜精品一区二区三区| 欧美日韩国产成人在线91| www欧美成人18+| 一区二区三区在线免费播放| 狠狠色狠狠色合久久伊人| 99re热这里只有精品视频| 91精品国产入口在线| 中文一区二区完整视频在线观看| 午夜视频在线观看一区二区| 国产成人aaaa| 8v天堂国产在线一区二区| 久久久精品国产免费观看同学| 一区二区三区日韩精品视频| 国产乱妇无码大片在线观看| 欧美视频三区在线播放| 国产视频一区二区在线| 五月激情六月综合| 成人理论电影网| 日韩写真欧美这视频| 亚洲资源中文字幕| 不卡一卡二卡三乱码免费网站| 4438x亚洲最大成人网| 亚洲欧美日韩精品久久久久| 狠狠色狠狠色合久久伊人| 欧美年轻男男videosbes| 亚洲欧洲成人av每日更新| 麻豆91在线观看| 欧美日韩免费高清一区色橹橹| 中文字幕亚洲一区二区av在线| 精品一区二区免费| 欧美人牲a欧美精品| 依依成人综合视频| 成人av网址在线| 久久精品亚洲精品国产欧美| 免费成人在线观看| 欧美日韩在线免费视频| 综合av第一页| 成人精品gif动图一区| 26uuu另类欧美亚洲曰本| 美女视频网站黄色亚洲| 欧美视频一区在线| 亚洲精品伦理在线| 成人黄色777网| 国产精品网曝门| 国产传媒欧美日韩成人| 日韩欧美一级在线播放| 日本午夜精品视频在线观看| 欧美久久婷婷综合色| 亚洲一区欧美一区| 欧美在线观看一区| 亚洲综合一区二区三区| 97久久精品人人爽人人爽蜜臀| 国产精品日产欧美久久久久| 国产不卡高清在线观看视频| 国产午夜精品在线观看| 国产伦精品一区二区三区免费 | 国产91色综合久久免费分享| 久久精品亚洲精品国产欧美kt∨| 寂寞少妇一区二区三区| www久久精品| 国产丶欧美丶日本不卡视频| 亚洲国产精品二十页| av不卡一区二区三区| 成人免费在线播放视频| 色婷婷精品久久二区二区蜜臀av| 亚洲永久免费视频| 欧美日韩aaaaa| 日本午夜一区二区| 久久亚洲精华国产精华液| 国产成人亚洲综合a∨猫咪| 国产精品拍天天在线| 91首页免费视频| 亚洲一区二区三区国产| 欧美一区二区三区在线观看| 国内久久精品视频| 国产欧美一区二区精品婷婷| 色哟哟国产精品| 日韩在线卡一卡二| 精品电影一区二区| av资源网一区| 亚洲国产欧美在线人成| 日韩一级免费观看| 成人性生交大片免费看在线播放| 亚洲精品va在线观看| 日韩视频在线永久播放| 成人福利在线看| 亚洲成人免费在线|