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
9#pragma once
10
30#include <stdint.h>
31#include "periph/i2c.h"
32#include "fxos8700_regs.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
49#ifdef DOXYGEN
50#define CONFIG_FXOS8700_USE_ACC_RAW_VALUES
51#endif
57enum {
62 FXOS8700_BUSERR = -4
63};
64
68typedef struct {
70 uint8_t addr;
71 uint8_t acc_range;
72 uint32_t renew_interval;
74
78typedef struct {
79 int16_t x;
80 int16_t y;
81 int16_t z;
83
94
108
121
134
149
165#ifdef __cplusplus
166}
167#endif
168
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:59
@ FXOS8700_NODEV
no FXOS8700 device found on the bus
Definition fxos8700.h:61
@ FXOS8700_NOBUS
errors while initializing the I2C bus
Definition fxos8700.h:60
@ FXOS8700_BUSERR
error during I2C communication
Definition fxos8700.h:62
@ FXOS8700_OK
everything went as expected
Definition fxos8700.h:58
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:144
Low-level I2C peripheral driver interface definition.
Individual 3-axis measurement.
Definition fxos8700.h:78
int16_t y
y axis of 3-axis measurement
Definition fxos8700.h:80
int16_t x
x axis of 3-axis measurement
Definition fxos8700.h:79
int16_t z
z axis of 3-axis measurement
Definition fxos8700.h:81
Parameters needed for device initialization.
Definition fxos8700.h:68
uint8_t acc_range
Accelerator full-scale range.
Definition fxos8700.h:71
uint32_t renew_interval
Interval for cache renewal.
Definition fxos8700.h:72
uint8_t addr
I2C address of this particular sensor.
Definition fxos8700.h:70
i2c_t i2c
I2C device that sensor is connected to.
Definition fxos8700.h:69
Device descriptor for a FXOS8700 device.
Definition fxos8700.h:87
fxos8700_measurement_t mag_cached
cached 3-axis magnetic field
Definition fxos8700.h:90
fxos8700_params_t p
configuration parameters
Definition fxos8700.h:92
fxos8700_measurement_t acc_cached
cached 3-axis acceleration
Definition fxos8700.h:89
uint8_t config
sensor configuration including active mode
Definition fxos8700.h:88
uint32_t last_read_time
last time when cached data was refreshed
Definition fxos8700.h:91