Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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 "
mcu_periph/i2c.h
"
21
#include "
mcu_periph/uart.h
"
22
#include "pprzlink/messages.h"
23
#include "
subsystems/datalink/downlink.h
"
24
#include <math.h>
25
26
#include "../../peripherals/hmc5843.h"
27
28
29
int32_t
mag_x
,
mag_y
,
mag_z
;
30
bool
mag_valid
;
31
32
33
34
35
void
hmc5843_module_init
(
void
)
36
{
37
hmc5843_init
();
38
}
39
40
void
hmc5843_module_periodic
(
void
)
41
{
42
hmc5843_periodic
();
43
mag_x
=
hmc5843
.
data
.value[0];
44
mag_y
=
hmc5843
.
data
.value[1];
45
mag_z
=
hmc5843
.
data
.value[2];
46
RunOnceEvery(30, DOWNLINK_SEND_IMU_MAG_RAW(
DefaultChannel
,
DefaultDevice
, &
mag_x
, &
mag_y
, &
mag_z
));
47
}
48
49
void
hmc5843_module_event
(
void
)
50
{
51
hmc5843_idle_task
();
52
}
hmc5843_idle_task
void hmc5843_idle_task(void)
Definition:
hmc5843.c:60
hmc5843_init
void hmc5843_init(void)
Definition:
hmc5843.c:16
mag_y
int32_t mag_y
Definition:
mag_hmc5843.c:29
mag_x
int32_t mag_x
Definition:
mag_hmc5843.c:29
Hmc5843::data
union Hmc5843::@316 data
uart.h
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
mag_z
int32_t mag_z
Definition:
mag_hmc5843.c:29
downlink.h
Common code for AP and FBW telemetry.
mag_valid
bool mag_valid
Definition:
mag_hmc5843.c:30
int32_t
signed long int32_t
Definition:
types.h:19
hmc5843_module_init
void hmc5843_module_init(void)
Definition:
mag_hmc5843.c:35
hmc5843_periodic
void hmc5843_periodic(void)
Definition:
hmc5843.c:103
hmc5843_module_event
void hmc5843_module_event(void)
Definition:
mag_hmc5843.c:49
hmc5843_module_periodic
void hmc5843_module_periodic(void)
Definition:
mag_hmc5843.c:40
DefaultChannel
#define DefaultChannel
Definition:
downlink.h:42
DefaultDevice
#define DefaultDevice
Definition:
downlink.h:46
i2c.h
hmc5843
struct Hmc5843 hmc5843
Definition:
hmc5843.c:9
sw
airborne
modules
sensors
mag_hmc5843.c
Generated on Tue Feb 1 2022 13:51:16 for Paparazzi UAS by
1.8.17