Paparazzi UAS  v7.0_unstable
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 */
I2C transaction structure.
Definition: i2c.h:93
struct Hmc5843 hmc5843
Definition: hmc5843.c:9
uint8_t initialized
Definition: hmc5843.h:33
union Hmc5843::@310 data
uint8_t sent_rx
Definition: hmc5843.h:32
uint8_t sent_tx
Definition: hmc5843.h:31
void hmc5843_idle_task(void)
Definition: hmc5843.c:60
uint8_t data_available
Definition: hmc5843.h:34
void hmc5843_periodic(void)
Definition: hmc5843.c:103
void hmc5843_arch_init(void)
Definition: hmc5843_arch.c:24
struct i2c_transaction i2c_trans
Definition: hmc5843.h:29
uint32_t timeout
Definition: hmc5843.h:30
void hmc5843_arch_reset(void)
Definition: hmc5843_arch.c:53
void hmc5843_init(void)
Definition: hmc5843.c:16
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
short int16_t
Typedef defining 16 bit short type.
Definition: vl53l1_types.h:93
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98