Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
lsm303dlhc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3  * 2013 Felix Ruess <felix.ruess@gmail.com>
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22 
28 #ifndef LSM303_H
29 #define LSM303_H
30 
31 #include "std.h"
32 /* Address and register definitions */
34 
35 /* LSM303DLHC default conf */
36 #ifndef LSM303DLHC_DEFAULT_AODR
37 #define LSM303DLHC_DEFAULT_AODR (0x01 << 4) //acc 3125 Hz
38 #endif
39 
40 #ifndef LSM303DLHC_DEFAULT_AFS
41 #define LSM303DLHC_DEFAULT_AFS (0x04 <<3) // acc +- 16G
42 #endif
43 
44 #ifndef LSM303DLHC_DEFAULT_MODR
45 #define LSM303DLHC_DEFAULT_MODR (0x5 << 2) // Magneto Data Output Rate (100Hz)
46 #endif
47 
48 #ifndef LSM303DLHC_DEFAULT_MFS
49 #define LSM303DLHC_DEFAULT_MFS (0x0 << 5) // Magneto gain configuration (+/- 2 Gauss)
50 #endif
51 
52 #ifndef LSM303DLHC_DEFAULT_MD
53 #define LSM303DLHC_DEFAULT_MD (0x00 << 0) // Magneto continious conversion mode
54 #endif
55 
59 };
60 
65 };
66 
79 };
80 
84 };
85 
87 {
88  c->rate = LSM303DLHC_DEFAULT_AODR;
89  c->scale = LSM303DLHC_DEFAULT_AFS;
90 }
91 
93 {
94  c->rate = LSM303DLHC_DEFAULT_MODR;
95  c->scale = LSM303DLHC_DEFAULT_MFS;
96  c->mode = LSM303DLHC_DEFAULT_MD;
97 }
98 #endif // LSM303_H
LSM_CONF_CTRL_REG4
@ LSM_CONF_CTRL_REG4
Definition: lsm303dlhc.h:74
Lsm303dlhcMagConfig
Definition: lsm303dlhc.h:61
c
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
LSM303DLHC_DEFAULT_MFS
#define LSM303DLHC_DEFAULT_MFS
Definition: lsm303dlhc.h:49
Lsm303dlhcAccConfig::scale
uint8_t scale
full scale selection (m/s²)
Definition: lsm303dlhc.h:58
LSM_CONF_CTRL_REG6
@ LSM_CONF_CTRL_REG6
Definition: lsm303dlhc.h:76
LSM303DLHC_DEFAULT_MODR
#define LSM303DLHC_DEFAULT_MODR
Definition: lsm303dlhc.h:45
Lsm303dlhcAccConfig::rate
uint8_t rate
Data Output Rate (Hz)
Definition: lsm303dlhc.h:57
LSM_CONF_WHO_AM_I
@ LSM_CONF_WHO_AM_I
Definition: lsm303dlhc.h:70
LSM_TARGET_MAG
@ LSM_TARGET_MAG
Definition: lsm303dlhc.h:83
std.h
LSM_CONF_CTRL_REG7
@ LSM_CONF_CTRL_REG7
Definition: lsm303dlhc.h:77
Lsm303dlhcTarget
Lsm303dlhcTarget
Definition: lsm303dlhc.h:81
Lsm303dlhcMagConfig::scale
uint8_t scale
Full scale gain configuration (Gauss)
Definition: lsm303dlhc.h:63
Lsm303dlhcConfStatus
Lsm303dlhcConfStatus
config status states
Definition: lsm303dlhc.h:68
LSM303DLHC_DEFAULT_MD
#define LSM303DLHC_DEFAULT_MD
Definition: lsm303dlhc.h:53
LSM_TARGET_ACC
@ LSM_TARGET_ACC
Definition: lsm303dlhc.h:82
Lsm303dlhcAccConfig
Definition: lsm303dlhc.h:56
uint8_t
unsigned char uint8_t
Definition: types.h:14
Lsm303dlhcMagConfig::mode
uint8_t mode
Measurement mode.
Definition: lsm303dlhc.h:64
LSM_CONF_UNINIT
@ LSM_CONF_UNINIT
Definition: lsm303dlhc.h:69
lsm303dlhc_acc_set_default_config
static void lsm303dlhc_acc_set_default_config(struct Lsm303dlhcAccConfig *c)
Definition: lsm303dlhc.h:86
LSM_CONF_CTRL_REG3
@ LSM_CONF_CTRL_REG3
Definition: lsm303dlhc.h:73
LSM_CONF_CTRL_REG5
@ LSM_CONF_CTRL_REG5
Definition: lsm303dlhc.h:75
LSM_CONF_CTRL_REG2
@ LSM_CONF_CTRL_REG2
Definition: lsm303dlhc.h:72
LSM_CONF_CTRL_REG1
@ LSM_CONF_CTRL_REG1
Definition: lsm303dlhc.h:71
LSM303DLHC_DEFAULT_AODR
#define LSM303DLHC_DEFAULT_AODR
Definition: lsm303dlhc.h:37
LSM_CONF_DONE
@ LSM_CONF_DONE
Definition: lsm303dlhc.h:78
lsm303dlhc_mag_set_default_config
static void lsm303dlhc_mag_set_default_config(struct Lsm303dlhcMagConfig *c)
Definition: lsm303dlhc.h:92
LSM303DLHC_DEFAULT_AFS
#define LSM303DLHC_DEFAULT_AFS
Definition: lsm303dlhc.h:41
Lsm303dlhcMagConfig::rate
uint8_t rate
Data Output Rate Bits (Hz)
Definition: lsm303dlhc.h:62
lsm303dlhc_regs.h