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