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

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

?? stm32f10x_cec.c

?? 學(xué)習(xí)stm32定時器
?? C
字號:
/**
  ******************************************************************************
  * @file    stm32f10x_cec.c
  * @author  MCD Application Team
  * @version V3.5.0
  * @date    11-March-2011
  * @brief   This file provides all the CEC firmware functions.
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_cec.h"
#include "stm32f10x_rcc.h"

/** @addtogroup STM32F10x_StdPeriph_Driver
  * @{
  */

/** @defgroup CEC 
  * @brief CEC driver modules
  * @{
  */

/** @defgroup CEC_Private_TypesDefinitions
  * @{
  */

/**
  * @}
  */


/** @defgroup CEC_Private_Defines
  * @{
  */ 

/* ------------ CEC registers bit address in the alias region ----------- */
#define CEC_OFFSET                (CEC_BASE - PERIPH_BASE)

/* --- CFGR Register ---*/

/* Alias word address of PE bit */
#define CFGR_OFFSET                 (CEC_OFFSET + 0x00)
#define PE_BitNumber                0x00
#define CFGR_PE_BB                  (PERIPH_BB_BASE + (CFGR_OFFSET * 32) + (PE_BitNumber * 4))

/* Alias word address of IE bit */
#define IE_BitNumber                0x01
#define CFGR_IE_BB                  (PERIPH_BB_BASE + (CFGR_OFFSET * 32) + (IE_BitNumber * 4))

/* --- CSR Register ---*/

/* Alias word address of TSOM bit */
#define CSR_OFFSET                  (CEC_OFFSET + 0x10)
#define TSOM_BitNumber              0x00
#define CSR_TSOM_BB                 (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (TSOM_BitNumber * 4))

/* Alias word address of TEOM bit */
#define TEOM_BitNumber              0x01
#define CSR_TEOM_BB                 (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (TEOM_BitNumber * 4))
  
#define CFGR_CLEAR_Mask            (uint8_t)(0xF3)        /* CFGR register Mask */
#define FLAG_Mask                  ((uint32_t)0x00FFFFFF) /* CEC FLAG mask */
 
/**
  * @}
  */ 


/** @defgroup CEC_Private_Macros
  * @{
  */ 

/**
  * @}
  */ 


/** @defgroup CEC_Private_Variables
  * @{
  */ 

/**
  * @}
  */ 


/** @defgroup CEC_Private_FunctionPrototypes
  * @{
  */
 
/**
  * @}
  */ 


/** @defgroup CEC_Private_Functions
  * @{
  */ 

/**
  * @brief  Deinitializes the CEC peripheral registers to their default reset 
  *         values.
  * @param  None
  * @retval None
  */
void CEC_DeInit(void)
{
  /* Enable CEC reset state */
  RCC_APB1PeriphResetCmd(RCC_APB1Periph_CEC, ENABLE);  
  /* Release CEC from reset state */
  RCC_APB1PeriphResetCmd(RCC_APB1Periph_CEC, DISABLE); 
}


/**
  * @brief  Initializes the CEC peripheral according to the specified 
  *         parameters in the CEC_InitStruct.
  * @param  CEC_InitStruct: pointer to an CEC_InitTypeDef structure that
  *         contains the configuration information for the specified
  *         CEC peripheral.
  * @retval None
  */
void CEC_Init(CEC_InitTypeDef* CEC_InitStruct)
{
  uint16_t tmpreg = 0;
 
  /* Check the parameters */
  assert_param(IS_CEC_BIT_TIMING_ERROR_MODE(CEC_InitStruct->CEC_BitTimingMode)); 
  assert_param(IS_CEC_BIT_PERIOD_ERROR_MODE(CEC_InitStruct->CEC_BitPeriodMode));
     
  /*---------------------------- CEC CFGR Configuration -----------------*/
  /* Get the CEC CFGR value */
  tmpreg = CEC->CFGR;
  
  /* Clear BTEM and BPEM bits */
  tmpreg &= CFGR_CLEAR_Mask;
  
  /* Configure CEC: Bit Timing Error and Bit Period Error */
  tmpreg |= (uint16_t)(CEC_InitStruct->CEC_BitTimingMode | CEC_InitStruct->CEC_BitPeriodMode);

  /* Write to CEC CFGR  register*/
  CEC->CFGR = tmpreg;
  
}

/**
  * @brief  Enables or disables the specified CEC peripheral.
  * @param  NewState: new state of the CEC peripheral. 
  *     This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void CEC_Cmd(FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  *(__IO uint32_t *) CFGR_PE_BB = (uint32_t)NewState;

  if(NewState == DISABLE)
  {
    /* Wait until the PE bit is cleared by hardware (Idle Line detected) */
    while((CEC->CFGR & CEC_CFGR_PE) != (uint32_t)RESET)
    {
    }  
  }  
}

/**
  * @brief  Enables or disables the CEC interrupt.
  * @param  NewState: new state of the CEC interrupt.
  *   This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void CEC_ITConfig(FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  *(__IO uint32_t *) CFGR_IE_BB = (uint32_t)NewState;
}

/**
  * @brief  Defines the Own Address of the CEC device.
  * @param  CEC_OwnAddress: The CEC own address
  * @retval None
  */
void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress)
{
  /* Check the parameters */
  assert_param(IS_CEC_ADDRESS(CEC_OwnAddress));

  /* Set the CEC own address */
  CEC->OAR = CEC_OwnAddress;
}

/**
  * @brief  Sets the CEC prescaler value.
  * @param  CEC_Prescaler: CEC prescaler new value
  * @retval None
  */
void CEC_SetPrescaler(uint16_t CEC_Prescaler)
{
  /* Check the parameters */
  assert_param(IS_CEC_PRESCALER(CEC_Prescaler));

  /* Set the  Prescaler value*/
  CEC->PRES = CEC_Prescaler;
}

/**
  * @brief  Transmits single data through the CEC peripheral.
  * @param  Data: the data to transmit.
  * @retval None
  */
void CEC_SendDataByte(uint8_t Data)
{  
  /* Transmit Data */
  CEC->TXD = Data ;
}


/**
  * @brief  Returns the most recent received data by the CEC peripheral.
  * @param  None
  * @retval The received data.
  */
uint8_t CEC_ReceiveDataByte(void)
{
  /* Receive Data */
  return (uint8_t)(CEC->RXD);
}

/**
  * @brief  Starts a new message.
  * @param  None
  * @retval None
  */
void CEC_StartOfMessage(void)
{  
  /* Starts of new message */
  *(__IO uint32_t *) CSR_TSOM_BB = (uint32_t)0x1;
}

/**
  * @brief  Transmits message with or without an EOM bit.
  * @param  NewState: new state of the CEC Tx End Of Message. 
  *     This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void CEC_EndOfMessageCmd(FunctionalState NewState)
{   
  /* Check the parameters */
  assert_param(IS_FUNCTIONAL_STATE(NewState));
  
  /* The data byte will be transmitted with or without an EOM bit*/
  *(__IO uint32_t *) CSR_TEOM_BB = (uint32_t)NewState;
}

/**
  * @brief  Gets the CEC flag status
  * @param  CEC_FLAG: specifies the CEC flag to check. 
  *   This parameter can be one of the following values:
  *     @arg CEC_FLAG_BTE: Bit Timing Error
  *     @arg CEC_FLAG_BPE: Bit Period Error
  *     @arg CEC_FLAG_RBTFE: Rx Block Transfer Finished Error
  *     @arg CEC_FLAG_SBE: Start Bit Error
  *     @arg CEC_FLAG_ACKE: Block Acknowledge Error
  *     @arg CEC_FLAG_LINE: Line Error
  *     @arg CEC_FLAG_TBTFE: Tx Block Transfer Finished Error
  *     @arg CEC_FLAG_TEOM: Tx End Of Message 
  *     @arg CEC_FLAG_TERR: Tx Error
  *     @arg CEC_FLAG_TBTRF: Tx Byte Transfer Request or Block Transfer Finished
  *     @arg CEC_FLAG_RSOM: Rx Start Of Message
  *     @arg CEC_FLAG_REOM: Rx End Of Message
  *     @arg CEC_FLAG_RERR: Rx Error
  *     @arg CEC_FLAG_RBTF: Rx Byte/Block Transfer Finished
  * @retval The new state of CEC_FLAG (SET or RESET)
  */
FlagStatus CEC_GetFlagStatus(uint32_t CEC_FLAG) 
{
  FlagStatus bitstatus = RESET;
  uint32_t cecreg = 0, cecbase = 0;
  
  /* Check the parameters */
  assert_param(IS_CEC_GET_FLAG(CEC_FLAG));
 
  /* Get the CEC peripheral base address */
  cecbase = (uint32_t)(CEC_BASE);
  
  /* Read flag register index */
  cecreg = CEC_FLAG >> 28;
  
  /* Get bit[23:0] of the flag */
  CEC_FLAG &= FLAG_Mask;
  
  if(cecreg != 0)
  {
    /* Flag in CEC ESR Register */
    CEC_FLAG = (uint32_t)(CEC_FLAG >> 16);
    
    /* Get the CEC ESR register address */
    cecbase += 0xC;
  }
  else
  {
    /* Get the CEC CSR register address */
    cecbase += 0x10;
  }
  
  if(((*(__IO uint32_t *)cecbase) & CEC_FLAG) != (uint32_t)RESET)
  {
    /* CEC_FLAG is set */
    bitstatus = SET;
  }
  else
  {
    /* CEC_FLAG is reset */
    bitstatus = RESET;
  }
  
  /* Return the CEC_FLAG status */
  return  bitstatus;
}

/**
  * @brief  Clears the CEC's pending flags.
  * @param  CEC_FLAG: specifies the flag to clear. 
  *   This parameter can be any combination of the following values:
  *     @arg CEC_FLAG_TERR: Tx Error
  *     @arg CEC_FLAG_TBTRF: Tx Byte Transfer Request or Block Transfer Finished
  *     @arg CEC_FLAG_RSOM: Rx Start Of Message
  *     @arg CEC_FLAG_REOM: Rx End Of Message
  *     @arg CEC_FLAG_RERR: Rx Error
  *     @arg CEC_FLAG_RBTF: Rx Byte/Block Transfer Finished
  * @retval None
  */
void CEC_ClearFlag(uint32_t CEC_FLAG)
{ 
  uint32_t tmp = 0x0;
  
  /* Check the parameters */
  assert_param(IS_CEC_CLEAR_FLAG(CEC_FLAG));

  tmp = CEC->CSR & 0x2;
       
  /* Clear the selected CEC flags */
  CEC->CSR &= (uint32_t)(((~(uint32_t)CEC_FLAG) & 0xFFFFFFFC) | tmp);
}

/**
  * @brief  Checks whether the specified CEC interrupt has occurred or not.
  * @param  CEC_IT: specifies the CEC interrupt source to check. 
  *   This parameter can be one of the following values:
  *     @arg CEC_IT_TERR: Tx Error
  *     @arg CEC_IT_TBTF: Tx Block Transfer Finished
  *     @arg CEC_IT_RERR: Rx Error
  *     @arg CEC_IT_RBTF: Rx Block Transfer Finished
  * @retval The new state of CEC_IT (SET or RESET).
  */
ITStatus CEC_GetITStatus(uint8_t CEC_IT)
{
  ITStatus bitstatus = RESET;
  uint32_t enablestatus = 0;
  
  /* Check the parameters */
   assert_param(IS_CEC_GET_IT(CEC_IT));
   
  /* Get the CEC IT enable bit status */
  enablestatus = (CEC->CFGR & (uint8_t)CEC_CFGR_IE) ;
  
  /* Check the status of the specified CEC interrupt */
  if (((CEC->CSR & CEC_IT) != (uint32_t)RESET) && enablestatus)
  {
    /* CEC_IT is set */
    bitstatus = SET;
  }
  else
  {
    /* CEC_IT is reset */
    bitstatus = RESET;
  }
  /* Return the CEC_IT status */
  return  bitstatus;
}

/**
  * @brief  Clears the CEC's interrupt pending bits.
  * @param  CEC_IT: specifies the CEC interrupt pending bit to clear.
  *   This parameter can be any combination of the following values:
  *     @arg CEC_IT_TERR: Tx Error
  *     @arg CEC_IT_TBTF: Tx Block Transfer Finished
  *     @arg CEC_IT_RERR: Rx Error
  *     @arg CEC_IT_RBTF: Rx Block Transfer Finished
  * @retval None
  */
void CEC_ClearITPendingBit(uint16_t CEC_IT)
{
  uint32_t tmp = 0x0;
  
  /* Check the parameters */
  assert_param(IS_CEC_GET_IT(CEC_IT));
  
  tmp = CEC->CSR & 0x2;
  
  /* Clear the selected CEC interrupt pending bits */
  CEC->CSR &= (uint32_t)(((~(uint32_t)CEC_IT) & 0xFFFFFFFC) | tmp);
}

/**
  * @}
  */ 

/**
  * @}
  */ 

/**
  * @}
  */ 

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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美在线aaa| 日韩美女视频在线| 成人免费视频免费观看| 国产一区二区主播在线| 久久99精品国产麻豆婷婷| 韩国欧美一区二区| 国产伦精品一区二区三区视频青涩 | 亚洲欧美日韩系列| 亚洲欧美色一区| 亚洲第一福利一区| 琪琪一区二区三区| 韩国女主播一区二区三区| 国产精品亚洲午夜一区二区三区| 激情综合网激情| 国产成人在线影院| 91蜜桃网址入口| 欧美日韩免费在线视频| 884aa四虎影成人精品一区| 日韩手机在线导航| 国产三级精品视频| 亚洲黄色av一区| 奇米在线7777在线精品| 国产精品88av| 91精品办公室少妇高潮对白| 欧美日免费三级在线| 欧美va天堂va视频va在线| 亚洲国产精品精华液2区45| 亚洲免费av观看| 日韩精品成人一区二区在线| 国产一区二区三区最好精华液| 国产成人综合视频| 欧美色图在线观看| 国产喂奶挤奶一区二区三区| 亚洲欧美欧美一区二区三区| 日韩国产欧美在线观看| 成人精品鲁一区一区二区| 欧美在线视频全部完| 国产午夜一区二区三区| 亚洲精品五月天| 国内精品久久久久影院薰衣草 | 亚洲区小说区图片区qvod| 亚洲成人动漫一区| 丁香亚洲综合激情啪啪综合| 欧美日韩一区不卡| 中文一区二区完整视频在线观看| 亚洲午夜在线视频| 丁香啪啪综合成人亚洲小说| 91精品国产综合久久久久| 成人欧美一区二区三区白人| 青椒成人免费视频| 欧美撒尿777hd撒尿| 中文字幕在线免费不卡| 久久99久久99小草精品免视看| 久久成人羞羞网站| 欧美男女性生活在线直播观看| 国产人成亚洲第一网站在线播放| 男男视频亚洲欧美| 欧美性生活久久| 亚洲欧美在线视频| 国产suv精品一区二区6| 精品国产青草久久久久福利| 尤物av一区二区| 91网上在线视频| 国产精品福利在线播放| 国产成人8x视频一区二区| 精品欧美久久久| 青青草国产精品亚洲专区无| 欧美日韩国产一级| 亚洲在线视频免费观看| 欧美自拍偷拍一区| 一片黄亚洲嫩模| 91丨九色porny丨蝌蚪| 中文字幕在线观看一区| 成人av在线播放网站| 国产精品久久精品日日| 懂色av一区二区三区免费观看| 国产视频亚洲色图| 国产精品小仙女| 国产女同互慰高潮91漫画| 国产精品影视网| 国产精品天天看| 91丨国产丨九色丨pron| 亚洲精品国产一区二区精华液| 91免费视频网| 亚洲二区在线观看| 69堂国产成人免费视频| 久久99国产精品尤物| 久久久精品国产99久久精品芒果| 国产高清成人在线| 亚洲视频 欧洲视频| 欧美三级视频在线| 日韩av在线播放中文字幕| 日韩欧美一级特黄在线播放| 久久国产人妖系列| 欧美国产精品一区| 欧美视频日韩视频在线观看| 午夜av电影一区| 精品久久久久久久人人人人传媒| 国产成人鲁色资源国产91色综 | 国产亚洲午夜高清国产拍精品| 国产福利精品导航| 亚洲美女视频在线| 欧美一区二区三区不卡| 国产在线乱码一区二区三区| 国产精品欧美久久久久无广告| 91久久奴性调教| 久久av老司机精品网站导航| 欧美韩国日本综合| 欧美日韩国产一二三| 国产一区二区影院| 亚洲午夜精品在线| 国产欧美精品一区| 欧美丰满嫩嫩电影| 成人h动漫精品| 美女视频一区在线观看| 日韩理论片中文av| 精品久久久久久久久久久久久久久 | 黄色精品一二区| 亚洲美女区一区| 久久久午夜电影| 91精品欧美久久久久久动漫| 成人午夜激情片| 另类小说一区二区三区| 亚洲欧美日韩成人高清在线一区| 日韩一区二区三区免费看| 色综合咪咪久久| 国产一区二区精品久久91| 性做久久久久久免费观看欧美| 国产日韩视频一区二区三区| 欧美精选在线播放| 一本色道久久综合亚洲精品按摩 | 丁香啪啪综合成人亚洲小说 | 久久天堂av综合合色蜜桃网| 色婷婷国产精品久久包臀| 国产成人精品一区二区三区四区| 亚洲高清免费观看| 国产精品久久久久毛片软件| www日韩大片| 日韩一级完整毛片| 欧美日韩国产精品成人| 色综合天天在线| 高清在线观看日韩| 国产乱码精品一品二品| 黄色精品一二区| 精品无人码麻豆乱码1区2区| 日本亚洲欧美天堂免费| 亚洲第一av色| 天天av天天翘天天综合网色鬼国产| 亚洲三级小视频| 亚洲激情第一区| 亚洲综合免费观看高清完整版 | 日本系列欧美系列| 三级一区在线视频先锋| 亚洲永久精品国产| 亚洲激情av在线| 亚洲狠狠爱一区二区三区| 亚洲一区二区3| 午夜电影一区二区三区| 五月婷婷激情综合网| 天天综合网 天天综合色| 日本系列欧美系列| 黄色资源网久久资源365| 国产麻豆一精品一av一免费| 国产精品亚洲一区二区三区妖精 | 国产无一区二区| 国产精品欧美综合在线| 亚洲欧美日韩人成在线播放| 一区二区三区在线高清| 首页综合国产亚洲丝袜| 寂寞少妇一区二区三区| 国产一区二区视频在线播放| 成人白浆超碰人人人人| 在线精品视频免费观看| 日韩一区二区三区观看| 国产欧美日韩亚州综合| 亚洲蜜臀av乱码久久精品蜜桃| 午夜精品成人在线视频| 黑人精品欧美一区二区蜜桃| 成人av电影观看| 欧美日韩精品欧美日韩精品一 | 95精品视频在线| 欧美日韩国产免费一区二区| 精品国产污污免费网站入口 | 激情成人午夜视频| 成人免费高清在线| 7777精品久久久大香线蕉| 久久亚洲影视婷婷| 亚洲乱码国产乱码精品精的特点| 首页国产欧美久久| 成人精品国产一区二区4080 | 六月丁香婷婷久久| 91丨国产丨九色丨pron| 日韩欧美一级二级三级久久久| 亚洲国产高清不卡| 天堂影院一区二区| 91天堂素人约啪| 精品久久国产老人久久综合| 亚洲黄色性网站| 成人深夜在线观看| 精品捆绑美女sm三区|