stm32_eval_i2c_tsensor.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32_eval_i2c_tsensor.h
00004   * @author  MCD Application Team
00005   * @version V4.3.0
00006   * @date    10/15/2010
00007   * @brief   This file contains all the functions prototypes for the 
00008   *          stm32_eval_i2c_tsensor firmware driver.
00009   ******************************************************************************
00010   * @copy
00011   *
00012   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00013   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00014   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00015   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00016   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00017   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00018   *
00019   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00020   */
00021 
00022 /* Define to prevent recursive inclusion -------------------------------------*/
00023 #ifndef __STM32_EVAL_I2C_TSENSOR_H
00024 #define __STM32_EVAL_I2C_TSENSOR_H
00025 
00026 #ifdef __cplusplus
00027  extern "C" {
00028 #endif
00029 
00030 /* Includes ------------------------------------------------------------------*/
00031 #include "stm32_eval.h"
00032 
00033 /** @addtogroup Utilities
00034   * @{
00035   */
00036   
00037 /** @addtogroup STM32_EVAL
00038   * @{
00039   */ 
00040 
00041 /** @addtogroup Common
00042   * @{
00043   */
00044   
00045 /** @addtogroup STM32_EVAL_I2C_TSENSOR
00046   * @{
00047   */  
00048 
00049 /** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Types
00050   * @{
00051   */
00052    
00053  /** 
00054   * @brief  IOE DMA Direction  
00055   */ 
00056 typedef enum
00057 {
00058   LM75_DMA_TX = 0,
00059   LM75_DMA_RX = 1
00060 }LM75_DMADirection_TypeDef;
00061 
00062 /** 
00063   * @brief  TSENSOR Status  
00064   */ 
00065 typedef enum
00066 {
00067   LM75_OK = 0,
00068   LM75_FAIL
00069 }LM75_Status_TypDef;
00070 
00071 /**
00072   * @}
00073   */
00074   
00075 /** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Constants
00076   * @{
00077   */ 
00078     
00079 /* Uncomment the following line to use Timeout_User_Callback LM75_TimeoutUserCallback(). 
00080    If This Callback is enabled, it should be implemented by user in main function .
00081    LM75_TimeoutUserCallback() function is called whenever a timeout condition 
00082    occure during communication (waiting on an event that doesn't occur, bus 
00083    errors, busy devices ...). */   
00084 /* #define USE_TIMEOUT_USER_CALLBACK */    
00085     
00086 /* Maximum Timeout values for flags and events waiting loops. These timeouts are
00087    not based on accurate values, they just guarantee that the application will 
00088    not remain stuck if the I2C communication is corrupted.
00089    You may modify these timeout values depending on CPU frequency and application
00090    conditions (interrupts routines ...). */   
00091 #define LM75_FLAG_TIMEOUT         ((uint32_t)0x1000)
00092 #define LM75_LONG_TIMEOUT         ((uint32_t)(10 * LM75_FLAG_TIMEOUT))    
00093     
00094 
00095 /**
00096   * @brief  Block Size
00097   */
00098 #define LM75_REG_TEMP       0x00  /*!< Temperature Register of LM75 */
00099 #define LM75_REG_CONF       0x01  /*!< Configuration Register of LM75 */
00100 #define LM75_REG_THYS       0x02  /*!< Temperature Register of LM75 */
00101 #define LM75_REG_TOS        0x03  /*!< Over-temp Shutdown threshold Register of LM75 */
00102 #define I2C_TIMEOUT         ((uint32_t)0x3FFFF) /*!< I2C Time out */
00103 #define LM75_ADDR           0x90   /*!< LM75 address */
00104 #define LM75_I2C_SPEED      100000 /*!< I2C Speed */
00105   
00106    
00107 
00108 /**
00109   * @}
00110   */
00111 
00112 /** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Macros
00113   * @{
00114   */ 
00115 /**
00116   * @}
00117   */ 
00118 
00119 /** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Functions
00120   * @{
00121   */ 
00122 void LM75_DeInit(void);
00123 void LM75_Init(void);
00124 ErrorStatus LM75_GetStatus(void);
00125 uint16_t LM75_ReadTemp(void);
00126 uint16_t LM75_ReadReg(uint8_t RegName);
00127 uint8_t LM75_WriteReg(uint8_t RegName, uint16_t RegValue);
00128 uint8_t LM75_ReadConfReg(void);
00129 uint8_t LM75_WriteConfReg(uint8_t RegValue);
00130 uint8_t LM75_ShutDown(FunctionalState NewState);
00131 
00132 /** 
00133   * @brief  Timeout user callback function. This function is called when a timeout
00134   *         condition occurs during communication with IO Expander. Only protoype
00135   *         of this function is decalred in IO Expander driver. Its implementation
00136   *         may be done into user application. This function may typically stop
00137   *         current operations and reset the I2C peripheral and IO Expander.
00138   *         To enable this function use uncomment the define USE_TIMEOUT_USER_CALLBACK
00139   *         at the top of this file.          
00140   */
00141 #ifdef USE_TIMEOUT_USER_CALLBACK 
00142  uint8_t LM75_TIMEOUT_UserCallback(void);
00143 #else
00144  #define LM75_TIMEOUT_UserCallback()  LM75_FAIL
00145 #endif /* USE_TIMEOUT_USER_CALLBACK */
00146  
00147 #ifdef __cplusplus
00148 }
00149 #endif
00150 
00151 #endif /* __STM32_EVAL_I2C_TSENSOR_H */
00152 /**
00153   * @}
00154   */
00155 
00156 /**
00157   * @}
00158   */
00159 
00160 /**
00161   * @}
00162   */
00163 
00164 /**
00165   * @}
00166   */ 
00167 
00168 /**
00169   * @}
00170   */
00171 
00172 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32