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
lsm303dlhc_i2c.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
30#ifndef LSM303DLHC_H
31#define LSM303DLHC_H
32
33#include "std.h"
34#include "mcu_periph/i2c.h"
36
38
39#warning "The Lsm303dlhc I2C driver has not been tested. Use with caution."
40
49 volatile bool data_available;
50 union {
51 struct Int16Vect3 vect;
52 int16_t value[3];
54 union {
55 struct Lsm303dlhcAccConfig acc;
56 struct Lsm303dlhcMagConfig mag;
58};
59
60// TODO IRQ handling
61
62// Functions
63extern void lsm303dlhc_i2c_init(struct Lsm303dlhc_i2c *lsm, struct i2c_periph *i2c_p, uint8_t addr);
67
69static inline void lsm303dlhc_i2c_periodic(struct Lsm303dlhc_i2c *lsm)
70{
71 if (lsm->initialized) {
73 } else {
75 }
76}
77
78#endif /* LSM303DLHC_H */
I2C transaction structure.
Definition i2c.h:93
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
Driver for ST LSM303DLHC 3D accelerometer and magnetometer.
volatile bool data_available
data ready flag
void lsm303dlhc_i2c_read(struct Lsm303dlhc_i2c *lsm)
static void lsm303dlhc_i2c_periodic(struct Lsm303dlhc_i2c *lsm)
convenience function: read or start configuration if not already initialized
void lsm303dlhc_i2c_init(struct Lsm303dlhc_i2c *lsm, struct i2c_periph *i2c_p, uint8_t addr)
Initialize Lsm303dlhc struct and set default config options.
union Lsm303dlhc_i2c::@338 config
struct i2c_transaction i2c_trans
union Lsm303dlhc_i2c::@336 init_status
struct i2c_periph * i2c_p
bool initialized
config done flag
union Lsm303dlhc_i2c::@337 data_accel
void lsm303dlhc_i2c_event(struct Lsm303dlhc_i2c *lsm)
void lsm303dlhc_i2c_start_configure(struct Lsm303dlhc_i2c *lsm)
uint16_t foo
Definition main_demo5.c:58
Paparazzi fixed point algebra.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.