Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
hmc5843.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2009 Antoine Drouin <poinix@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 
22 #ifndef HMC5843_H
23 #define HMC5843_H
24 
25 #include "std.h"
26 #include "mcu_periph/i2c.h"
27 
28 struct Hmc5843 {
35  union {
36  uint8_t buf[7];
37  int16_t value[3];
38  } data;
39 };
40 
41 extern struct Hmc5843 hmc5843;
42 
43 #ifndef HMC5843_NO_IRQ
44 #include "peripherals/hmc5843_arch.h"
45 
46 extern void hmc5843_arch_init(void);
47 extern void hmc5843_arch_reset(void);
48 #endif
49 
50 extern void hmc5843_init(void);
51 extern void hmc5843_periodic(void);
52 extern void hmc5843_idle_task(void);
53 
54 /* default I2C address */
55 #define HMC5843_ADDR 0x3C
56 
57 /* Registers */
58 #define HMC5843_REG_CFGA 0x00
59 #define HMC5843_REG_CFGB 0x01
60 #define HMC5843_REG_MODE 0x02
61 #define HMC5843_REG_DATXM 0x03
62 #define HMC5843_REG_DATXL 0x04
63 #define HMC5843_REG_DATYM 0x05
64 #define HMC5843_REG_DATYL 0x06
65 #define HMC5843_REG_DATZM 0x07
66 #define HMC5843_REG_DATZL 0x08
67 #define HMC5843_REG_STATUS 0x09
68 #define HMC5843_REG_IDA 0x0A
69 #define HMC5843_REG_IDB 0x0B
70 #define HMC5843_REG_IDC 0x0C
71 
72 #include <string.h>
73 
74 #endif /* HMC5843_H */
Hmc5843::timeout
uint32_t timeout
Definition: hmc5843.h:30
hmc5843_periodic
void hmc5843_periodic(void)
Definition: hmc5843.c:103
Hmc5843::data_available
uint8_t data_available
Definition: hmc5843.h:34
hmc5843_idle_task
void hmc5843_idle_task(void)
Definition: hmc5843.c:60
uint32_t
unsigned long uint32_t
Definition: types.h:18
Hmc5843::sent_tx
uint8_t sent_tx
Definition: hmc5843.h:31
Hmc5843::i2c_trans
struct i2c_transaction i2c_trans
Definition: hmc5843.h:29
hmc5843
struct Hmc5843 hmc5843
Definition: hmc5843.c:9
std.h
Hmc5843::data
union Hmc5843::@316 data
Hmc5843
Definition: hmc5843.h:28
int16_t
signed short int16_t
Definition: types.h:17
uint8_t
unsigned char uint8_t
Definition: types.h:14
Hmc5843::sent_rx
uint8_t sent_rx
Definition: hmc5843.h:32
i2c_transaction
I2C transaction structure.
Definition: i2c.h:93
hmc5843_arch_init
void hmc5843_arch_init(void)
Definition: hmc5843_arch.c:24
hmc5843_arch_reset
void hmc5843_arch_reset(void)
Definition: hmc5843_arch.c:53
Hmc5843::initialized
uint8_t initialized
Definition: hmc5843.h:33
hmc5843_init
void hmc5843_init(void)
Definition: hmc5843.c:16
i2c.h