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
mag_hmc58xx.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Felix Ruess <felix.ruess@gmail.com>
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 
29 #include "mcu_periph/uart.h"
30 #include "messages.h"
32 
33 #ifndef DOWNLINK_DEVICE
34 #define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
35 #endif
36 
38 
40  hmc58xx_init(&mag_hmc58xx, &(MAG_HMC58XX_I2C_DEV), HMC58XX_ADDR);
41 }
42 
45 }
46 
49 #if MODULE_HMC58XX_SYNC_SEND
53  }
54 #endif
55 }
56 
57 void mag_hmc58xx_report(void) {
58  struct Int32Vect3 mag = {
62  };
63  DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel, DefaultDevice, &mag.x, &mag.y, &mag.z);
64 }
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
union Hmc58xx::@20 data
#define HMC58XX_ADDR
Definition: hmc58xx_regs.h:31
void mag_hmc58xx_module_event(void)
Definition: mag_hmc58xx.c:47
#define FALSE
Definition: imu_chimu.h:141
void mag_hmc58xx_module_init(void)
Definition: mag_hmc58xx.c:39
struct Hmc58xx mag_hmc58xx
Definition: mag_hmc58xx.c:37
void mag_hmc58xx_module_periodic(void)
Definition: mag_hmc58xx.c:43
signed long int32_t
Definition: types.h:19
struct Int16Vect3 vect
data vector in mag coordinate system
Definition: hmc58xx.h:67
Module wrapper for Honeywell HMC5843 and HMC5883 magnetometers.
static void hmc58xx_periodic(struct Hmc58xx *hmc)
convenience function: read or start configuration if not already initialized
Definition: hmc58xx.h:84
void hmc58xx_init(struct Hmc58xx *hmc, struct i2c_periph *i2c_p, uint8_t addr)
Initialize Hmc58xx struct and set default config options.
Definition: hmc58xx.c:62
void hmc58xx_event(struct Hmc58xx *hmc)
Definition: hmc58xx.c:136
volatile bool_t data_available
data ready flag
Definition: hmc58xx.h:65
void mag_hmc58xx_report(void)
Definition: mag_hmc58xx.c:57