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

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

?? uart.c

?? ST的片子,ARM7,一個(gè)基于USB的應(yīng)用,是個(gè)全的文件,IAR開發(fā)環(huán)境
?? C
字號(hào):
/******************** (C) COPYRIGHT 2003 STMicroelectronics ********************
* File Name          : uart.c
* Author             : MCD Application Team
* Date First Issued  : 08/06/2003
* Description        : This file provides all the UART software functions
********************************************************************************
* History:
*  08/06/2003 : Created
*******************************************************************************/

#include "uart.h"

/*******************************************************************************
* Function Name  : UART_Init
* Description    : This function initializes the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Output         : None
* Return         : None
*******************************************************************************/
void UART_Init(UART_TypeDef *UARTx)
{
  UARTx->IER = 0x00;
  UARTx->CR = 0x00;
  (void)UARTx->RBR;
  UARTx->RRR = 0xFFFF;
  UARTx->TRR = 0xFFFF;
}

/*******************************************************************************
* Function Name  : UART_BaudRateConfig
* Description    : This function configures the baud rate of the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : The baudrate value
* Output         : None
* Return         : None
*******************************************************************************/
void UART_BaudRateConfig(UART_TypeDef *UARTx, u32 BaudRate)
{
  UARTx->BRR = (u16)(RCCU_FrequencyValue(RCCU_FCLK)/(16*BaudRate));
}

/*******************************************************************************
* Function Name  : UART_Config
* Description    : This function configures the baudrate, the mode, the data
*                  parity and the number of stop bits of the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : The baudrate value
* Input 3        : The parity type
* Input 4        : The number of stop bits
* Input 5        : The UART mode
* Output         : None
* Return         : None
*******************************************************************************/
void UART_Config(UART_TypeDef *UARTx, u32 BaudRate, UARTParity_TypeDef Parity,
                 UARTStopBits_TypeDef StopBits, UARTMode_TypeDef Mode)
{
  UART_ModeConfig(UARTx, Mode);
  UART_BaudRateConfig(UARTx, BaudRate);
  UART_ParityConfig(UARTx, Parity);
  UART_StopBitsConfig(UARTx, StopBits);
}

/*******************************************************************************
* Function Name  : UART_ItConfig
* Description    : This function enables or disables the interrupts of the
*                  selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : The new interrupt flag
* Input 3        : ENABLE or DISABLE
* Output         : None
* Return         : None
*******************************************************************************/
void UART_ItConfig(UART_TypeDef *UARTx, u16 UART_Flag, functionalstate NewStatus)
{
  if (NewStatus==ENABLE) UARTx->IER|=UART_Flag; else UARTx->IER&=~UART_Flag;
}

/*******************************************************************************
* Function Name  : UART_FifoConfig
* Description    : This function enables or disables the Rx and Tx FIFOs of
*                  the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : ENABLE or DISABLE
* Output         : None
* Return         : None
*******************************************************************************/
void UART_FifoConfig(UART_TypeDef *UARTx, functionalstate NewStatus)
{
  if (NewStatus==ENABLE) UARTx->CR|=0x0400; else UARTx->CR&=~0x0400;
}

/*******************************************************************************
* Function Name  : UART_FifoReset
* Description    : This function resets the Rx and the Tx FIFOs of the
*                  selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : UART_RxFIFO or UART_TxFIFO
* Output         : None
* Return         : None
*******************************************************************************/
void UART_FifoReset(UART_TypeDef *UARTx, UARTFIFO_TypeDef FIFO)
{
  if (FIFO==UART_RxFIFO) UARTx->RRR=0xFFFF; else UARTx->TRR=0xFFFF;
}

/*******************************************************************************
* Function Name  : UART_LoopBackConfig
* Description    : This function enables or disables the loop back mode of
*                  the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : ENABLE or DISABLE
* Output         : None
* Return         : None
*******************************************************************************/
void UART_LoopBackConfig(UART_TypeDef *UARTx, functionalstate NewStatus)
{
  if (NewStatus==ENABLE) UARTx->CR|=0x0040; else UARTx->CR&=~0x0040;
}

/*******************************************************************************
* Function Name  : UART_RxConfig
* Description    : This function enables or disables the UART data reception.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : ENABLE or DISABLE
* Output         : None
* Return         : None
*******************************************************************************/
void UART_RxConfig(UART_TypeDef *UARTx, functionalstate NewStatus)
{
  if (NewStatus==ENABLE) UARTx->CR|=0x0100; else UARTx->CR&=~0x0100;
}

/*******************************************************************************
* Function Name  : UART_OnOffConfig
* Description    : This function sets On/Off the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : ENABLE or DISABLE
* Output         : None
* Return         : None
*******************************************************************************/
void UART_OnOffConfig(UART_TypeDef *UARTx, functionalstate NewStatus)
{
  if (NewStatus==ENABLE) UARTx->CR|=0x0080; else UARTx->CR&=~0x0080;
}

/*******************************************************************************
* Function Name  : UART_ByteSend
* Description    : This function sends a data byte to the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : A pointer to the data byte to send
* Output         : None
* Return         : None
*******************************************************************************/
void UART_ByteSend(UART_TypeDef *UARTx, u8 *Data)
{
  if (UARTx->CR & (0x0001<<UART_FIFOEnableBit))// if FIFO ENABLED
    while((UARTx->SR & UART_TxFull)); // while the UART_TxFIFO contain 16 characters.
  else                  // if FIFO DISABLED
    while (!(UARTx->SR & UART_TxEmpty)); // while the transmit shift register not empty
  UARTx->TBR = *Data;
}

/*******************************************************************************
* Function Name  : UART_9BitByteSend
* Description    : This function sends a 9 bits data byte to the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : A pointer to the data to send
* Output         : None
* Return         : None
*******************************************************************************/
void UART_9BitByteSend(UART_TypeDef *UARTx, u16 *Data)
{
  if(UARTx->CR & (0x0001<<UART_FIFOEnableBit))// if FIFO ENABLED
    while((UARTx->SR & UART_TxFull)); // while the UART_TxFIFO contain 16 characters.
  else                  // if FIFO DISABLED
    while (!(UARTx->SR & UART_TxEmpty)); // while the transmit shift register not empty
  UARTx->TBR = *Data;
}

/*******************************************************************************
* Function Name  : UART_DataSend
* Description    : This function sends several data bytes to the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : A pointer to the data to send
* Input 3        : The data length in bytes
* Output         : None
* Return         : None
*******************************************************************************/
void UART_DataSend(UART_TypeDef *UARTx, u8 *Data, u8 DataLength)
{
  while(DataLength--)
  {
    UART_ByteSend(UARTx,Data);
    Data++;
  }
}

/*******************************************************************************
* Function Name  : UART_9BitDataSend
* Description    : This function sends several 9 bits data bytes to the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : A pointer to the data to send
* Input 3        : The data length
* Output         : None
* Return         : None
*******************************************************************************/
void UART_9BitDataSend(UART_TypeDef *UARTx, u16 *Data, u8 DataLength)
{
  while(DataLength--)
  {
    UART_9BitByteSend(UARTx,Data);
    Data++;
  }
}

/*******************************************************************************
* Function Name  : UART_StringSend
* Description    : This function sends a string to the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : A pointer to the string to send
* Output         : None
* Return         : None
*******************************************************************************/
void UART_StringSend(UART_TypeDef *UARTx, u8 *String)
{
  u8 *Data=String;
  while(*Data != '\0')
    UART_ByteSend(UARTx, Data++);
  *Data='\0';
  UART_ByteSend(UARTx, Data);
}

/*******************************************************************************
* Function Name  : UART_ByteReceive
* Description    : This function gets a data byte from the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : A pointer to the buffer where the data will be stored
* Input 3        : The time-out period
* Output         : The received data
* Return         : The UARTx.SR register contents
*******************************************************************************/
u16 UART_ByteReceive(UART_TypeDef *UARTx, u8 *Data, u8 TimeOut)
{
   u16 wStatus;
   UARTx->TOR=TimeOut;// reload the Timeout counter
   while (!((wStatus=UARTx->SR) & (UART_TimeOutIdle|UART_RxHalfFull|UART_RxBufFull)));// while the UART_RxFIFO is empty and no Timeoutidle
   *Data = (u8)UARTx->RBR; // then read the Receive Buffer Register
   return wStatus;
}

/*******************************************************************************
* Function Name  : UART_9BitByteReceive
* Description    : This function gets a 9 bits data byte from the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : A pointer to the buffer where the data will be stored
* Input 3        : The time-out period value
* Output         : The received data
* Return         : The UARTx.SR register contents
*******************************************************************************/
u16 UART_9BitByteReceive(UART_TypeDef *UARTx, u16 *Data, u8 TimeOut)
{
  u16 wStatus;
  UARTx->TOR=TimeOut;// reload the Timeout counter
  while (!((wStatus=UARTx->SR) & (UART_TimeOutIdle|UART_RxHalfFull|UART_RxBufFull)));// while the UART_RxFIFO is empty and no Timeoutidle
  *Data = (u16)UARTx->RBR; // then read the RBR
  return wStatus;
}

/*******************************************************************************
* Function Name  : UART_DataReceive
* Description    : This function gets 8 bits data bytes from the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : A pointer to the buffer where the data will be stored
* Input 3        : The data length
* Input 4        : The time-out period value
* Output         : The received data
* Return         : The UARTx.SR register contents
*******************************************************************************/
u16 UART_DataReceive(UART_TypeDef *UARTx, u8 *Data, u8 DataLength, u8 TimeOut)
{
  u16 wStatus;
  while(DataLength--)
    wStatus=UART_ByteReceive(UARTx,Data++,TimeOut);
  return wStatus;
}

/*******************************************************************************
* Function Name  : UART_9BitDataReceive
* Description    : This function gets 9 bits data bytes from the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : A pointer to the buffer where the data will be stored
* Input 3        : The data length
* Input 4        : The time-out value
* Output         : The received data
* Return         : The UARTx.SR register contents
*******************************************************************************/
u16 UART_9BitDataReceive(UART_TypeDef *UARTx, u16 *Data, u8 DataLength, u8 TimeOut)
{
  u16 wStatus;
  while(DataLength--)
    wStatus=UART_9BitByteReceive(UARTx,Data++,TimeOut);
  return wStatus;
}

/*******************************************************************************
* Function Name  : UART_StringReceive
* Description    : This function gets 8 bits data bytes from the selected UART.
* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART
* Input 2        : A pointer to the buffer where the string will be stored
* Output         : The received string
* Return         : The UARTx.SR register contents
*******************************************************************************/
u16 UART_StringReceive(UART_TypeDef *UARTx, u8 *Data)
{
  u8 *pSTRING=Data;
  u16 wStatus;
  do
  {
    while (!((wStatus=UARTx->SR) & (UART_RxHalfFull|UART_RxBufFull)));// while the UART_RxFIFO is empty and no Timeoutidle
    *(pSTRING++) = (u8)UARTx->RBR; // then read the RBR
  } while((*(pSTRING - 1)!=0x0D)&(*(pSTRING - 1)!='\0'));
  *(pSTRING - 1)='\0';
  return wStatus;
}

#ifdef USE_SERIAL_PORT
/*******************************************************************************
* Function Name  : sendchar
* Description    : This function sends a character to the selected UART.
* Input 1        : A pointer to the character to send.
* Output         : None
* Return         : None
*******************************************************************************/
void sendchar( char *ch )
{
   #ifdef USE_UART0
     #define  UARTx  UART0
   #endif /* Use_UART0 */

   #ifdef USE_UART1
     #define  UARTx  UART1
   #endif /* Use_UART1 */

   #ifdef USE_UART2
     #define  UARTx  UART2
   #endif /* Use_UART2 */

   #ifdef USE_UART3
     #define  UARTx  UART3
   #endif /* Use_UART3 */

   UART_ByteSend(UARTx,(u8 *)ch);
}
#endif /* USE_SERIAL_PORT */

/******************* (C) COPYRIGHT 2003 STMicroelectronics *****END OF FILE****/

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
eeuss鲁片一区二区三区在线观看| 国产乱国产乱300精品| 国产精品乱码妇女bbbb| 大尺度一区二区| 亚洲欧美日韩国产中文在线| 日韩一级片在线播放| 中文字幕av免费专区久久| 国产精品素人视频| 国产精品一二三四五| 日韩精品影音先锋| 欧美—级在线免费片| 制服视频三区第一页精品| 国产91精品在线观看| 日本欧美韩国一区三区| 国产老妇另类xxxxx| 狠狠色丁香久久婷婷综| 一区二区三区中文字幕电影 | 国产91丝袜在线播放0| 欧美日韩亚州综合| 久久国产精品72免费观看| 久久综合九色综合欧美就去吻| 成人性色生活片| 精品一区二区三区在线播放视频| 亚洲高清不卡在线| 国产蜜臀av在线一区二区三区| 69堂成人精品免费视频| 欧美日韩一区二区三区在线看 | 麻豆国产精品一区二区三区| 亚洲国产高清不卡| 欧美伦理视频网站| aa级大片欧美| 国产成人亚洲精品青草天美| 亚洲国产日韩a在线播放 | 亚洲国产成人一区二区三区| 91蝌蚪porny成人天涯| 亚洲欧美aⅴ...| 精品对白一区国产伦| 欧美日韩一卡二卡三卡 | 日韩精品一区二区三区在线播放| 日本不卡高清视频| 丝袜亚洲另类欧美综合| 一区二区三区在线免费观看 | 日本亚洲最大的色成网站www| 中文字幕巨乱亚洲| 26uuu亚洲综合色| 欧美一二三四区在线| 国产免费观看久久| 国产精品理伦片| 日韩无一区二区| 久久色在线视频| 亚洲天堂免费看| 免费在线欧美视频| caoporn国产精品| 欧美日韩1区2区| 久久久国产午夜精品| 夜夜嗨av一区二区三区网页| 国产一区二区三区四区在线观看| 91在线观看一区二区| 91精品国产综合久久精品图片| 国产欧美精品国产国产专区| 亚洲一区二区四区蜜桃| 国产老妇另类xxxxx| 欧美日韩一区二区三区四区五区| 欧美精品一区二区三区很污很色的| 国产精品久久久久影视| 美女诱惑一区二区| 色一情一乱一乱一91av| 精品国产一区二区三区av性色| 亚洲免费在线电影| 风间由美一区二区三区在线观看| 欧美精品一级二级三级| 亚洲三级小视频| 国产成人精品免费网站| 91麻豆精品国产91久久久资源速度| 国产精品视频在线看| 久久精品国产精品亚洲精品| 欧日韩精品视频| 国产精品久久精品日日| 老司机免费视频一区二区三区| 欧美性大战久久| 国产精品家庭影院| 国产传媒欧美日韩成人| 日韩欧美国产综合在线一区二区三区| 亚洲精品乱码久久久久久日本蜜臀| 国产精品香蕉一区二区三区| 777久久久精品| 亚洲电影你懂得| 91麻豆123| 中文字幕亚洲一区二区va在线| 精品一区二区免费看| 欧美日韩国产一级| 亚洲精品ww久久久久久p站| 大白屁股一区二区视频| 久久久久久久综合狠狠综合| 日韩精品成人一区二区三区| 欧美亚日韩国产aⅴ精品中极品| 国产精品久久久爽爽爽麻豆色哟哟| 国产精品一区在线| 久久色在线观看| 激情欧美一区二区| 91精品在线观看入口| 视频一区欧美精品| 欧美日韩国产一级| 天堂精品中文字幕在线| 欧美日本乱大交xxxxx| 日日夜夜精品免费视频| 欧美日韩国产欧美日美国产精品| 亚洲高清视频在线| 欧美日韩视频在线一区二区| 亚洲综合在线第一页| 欧美亚男人的天堂| 午夜视频一区在线观看| 欧美电影在线免费观看| 青草av.久久免费一区| 日韩一区二区在线看片| 裸体健美xxxx欧美裸体表演| 91精品国产乱| 久99久精品视频免费观看| 精品国产一区二区精华| 福利一区福利二区| 亚洲人成网站在线| 欧美性大战久久久久久久蜜臀 | 中文字幕免费不卡| 国产日韩精品一区二区浪潮av| www.日韩av| 成人免费小视频| 99久久精品情趣| 国产999精品久久| 丁香桃色午夜亚洲一区二区三区 | 91麻豆精品国产91久久久久久久久| 国产福利一区二区三区在线视频| 亚洲另类在线视频| 精品日韩在线观看| 色94色欧美sute亚洲线路一ni| 麻豆传媒一区二区三区| 亚洲精品乱码久久久久久久久| 日韩精品一区二区三区四区视频| 色综合久久综合网欧美综合网| 免费欧美在线视频| 亚洲精品大片www| 久久久综合精品| 欧美一级生活片| 色老头久久综合| 成人一区二区三区| 久国产精品韩国三级视频| 亚洲精品久久久蜜桃| 久久蜜桃av一区精品变态类天堂 | 亚洲一区二区三区自拍| 欧美经典一区二区三区| 91麻豆精品91久久久久久清纯| 99久久伊人精品| 激情综合网av| 亚洲18色成人| 亚洲人成在线播放网站岛国 | 丁香婷婷综合色啪| 精品综合免费视频观看| 亚洲成人在线网站| 中文字幕一区二区不卡| 久久久久99精品一区| 欧美一区二区三区在线电影| 91豆麻精品91久久久久久| 国产91对白在线观看九色| 美女www一区二区| 午夜伊人狠狠久久| 亚洲综合一区二区三区| 中文字幕日韩av资源站| 国产无人区一区二区三区| 日韩欧美电影在线| 5858s免费视频成人| 亚洲激情男女视频| 亚洲国产成人私人影院tom| 精品精品国产高清a毛片牛牛| 欧美另类一区二区三区| 欧美性xxxxxx少妇| 欧洲精品中文字幕| 91视频你懂的| av激情综合网| 99久久精品免费观看| 成人黄色电影在线| 成人黄色在线视频| 波多野结衣一区二区三区 | 国产精品久久99| 国产精品人成在线观看免费 | 成人av免费观看| 国产成人自拍网| 国产老女人精品毛片久久| 日韩伦理电影网| 日韩一区二区在线看片| 欧美亚洲一区三区| 激情亚洲综合在线| 狠狠色丁香久久婷婷综合丁香| 精品综合久久久久久8888| 国内成人免费视频| 国产激情一区二区三区桃花岛亚洲| 六月丁香婷婷久久| 国产在线播精品第三| 丁香婷婷综合五月| 99国产欧美另类久久久精品| 97久久精品人人做人人爽| 色婷婷久久99综合精品jk白丝|