Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ms5611.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2012 Piotr Esden-Tempski
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22 
23 /* Register definition for MS5611
24  */
25 
26 #ifndef MS5611_H
27 #define MS5611_H
28 
29 /* default i2c address
30  * when CSB is set to GND addr is 0xEE
31  * when CSB is set to VCC addr is 0xEC
32  *
33  * Note: Aspirin 2.1 has CSB bound to GND.
34  */
35 #define MS5611_SLAVE_ADDR 0xEE
36 
37 /* FIXME: For backwards compatibility with Aspirin driver (it doesnt talk to baro either) */
38 #define MS5611_ADDR0 0x77
39 #define MS5611_ADDR1 0x76
40 
41 /* SPI SLAVE3 is on pin PC13
42  * Aspirin 2.2 has ms5611 on SPI bus
43  */
44 #ifndef MS5611_SLAVE_DEV
45 #define MS5611_SLAVE_DEV SPI_SLAVE3
46 #endif
47 
48 /* Number of 16bit calibration coefficients */
49 #define PROM_NB 8
50 
51 /* OSR definitions */
52 #define MS5611_OSR256 0x02
53 #define MS5611_OSR512 0x02
54 #define MS5611_OSR1024 0x04
55 #define MS5611_OSR2048 0x06
56 #define MS5611_OSR4096 0x08
57 
58 /* D1 Register defines */
59 #define MS5611_REG_D1R 0x40 // Request D1 (pressure) conversion
60 #define MS5611_REG_D1(_osr) (MS5611_REG_D1R | _osr)
61 #define MS5611_REG_D1OSR256 MS5611_REG_D1(MS5611_ORS256)
62 #define MS5611_REG_D1OSR512 MS5611_REG_D1(MS5611_OSR512)
63 #define MS5611_REG_D1OSR1024 MS5611_REG_D1(MS5611_OSR1024)
64 #define MS5611_REG_D1OSR2048 MS5611_REG_D1(MS5611_OSR2048)
65 #define MS5611_REG_D1OSR4096 MS5611_REG_D1(MS5611_OSR4096)
66 
67 /* D2 register defines */
68 #define MS5611_REG_D2R 0x50 // Request D2 (temperature) conversion
69 #define MS5611_REG_D2(_osr) (MS5611_REG_D2R | _osr)
70 #define MS5611_REG_D2OSR256 MS5611_REG_D2(MS5611_ORS256)
71 #define MS5611_REG_D2OSR512 MS5611_REG_D2(MS5611_OSR512)
72 #define MS5611_REG_D2OSR1024 MS5611_REG_D2(MS5611_OSR1024)
73 #define MS5611_REG_D2OSR2048 MS5611_REG_D2(MS5611_OSR2048)
74 #define MS5611_REG_D2OSR4096 MS5611_REG_D2(MS5611_OSR4096)
75 
76 /* Commands */
77 #define MS5611_ADC_READ 0x00 // Read converted value
78 #define MS5611_SOFT_RESET 0x1E // Reset command
79 #define MS5611_PROM_READ 0xA0 // Start reading PROM
80 #define MS5611_START_CONV_D1 MS5611_REG_D1OSR4096 /* we use OSR=4096 for maximum resolution */
81 #define MS5611_START_CONV_D2 MS5611_REG_D2OSR4096 /* we use OSR=4096 for maximum resolution */
82 
83 /* FIXME: backwards compatibility with Aspirin driver */
84 #define MS5611_REG_RESET MS5611_SOFT_RESET
85 #define MS5611_REG_ADCREAD MS5611_ADC_READ
86 
99 };
100 
101 #endif /* MS5611_H */
ms5611_stat