Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
baro_mpl3115.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Gautier Hattenberger (ENAC)
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
30 #include "peripherals/mpl3115.h"
31 #include "subsystems/abi.h"
32 
33 //Messages
34 #include "mcu_periph/uart.h"
35 #include "messages.h"
37 
38 
39 #ifndef BARO_MPL3115_I2C_DEV
40 #define BARO_MPL3115_I2C_DEV i2c0
41 #endif
42 
43 #ifndef BARO_MPL3115_I2C_SLAVE_ADDR
44 #define BARO_MPL3115_I2C_SLAVE_ADDR MPL3115_I2C_ADDR
45 #endif
46 
47 
49 
50 void baro_mpl3115_init( void ) {
52 }
53 
54 
57 }
58 
59 
63  float pressure = (float)baro_mpl.pressure/(1<<2);
64  AbiSendMsgBARO_ABS(BARO_MPL3115_SENDER_ID, &pressure);
65 #ifdef SENSOR_SYNC_SEND
66  DOWNLINK_SEND_MPL3115_BARO(DefaultChannel, DefaultDevice, &baro_mpl.pressure, &baro_mpl.temperature, &baro_mpl.alt);
67 #endif
69  }
70 }
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void mpl3115_init(struct Mpl3115 *mpl, struct i2c_periph *i2c_p, uint8_t addr)
Definition: mpl3115.c:31
int16_t temperature
temperature in 1/16 degrees Celcius
Definition: mpl3115.h:79
Main include for ABI (AirBorneInterface).
void mpl3115_event(struct Mpl3115 *mpl)
Definition: mpl3115.c:107
#define BARO_MPL3115_I2C_SLAVE_ADDR
Definition: baro_mpl3115.c:44
#define BARO_MPL3115_I2C_DEV
Definition: baro_mpl3115.c:40
#define FALSE
Definition: imu_chimu.h:141
#define BARO_MPL3115_SENDER_ID
void baro_mpl3115_read_event(void)
Definition: baro_mpl3115.c:60
void mpl3115_periodic(struct Mpl3115 *mpl)
Definition: mpl3115.c:157
void baro_mpl3115_read_periodic(void)
Definition: baro_mpl3115.c:55
volatile bool_t data_available
data ready flag
Definition: mpl3115.h:76
uint32_t pressure
pressure in 1/4 Pascal
Definition: mpl3115.h:80
Driver for the baro MPL3115A2 from Freescale (i2c)
void baro_mpl3115_init(void)
Definition: baro_mpl3115.c:50
struct Mpl3115 baro_mpl
Definition: baro_mpl3115.c:48
Module for the baro MPL3115A2 from Freescale (i2c)