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
baro_amsys.h
Go to the documentation of this file.
1 /*
2  * Driver for a Amsys Barometric Sensor I2C
3  * AMS 5812-0150-A
4  *
5  * Copyright (C) 2010 The Paparazzi Team
6  *
7  * This file is part of paparazzi.
8  *
9  * paparazzi is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2, or (at your option)
12  * any later version.
13  *
14  * paparazzi is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with paparazzi; see the file COPYING. If not, write to
21  * the Free Software Foundation, 59 Temple Place - Suite 330,
22  * Boston, MA 02111-1307, USA.
23  */
24 
25 #ifndef BARO_AMSYS_H
26 #define BARO_AMSYS_H
27 
28 #include "std.h"
29 #include "mcu_periph/i2c.h"
30 
31 #define BARO_AMSYS_DT 0.05
32 
34 // extern float baro_amsys_offset;
35 extern bool_t baro_amsys_valid;
36 // extern bool_t baro_amsys_updated;
37 // extern bool_t baro_amsys_enabled;
38 extern float baro_amsys_altitude;
39 // extern float baro_amsys_r;
40 // extern float baro_amsys_sigma2;
41 extern float baro_filter;
42 
44 
45 extern void baro_amsys_init( void );
46 extern void baro_amsys_read_periodic( void );
47 extern void baro_amsys_read_event( void );
48 
49 #define BaroAmsysEvent() { if (baro_amsys_i2c_trans.status == I2CTransSuccess) baro_amsys_read_event(); }
50 
51 #define BaroAmsysUpdate(_b, _h) { if (baro_amsys_valid) { _b = baro_amsys_adc; _h(); baro_amsys_valid = FALSE; } }
52 
53 #endif // BARO_AMSYS_H
unsigned short uint16_t
Definition: types.h:16
void baro_amsys_init(void)
Definition: baro_amsys.c:98
float baro_amsys_altitude
Definition: baro_amsys.c:78
uint16_t baro_amsys_adc
Definition: baro_amsys.c:75
float baro_filter
Definition: baro_amsys.c:84
void baro_amsys_read_event(void)
Definition: baro_amsys.c:135
bool_t baro_amsys_valid
Definition: baro_amsys.c:77
struct i2c_transaction baro_amsys_i2c_trans
Definition: baro_amsys.c:91
void baro_amsys_read_periodic(void)
Definition: baro_amsys.c:117
Architecture independent I2C (Inter-Integrated Circuit Bus) API.