Contiki 3.x
mems.h
1 /**
2  * \addtogroup mbxxx-platform
3  *
4  * @{
5  */
6 /******************** (C) COPYRIGHT 2009 STMicroelectronics ********************
7 * File Name : mems.h
8 * Author : MCD Application Team
9 * Version : V1.0
10 * Date : January 2010
11 * Description : header file for mems driver
12 ********************************************************************************
13 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
14 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
15 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
16 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
17 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
18 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19 *******************************************************************************/
20 
21 #ifndef MEMS_H_
22 #define MEMS_H_
23 
24 /* Define --------------------------------------------------------------------*/
25 #include "mems_regs.h"
26 
27 /* Define --------------------------------------------------------------------*/
28 // Sensitivity values in mg/digit
29 #define HIGH_RANGE_SENSITIVITY 72
30 #define LOW_RANGE_SENSITIVITY 18
31 
32 #define MEMS_LOW_RANGE 0
33 #define MEMS_HIGH_RANGE 1
34 
35 /* Typedef -------------------------------------------------------------------*/
36 /* Mems data type: three acceleration values each related to a specific direction
37  Watch out: only lower data values (e.g. those terminated by the _l) are
38  currently used by the device */
39 
40 typedef struct {
41  int8_t outx_l;
42  int8_t outx_h;
43  int8_t outy_l;
44  int8_t outy_h;
45  int8_t outz_l;
46  int8_t outz_h;
47 } t_mems_data;
48 
49 /* Functions -----------------------------------------------------------------*/
50 
51 /* Mems Initialization function */
52 uint8_t MEMS_Init(void);
53 
54 uint8_t MEMS_On(void);
55 uint8_t MEMS_Off(void);
56 uint8_t MEMS_SetFullScale(boolean range);
57 boolean MEMS_GetFullScale(void);
58 uint8_t MEMS_Read_Reg (uint8_t slave_addr, uint8_t reg_addr, uint8_t *pBuffer,
59  uint8_t NoOfBytes);
60 uint8_t MEMS_Write_Reg (uint8_t slave_addr, uint8_t reg_addr,
61  uint8_t reg_value);
62 
63 #endif /*MEMS_H_ */
64 
65 /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
66 /** @} */
67 
Mems data type: three acceleration values each related to a specific direction Watch out: only lower ...
Definition: mems.h:17