comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:c59513fd84fb
1 /**
2 ******************************************************************************
3 * @file stm32_eval_i2c_tsensor.h
4 * @author MCD Application Team
5 * @version V4.5.0
6 * @date 07-March-2011
7 * @brief This file contains all the functions prototypes for the
8 * stm32_eval_i2c_tsensor firmware driver.
9 ******************************************************************************
10 * @attention
11 *
12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 *
19 * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
20 ******************************************************************************
21 */
22
23 /* Define to prevent recursive inclusion -------------------------------------*/
24 #ifndef __STM32_EVAL_I2C_TSENSOR_H
25 #define __STM32_EVAL_I2C_TSENSOR_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /* Includes ------------------------------------------------------------------*/
32 #include "stm32_eval.h"
33
34 /** @addtogroup Utilities
35 * @{
36 */
37
38 /** @addtogroup STM32_EVAL
39 * @{
40 */
41
42 /** @addtogroup Common
43 * @{
44 */
45
46 /** @addtogroup STM32_EVAL_I2C_TSENSOR
47 * @{
48 */
49
50 /** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Types
51 * @{
52 */
53
54 /**
55 * @brief IOE DMA Direction
56 */
57 typedef enum
58 {
59 LM75_DMA_TX = 0,
60 LM75_DMA_RX = 1
61 }LM75_DMADirection_TypeDef;
62
63 /**
64 * @brief TSENSOR Status
65 */
66 typedef enum
67 {
68 LM75_OK = 0,
69 LM75_FAIL
70 }LM75_Status_TypDef;
71
72 /**
73 * @}
74 */
75
76 /** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Constants
77 * @{
78 */
79
80 /* Uncomment the following line to use Timeout_User_Callback LM75_TimeoutUserCallback().
81 If This Callback is enabled, it should be implemented by user in main function .
82 LM75_TimeoutUserCallback() function is called whenever a timeout condition
83 occure during communication (waiting on an event that doesn't occur, bus
84 errors, busy devices ...). */
85 /* #define USE_TIMEOUT_USER_CALLBACK */
86
87 /* Maximum Timeout values for flags and events waiting loops. These timeouts are
88 not based on accurate values, they just guarantee that the application will
89 not remain stuck if the I2C communication is corrupted.
90 You may modify these timeout values depending on CPU frequency and application
91 conditions (interrupts routines ...). */
92 #define LM75_FLAG_TIMEOUT ((uint32_t)0x1000)
93 #define LM75_LONG_TIMEOUT ((uint32_t)(10 * LM75_FLAG_TIMEOUT))
94
95
96 /**
97 * @brief Block Size
98 */
99 #define LM75_REG_TEMP 0x00 /*!< Temperature Register of LM75 */
100 #define LM75_REG_CONF 0x01 /*!< Configuration Register of LM75 */
101 #define LM75_REG_THYS 0x02 /*!< Temperature Register of LM75 */
102 #define LM75_REG_TOS 0x03 /*!< Over-temp Shutdown threshold Register of LM75 */
103 #define I2C_TIMEOUT ((uint32_t)0x3FFFF) /*!< I2C Time out */
104 #define LM75_ADDR 0x90 /*!< LM75 address */
105 #define LM75_I2C_SPEED 100000 /*!< I2C Speed */
106
107
108
109 /**
110 * @}
111 */
112
113 /** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Macros
114 * @{
115 */
116 /**
117 * @}
118 */
119
120 /** @defgroup STM32_EVAL_I2C_TSENSOR_Exported_Functions
121 * @{
122 */
123 void LM75_DeInit(void);
124 void LM75_Init(void);
125 ErrorStatus LM75_GetStatus(void);
126 uint16_t LM75_ReadTemp(void);
127 uint16_t LM75_ReadReg(uint8_t RegName);
128 uint8_t LM75_WriteReg(uint8_t RegName, uint16_t RegValue);
129 uint8_t LM75_ReadConfReg(void);
130 uint8_t LM75_WriteConfReg(uint8_t RegValue);
131 uint8_t LM75_ShutDown(FunctionalState NewState);
132
133 /**
134 * @brief Timeout user callback function. This function is called when a timeout
135 * condition occurs during communication with IO Expander. Only protoype
136 * of this function is decalred in IO Expander driver. Its implementation
137 * may be done into user application. This function may typically stop
138 * current operations and reset the I2C peripheral and IO Expander.
139 * To enable this function use uncomment the define USE_TIMEOUT_USER_CALLBACK
140 * at the top of this file.
141 */
142 #ifdef USE_TIMEOUT_USER_CALLBACK
143 uint8_t LM75_TIMEOUT_UserCallback(void);
144 #else
145 #define LM75_TIMEOUT_UserCallback() LM75_FAIL
146 #endif /* USE_TIMEOUT_USER_CALLBACK */
147
148 #ifdef __cplusplus
149 }
150 #endif
151
152 #endif /* __STM32_EVAL_I2C_TSENSOR_H */
153 /**
154 * @}
155 */
156
157 /**
158 * @}
159 */
160
161 /**
162 * @}
163 */
164
165 /**
166 * @}
167 */
168
169 /**
170 * @}
171 */
172
173 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/