Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mag_lis3mdl.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019 Gautier Hattenberger <gautier.hattenberger@enac.fr>
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, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
28#include "mcu_periph/uart.h"
29#include "pprzlink/messages.h"
31#include "generated/airframe.h"
32#include "modules/core/abi.h"
33
34#ifndef LIS3MDL_CHAN_X
35#define LIS3MDL_CHAN_X 0
36#endif
37#ifndef LIS3MDL_CHAN_Y
38#define LIS3MDL_CHAN_Y 1
39#endif
40#ifndef LIS3MDL_CHAN_Z
41#define LIS3MDL_CHAN_Z 2
42#endif
43#ifndef LIS3MDL_CHAN_X_SIGN
44#define LIS3MDL_CHAN_X_SIGN +
45#endif
46#ifndef LIS3MDL_CHAN_Y_SIGN
47#define LIS3MDL_CHAN_Y_SIGN +
48#endif
49#ifndef LIS3MDL_CHAN_Z_SIGN
50#define LIS3MDL_CHAN_Z_SIGN +
51#endif
52
54
75
80
82{
84
86#if MODULE_LIS3MDL_UPDATE_AHRS
87 // current timestamp
89
90 // set channel order
91 struct Int32Vect3 mag = {
95 };
96
98#endif
99#if MODULE_LIS3MDL_SYNC_SEND
101#endif
102#if MODULE_LIS3MDL_UPDATE_AHRS || MODULE_LIS3MDL_SYNC_SEND
104#endif
105 }
106}
107
Main include for ABI (AirBorneInterface).
#define MAG_LIS3MDL_SENDER_ID
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
#define ANGLE_BFP_OF_REAL(_af)
#define int32_rmat_of_eulers
Rotation matrix from Euler angles.
euler angles
rotation matrix
void imu_set_defaults_mag(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Vect3 *neutral, const struct Int32Vect3 *scale)
Set the defaults for a mag sensor WARNING: Should be called before sensor is publishing messages to e...
Definition imu.c:640
void lis3mdl_init(struct Lis3mdl *mag, struct i2c_periph *i2c_p, uint8_t addr, uint8_t data_rate, uint8_t scale, uint8_t mode, uint8_t perf)
Definition lis3mdl.c:60
void lis3mdl_event(struct Lis3mdl *mag)
Definition lis3mdl.c:127
#define LIS3MDL_ADDR1
Definition lis3mdl.h:34
volatile bool data_available
data ready flag
Definition lis3mdl.h:74
static void lis3mdl_periodic(struct Lis3mdl *mag)
convenience function: read or start configuration if not already initialized
Definition lis3mdl.h:88
#define LIS3MDL_PERFORMANCE_ULTRA_HIGH
Definition lis3mdl.h:40
#define LIS3MDL_DATA_RATE_80_HZ
Definition lis3mdl.h:49
#define LIS3MDL_SCALE_4_GAUSS
Definition lis3mdl.h:55
#define LIS3MDL_MODE_CONTINUOUS
Definition lis3mdl.h:51
union Lis3mdl::@333 data
struct Lis3mdl mag_lis3mdl
Definition mag_lis3mdl.c:53
#define LIS3MDL_CHAN_Y
Definition mag_lis3mdl.c:38
#define LIS3MDL_CHAN_Y_SIGN
Definition mag_lis3mdl.c:47
#define LIS3MDL_CHAN_X
Definition mag_lis3mdl.c:35
void mag_lis3mdl_module_init(void)
Definition mag_lis3mdl.c:55
#define LIS3MDL_CHAN_X_SIGN
Definition mag_lis3mdl.c:44
void mag_lis3mdl_module_event(void)
Definition mag_lis3mdl.c:81
#define LIS3MDL_CHAN_Z_SIGN
Definition mag_lis3mdl.c:50
void mag_lis3mdl_report(void)
#define LIS3MDL_CHAN_Z
Definition mag_lis3mdl.c:41
void mag_lis3mdl_module_periodic(void)
Definition mag_lis3mdl.c:76
Module wrapper for ST LIS3MDL magnetometers.
uint16_t foo
Definition main_demo5.c:58
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.