Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mag_hmc5843.c
Go to the documentation of this file.
1 /*
2  * This file is part of paparazzi.
3  *
4  * paparazzi is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2, or (at your option)
7  * any later version.
8  *
9  * paparazzi is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with paparazzi; see the file COPYING. If not, write to
16  * the Free Software Foundation, 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  */
20 #include "estimator.h"
21 #include "mcu_periph/i2c.h"
22 #include "mcu_periph/uart.h"
23 #include "messages.h"
25 #include <math.h>
26 
27 #include "../../peripherals/hmc5843.h"
28 
29 
31 bool_t mag_valid;
32 
33 
34 #ifndef DOWNLINK_DEVICE
35 #define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
36 #endif
37 
38 
39 void hmc5843_module_init( void ) {
40  hmc5843_init();
41 }
42 
44 {
46  mag_x = hmc5843.data.value[0];
47  mag_y = hmc5843.data.value[1];
48  mag_z = hmc5843.data.value[2];
49  RunOnceEvery(30,DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel, DefaultDevice,&mag_x,&mag_y,&mag_z));
50 }
51 
53 {
55 }
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
int32_t mag_z
Definition: mag_hmc5843.c:30
union Hmc5843::@16 data
void hmc5843_idle_task(void)
Definition: hmc5843.c:60
void hmc5843_module_init(void)
Definition: mag_hmc5843.c:39
void hmc5843_module_periodic(void)
Definition: mag_hmc5843.c:43
void hmc5843_module_event(void)
Definition: mag_hmc5843.c:52
void hmc5843_init(void)
Definition: hmc5843.c:16
signed long int32_t
Definition: types.h:19
int16_t value[3]
Definition: hmc5843.h:39
State estimation, fusioning sensors.
void hmc5843_periodic(void)
Definition: hmc5843.c:103
int32_t mag_y
Definition: mag_hmc5843.c:30
bool_t mag_valid
Definition: mag_hmc5843.c:31
int32_t mag_x
Definition: mag_hmc5843.c:30
struct Hmc5843 hmc5843
Definition: hmc5843.c:9