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.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2013 Felix Ruess <felix.ruess@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
28#ifndef ADXL345_H
29#define ADXL345_H
30
31#include "std.h"
32
33/* Include address and register definition */
35
44
55
56static inline void adxl345_set_default_config(struct Adxl345Config *c)
57{
58 c->drdy_int_enable = false;
59 c->int_invert = true;
60 c->full_res = true;
61 c->justify_msb = false;
62 c->self_test = false;
63 c->spi_3_wire = false;
64
67}
68
70{
71 return ((c->self_test << 7) | (c->spi_3_wire << 6) | (c->int_invert << 5) |
72 (c->full_res << 3) | (c->justify_msb << 2) | (c->range));
73}
74
75#endif // ADXL345_H
bool self_test
Enable self-test-force causing shift in output data.
Definition adxl345.h:50
bool drdy_int_enable
Enable Data Ready Interrupt.
Definition adxl345.h:46
bool full_res
Full Resolution: FALSE: 10bit, TRUE: full with 4mg/LSB.
Definition adxl345.h:48
enum Adxl345Rates rate
Data Output Rate.
Definition adxl345.h:53
static void adxl345_set_default_config(struct Adxl345Config *c)
Definition adxl345.h:56
enum Adxl345Ranges range
g Range
Definition adxl345.h:52
bool int_invert
Invert Interrupt FALSE: active high, TRUE: active low.
Definition adxl345.h:47
Adxl345ConfStatus
Definition adxl345.h:36
@ ADXL_CONF_FORMAT
Definition adxl345.h:40
@ ADXL_CONF_DONE
Definition adxl345.h:42
@ ADXL_CONF_RATE
Definition adxl345.h:38
@ ADXL_CONF_INT
Definition adxl345.h:39
@ ADXL_CONF_ENABLE
Definition adxl345.h:41
@ ADXL_CONF_UNINIT
Definition adxl345.h:37
bool spi_3_wire
Set 3-wire SPI mode, if FALSE: 4-wire SPI mode.
Definition adxl345.h:51
static uint8_t adxl345_data_format(struct Adxl345Config *c)
Definition adxl345.h:69
bool justify_msb
justify: FALSE: right with sign-extension, TRUE: MSB (left)
Definition adxl345.h:49
Register and address definitions for ADXL345 accelerometer.
Adxl345Rates
Selectable data rates in ADXL345_REG_BW_RATE bandwith is always half of data rate.
@ ADXL345_RATE_100HZ
Adxl345Ranges
Selectable range in ADXL345_REG_DATA_FORMAT.
@ ADXL345_RANGE_16G
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.