diff libs/STM32F10x_StdPeriph_Lib_V3.5.0/Utilities/STM32_EVAL/Common/stm32_eval_i2c_tsensor.h @ 0:c59513fd84fb

Initial commit of STM32 test code.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 03 Oct 2011 21:19:15 +1030
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/STM32F10x_StdPeriph_Lib_V3.5.0/Utilities/STM32_EVAL/Common/stm32_eval_i2c_tsensor.h	Mon Oct 03 21:19:15 2011 +1030
@@ -0,0 +1,173 @@
+/**
+  ******************************************************************************
+  * @file    stm32_eval_i2c_tsensor.h
+  * @author  MCD Application Team
+  * @version V4.5.0
+  * @date    07-March-2011
+  * @brief   This file contains all the functions prototypes for the 
+  *          stm32_eval_i2c_tsensor firmware driver.
+  ******************************************************************************
+  * @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>
+  ******************************************************************************  
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32_EVAL_I2C_TSENSOR_H
+#define __STM32_EVAL_I2C_TSENSOR_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32_eval.h"
+
+/** @addtogroup Utilities
+  * @{
+  */
+  
+/** @addtogroup STM32_EVAL
+  * @{
+  */ 
+
+/** @addtogroup Common
+  * @{
+  */
+  
+/** @addtogroup STM32_EVAL_I2C_TSENSOR
+  * @{
+  */  
+
+/** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Types
+  * @{
+  */
+   
+ /** 
+  * @brief  IOE DMA Direction  
+  */ 
+typedef enum
+{
+  LM75_DMA_TX = 0,
+  LM75_DMA_RX = 1
+}LM75_DMADirection_TypeDef;
+
+/** 
+  * @brief  TSENSOR Status  
+  */ 
+typedef enum
+{
+  LM75_OK = 0,
+  LM75_FAIL
+}LM75_Status_TypDef;
+
+/**
+  * @}
+  */
+  
+/** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Constants
+  * @{
+  */ 
+    
+/* Uncomment the following line to use Timeout_User_Callback LM75_TimeoutUserCallback(). 
+   If This Callback is enabled, it should be implemented by user in main function .
+   LM75_TimeoutUserCallback() function is called whenever a timeout condition 
+   occure during communication (waiting on an event that doesn't occur, bus 
+   errors, busy devices ...). */   
+/* #define USE_TIMEOUT_USER_CALLBACK */    
+    
+/* Maximum Timeout values for flags and events waiting loops. These timeouts are
+   not based on accurate values, they just guarantee that the application will 
+   not remain stuck if the I2C communication is corrupted.
+   You may modify these timeout values depending on CPU frequency and application
+   conditions (interrupts routines ...). */   
+#define LM75_FLAG_TIMEOUT         ((uint32_t)0x1000)
+#define LM75_LONG_TIMEOUT         ((uint32_t)(10 * LM75_FLAG_TIMEOUT))    
+    
+
+/**
+  * @brief  Block Size
+  */
+#define LM75_REG_TEMP       0x00  /*!< Temperature Register of LM75 */
+#define LM75_REG_CONF       0x01  /*!< Configuration Register of LM75 */
+#define LM75_REG_THYS       0x02  /*!< Temperature Register of LM75 */
+#define LM75_REG_TOS        0x03  /*!< Over-temp Shutdown threshold Register of LM75 */
+#define I2C_TIMEOUT         ((uint32_t)0x3FFFF) /*!< I2C Time out */
+#define LM75_ADDR           0x90   /*!< LM75 address */
+#define LM75_I2C_SPEED      100000 /*!< I2C Speed */
+  
+   
+
+/**
+  * @}
+  */
+
+/** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Functions
+  * @{
+  */ 
+void LM75_DeInit(void);
+void LM75_Init(void);
+ErrorStatus LM75_GetStatus(void);
+uint16_t LM75_ReadTemp(void);
+uint16_t LM75_ReadReg(uint8_t RegName);
+uint8_t LM75_WriteReg(uint8_t RegName, uint16_t RegValue);
+uint8_t LM75_ReadConfReg(void);
+uint8_t LM75_WriteConfReg(uint8_t RegValue);
+uint8_t LM75_ShutDown(FunctionalState NewState);
+
+/** 
+  * @brief  Timeout user callback function. This function is called when a timeout
+  *         condition occurs during communication with IO Expander. Only protoype
+  *         of this function is decalred in IO Expander driver. Its implementation
+  *         may be done into user application. This function may typically stop
+  *         current operations and reset the I2C peripheral and IO Expander.
+  *         To enable this function use uncomment the define USE_TIMEOUT_USER_CALLBACK
+  *         at the top of this file.          
+  */
+#ifdef USE_TIMEOUT_USER_CALLBACK 
+ uint8_t LM75_TIMEOUT_UserCallback(void);
+#else
+ #define LM75_TIMEOUT_UserCallback()  LM75_FAIL
+#endif /* USE_TIMEOUT_USER_CALLBACK */
+ 
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32_EVAL_I2C_TSENSOR_H */
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/