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
adxl345_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
29#ifndef ADXL345_I2C_H
30#define ADXL345_I2C_H
31
32#include "std.h"
34#include "mcu_periph/i2c.h"
35
36/* Include common ADXL345 options and definitions */
37#include "peripherals/adxl345.h"
38
44 volatile bool data_available;
45 union {
46 struct Int16Vect3 vect;
47 int16_t value[3];
50};
51
52// Functions
53extern void adxl345_i2c_init(struct Adxl345_I2c *adxl, struct i2c_periph *i2c_p, uint8_t addr);
55extern void adxl345_i2c_read(struct Adxl345_I2c *adxl);
56extern void adxl345_i2c_event(struct Adxl345_I2c *adxl);
57
59static inline void adxl345_i2c_periodic(struct Adxl345_I2c *adxl)
60{
61 if (adxl->initialized) {
63 } else {
65 }
66}
67
68#endif // ADXL345_I2C_H
Analog Devices ADXL345 accelerometer driver common interface (I2C and SPI).
Adxl345ConfStatus
Definition adxl345.h:36
void adxl345_i2c_start_configure(struct Adxl345_I2c *adxl)
Start configuration if not already done.
Definition adxl345_i2c.c:90
void adxl345_i2c_read(struct Adxl345_I2c *adxl)
struct Adxl345Config config
Definition adxl345_i2c.h:49
volatile bool data_available
data ready flag
Definition adxl345_i2c.h:44
bool initialized
config done flag
Definition adxl345_i2c.h:43
struct i2c_periph * i2c_p
Definition adxl345_i2c.h:40
enum Adxl345ConfStatus init_status
init status
Definition adxl345_i2c.h:42
static void adxl345_i2c_periodic(struct Adxl345_I2c *adxl)
convenience function: read or start configuration if not already initialized
Definition adxl345_i2c.h:59
void adxl345_i2c_init(struct Adxl345_I2c *adxl, struct i2c_periph *i2c_p, uint8_t addr)
Definition adxl345_i2c.c:36
union Adxl345_I2c::@308 data
void adxl345_i2c_event(struct Adxl345_I2c *adxl)
struct i2c_transaction i2c_trans
Definition adxl345_i2c.h:41
I2C transaction structure.
Definition i2c.h:93
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
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.