update credits
[librepilot.git] / flight / pios / inc / pios_bmp085.h
blobc1e8477b45578337bc78560c9605993a05ab9650
1 /**
2 ******************************************************************************
3 * @addtogroup PIOS PIOS Core hardware abstraction layer
4 * @{
5 * @addtogroup PIOS_BMP085 BMP085 Functions
6 * @brief Hardware functions to deal with the altitude pressure sensor
7 * @{
9 * @file pios_bmp085.h
10 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
11 * @brief BMP085 functions header.
12 * @see The GNU Public License (GPL) Version 3
14 *****************************************************************************/
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * for more details.
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #ifndef PIOS_BMP085_H
32 #define PIOS_BMP085_H
34 /* BMP085 Addresses */
35 #define BMP085_I2C_ADDR 0x77
36 #define BMP085_CALIB_ADDR 0xAA
37 #define BMP085_CALIB_LEN 22
38 #define BMP085_CTRL_ADDR 0xF4
39 #define BMP085_OVERSAMPLING PIOS_BMP085_OVERSAMPLING
40 #define BMP085_PRES_ADDR (0x34 + (BMP085_OVERSAMPLING << 6))
41 #define BMP085_TEMP_ADDR 0x2E
42 #define BMP085_ADC_MSB 0xF6
43 #define BMP085_P0 101325
45 /* Local Types */
46 typedef struct {
47 int16_t AC1;
48 int16_t AC2;
49 int16_t AC3;
50 uint16_t AC4;
51 uint16_t AC5;
52 uint16_t AC6;
53 int16_t B1;
54 int16_t B2;
55 int16_t MB;
56 int16_t MC;
57 int16_t MD;
58 } BMP085CalibDataTypeDef;
60 typedef enum {
61 PressureConv,
62 TemperatureConv
63 } ConversionTypeTypeDef;
65 /* Global Variables */
66 #if defined(PIOS_INCLUDE_FREERTOS)
67 extern xSemaphoreHandle PIOS_BMP085_EOC;
68 #else
69 extern int32_t PIOS_BMP085_EOC;
70 #endif
72 /* Public Functions */
73 extern void PIOS_BMP085_Init(void);
74 extern void PIOS_BMP085_StartADC(ConversionTypeTypeDef Type);
75 extern void PIOS_BMP085_ReadADC(void);
76 extern int16_t PIOS_BMP085_GetTemperature(void);
77 extern int32_t PIOS_BMP085_GetPressure(void);
78 extern bool PIOS_BMP085_Read(uint8_t address, uint8_t *buffer, uint8_t len);
79 extern bool PIOS_BMP085_Write(uint8_t address, uint8_t buffer);
80 extern int32_t PIOS_BMP085_Test();
82 #endif /* PIOS_BMP085_H */
84 /**
85 * @}
86 * @}