Loading...
Searching...
No Matches
fxos8700.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 UC Berkeley
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
28#ifndef FXOS8700_H
29#define FXOS8700_H
30
31#include <stdint.h>
32#include "periph/i2c.h"
33#include "fxos8700_regs.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
50#ifdef DOXYGEN
51#define CONFIG_FXOS8700_USE_ACC_RAW_VALUES
52#endif
58enum {
63 FXOS8700_BUSERR = -4
64};
65
69typedef struct {
71 uint8_t addr;
72 uint8_t acc_range;
73 uint32_t renew_interval;
75
79typedef struct {
80 int16_t x;
81 int16_t y;
82 int16_t z;
84
95
109
122
135
150
166#ifdef __cplusplus
167}
168#endif
169
170#endif /* FXOS8700_H */
Register definitions for FXOS8700 devices.
int fxos8700_read(const fxos8700_t *dev, fxos8700_measurement_t *acc, fxos8700_measurement_t *mag)
Convenience function for reading acceleration and magnetic field.
int fxos8700_set_active(const fxos8700_t *dev)
Convenience function for turning on the FXOS8700.
int fxos8700_read_cached(const void *dev, fxos8700_measurement_t *acc, fxos8700_measurement_t *mag)
Extended read function including caching capability.
int fxos8700_init(fxos8700_t *dev, const fxos8700_params_t *params)
Initialize an FXOS8700 device.
int fxos8700_set_idle(const fxos8700_t *dev)
Convenience function for turning off the FXOS8700.
@ FXOS8700_ADDRERR
no FXOS8700 device found on the bus
Definition fxos8700.h:60
@ FXOS8700_NODEV
no FXOS8700 device found on the bus
Definition fxos8700.h:62
@ FXOS8700_NOBUS
errors while initializing the I2C bus
Definition fxos8700.h:61
@ FXOS8700_BUSERR
error during I2C communication
Definition fxos8700.h:63
@ FXOS8700_OK
everything went as expected
Definition fxos8700.h:59
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:151
Low-level I2C peripheral driver interface definition.
Individual 3-axis measurement.
Definition fxos8700.h:79
int16_t y
y axis of 3-axis measurement
Definition fxos8700.h:81
int16_t x
x axis of 3-axis measurement
Definition fxos8700.h:80
int16_t z
z axis of 3-axis measurement
Definition fxos8700.h:82
Parameters needed for device initialization.
Definition fxos8700.h:69
uint8_t acc_range
Accelerator full-scale range.
Definition fxos8700.h:72
uint32_t renew_interval
Interval for cache renewal.
Definition fxos8700.h:73
uint8_t addr
I2C address of this particular sensor.
Definition fxos8700.h:71
i2c_t i2c
I2C device that sensor is connected to.
Definition fxos8700.h:70
Device descriptor for a FXOS8700 device.
Definition fxos8700.h:88
fxos8700_measurement_t mag_cached
cached 3-axis magnetic field
Definition fxos8700.h:91
fxos8700_params_t p
configuration parameters
Definition fxos8700.h:93
fxos8700_measurement_t acc_cached
cached 3-axis acceleration
Definition fxos8700.h:90
uint8_t config
sensor configuration including active mode
Definition fxos8700.h:89
uint32_t last_read_time
last time when cached data was refreshed
Definition fxos8700.h:92