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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? stm32f10x_cec.c

?? 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****/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产伦精品一区二区三区免费迷| 精品国产一二三区| 激情综合网激情| 国产欧美一区二区三区鸳鸯浴 | 中文字幕va一区二区三区| 成人爽a毛片一区二区免费| 久久99精品久久久久久国产越南| 天天爽夜夜爽夜夜爽精品视频| 日韩欧美国产成人一区二区| 国产精品77777| 亚洲一区二区三区四区在线| 亚洲精品视频在线观看网站| 亚洲欧美日韩精品久久久久| 日韩美女视频在线| 日韩精品综合一本久道在线视频| 91精品福利在线一区二区三区 | 色香色香欲天天天影视综合网| 婷婷成人激情在线网| 亚洲成人免费视频| 日韩av一区二区三区| 国产精品伦理在线| 1区2区3区精品视频| 亚洲人妖av一区二区| 亚洲色大成网站www久久九九| 亚洲天堂网中文字| 久久亚洲一级片| 国产三级三级三级精品8ⅰ区| 亚洲国产精品精华液ab| 亚洲欧美在线高清| 亚洲国产精品久久人人爱| 日本午夜一区二区| 一本大道久久a久久综合| 波多野结衣精品在线| 色噜噜狠狠成人中文综合| 在线亚洲+欧美+日本专区| 国产成人免费视频一区| 97se亚洲国产综合自在线观| 欧美中文字幕一区二区三区亚洲 | 国产精品午夜在线观看| 亚洲精品高清在线| 奇米888四色在线精品| 亚洲一卡二卡三卡四卡无卡久久| 国产精品免费视频一区| 久久久久久97三级| 欧美大片在线观看一区二区| 久久亚洲影视婷婷| 亚洲免费观看在线视频| 蜜臀国产一区二区三区在线播放| 丁香五精品蜜臀久久久久99网站| 精品一区精品二区高清| 91老师片黄在线观看| 日本一区二区电影| 国产日韩精品一区| 精品少妇一区二区三区视频免付费| 欧美唯美清纯偷拍| 色婷婷久久99综合精品jk白丝| 欧美一区二区福利视频| 欧美理论片在线| 中文字幕亚洲综合久久菠萝蜜| 欧美激情在线观看视频免费| 午夜久久久久久| 99精品欧美一区二区三区小说| 成人app网站| 欧美α欧美αv大片| 亚洲欧美日韩国产综合在线| 国产一区二区精品久久| 欧美老年两性高潮| 日韩一区二区在线播放| 欧美成人激情免费网| 日精品一区二区三区| 成人免费视频一区二区| 99热99精品| 久久久久久久精| 蜜臀av在线播放一区二区三区| 日韩极品在线观看| 久久爱www久久做| 欧美日韩成人一区| 尤物视频一区二区| 日韩激情一二三区| 欧美写真视频网站| 亚洲女厕所小便bbb| 成人一区二区三区在线观看| 精品国产sm最大网站| 国产免费成人在线视频| 亚洲人成网站在线| 午夜电影一区二区三区| 国模一区二区三区白浆| 91亚洲国产成人精品一区二三| 精品国产99国产精品| 免费看欧美女人艹b| 欧美高清视频不卡网| 久久久久97国产精华液好用吗| 日韩毛片精品高清免费| 日本一不卡视频| 日韩欧美综合在线| 激情五月激情综合网| 色婷婷久久久综合中文字幕| 亚洲欧洲综合另类在线| 日韩欧美成人一区| 日韩二区三区四区| 日韩欧美一区在线| 国内成+人亚洲+欧美+综合在线| 精品福利二区三区| 国产98色在线|日韩| 国产精品欧美综合在线| 老司机免费视频一区二区| 91麻豆国产自产在线观看| 亚洲六月丁香色婷婷综合久久 | 一本久久综合亚洲鲁鲁五月天| 日韩欧美久久久| 亚洲三级电影全部在线观看高清| 色综合久久中文字幕| 亚洲国产综合色| 成年人国产精品| 亚洲精选一二三| 欧美精三区欧美精三区| 激情五月婷婷综合| 91精品欧美一区二区三区综合在 | 亚洲色图色小说| 国产乱码精品一区二区三区忘忧草 | 精品盗摄一区二区三区| 成人免费毛片高清视频| 日韩精品一区二区三区老鸭窝| 亚洲毛片av在线| 99久久精品国产毛片| 亚洲成人久久影院| 一本一道综合狠狠老| 国产精品高潮呻吟| 555www色欧美视频| 成人高清免费在线播放| 偷窥少妇高潮呻吟av久久免费| 91福利在线免费观看| 亚洲色图.com| 久久综合色婷婷| 欧美中文字幕一区二区三区亚洲| 自拍偷拍国产精品| 精品久久国产老人久久综合| 免费观看成人av| 国产精品沙发午睡系列990531| 国产一区二区三区av电影 | 亚洲久本草在线中文字幕| 欧美成人vps| 91丝袜高跟美女视频| 国产欧美一区二区精品性色| 欧美性xxxxxx少妇| 成人中文字幕合集| 日韩电影一二三区| 日韩精品专区在线影院重磅| 日本电影亚洲天堂一区| 国产乱码精品一区二区三区五月婷 | 亚洲成人在线网站| 国产精品成人在线观看| 精品日韩一区二区三区| 欧美日韩激情一区| 91美女片黄在线观看| 亚洲成人自拍一区| 精品乱人伦小说| 欧美久久一区二区| 色哟哟一区二区三区| 不卡的av电影| 亚洲第四色夜色| 一区二区三区加勒比av| 中文字幕va一区二区三区| 久久人人爽人人爽| 日韩欧美国产三级| 日韩欧美专区在线| 欧美一级日韩免费不卡| 国产精品一二三四五| 久久99精品久久久久久久久久久久| 国产欧美日韩在线观看| 在线视频一区二区三区| 一本高清dvd不卡在线观看| 99在线精品免费| 91麻豆国产精品久久| 91天堂素人约啪| 色欧美日韩亚洲| 在线亚洲免费视频| 欧美日韩亚洲不卡| 国产九色精品成人porny| 一二三区精品视频| 久久久国产精品午夜一区ai换脸| 91麻豆精品秘密| 欧洲亚洲精品在线| 国产黄色精品网站| 亚洲成人av在线电影| 国产精品丝袜91| 欧美一区二区播放| 91精品久久久久久久91蜜桃| 成人av资源网站| 97se亚洲国产综合在线| 精品在线免费视频| 国产超碰在线一区| 日本人妖一区二区| 国内久久婷婷综合| 天堂一区二区在线| 久草在线在线精品观看| 国产精品一卡二卡| 日本韩国精品在线| 91精品国产免费久久综合| 日本道免费精品一区二区三区|