Loading...
Searching...
No Matches
fxos8700.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 UC Berkeley
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
26
27#include <stdint.h>
28#include "periph/i2c.h"
29#include "fxos8700_regs.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
46#ifdef DOXYGEN
47#define CONFIG_FXOS8700_USE_ACC_RAW_VALUES
48#endif
50
54enum {
60};
61
65typedef struct {
67 uint8_t addr;
68 uint8_t acc_range;
69 uint32_t renew_interval;
71
75typedef struct {
76 int16_t x;
77 int16_t y;
78 int16_t z;
80
91
105
118
131
146
162#ifdef __cplusplus
163}
164#endif
165
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:56
@ FXOS8700_NODEV
no FXOS8700 device found on the bus
Definition fxos8700.h:58
@ FXOS8700_NOBUS
errors while initializing the I2C bus
Definition fxos8700.h:57
@ FXOS8700_BUSERR
error during I2C communication
Definition fxos8700.h:59
@ FXOS8700_OK
everything went as expected
Definition fxos8700.h:55
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
Low-level I2C peripheral driver interface definition.
Individual 3-axis measurement.
Definition fxos8700.h:75
int16_t y
y axis of 3-axis measurement
Definition fxos8700.h:77
int16_t x
x axis of 3-axis measurement
Definition fxos8700.h:76
int16_t z
z axis of 3-axis measurement
Definition fxos8700.h:78
Parameters needed for device initialization.
Definition fxos8700.h:65
uint8_t acc_range
Accelerator full-scale range.
Definition fxos8700.h:68
uint32_t renew_interval
Interval for cache renewal.
Definition fxos8700.h:69
uint8_t addr
I2C address of this particular sensor.
Definition fxos8700.h:67
i2c_t i2c
I2C device that sensor is connected to.
Definition fxos8700.h:66
Device descriptor for a FXOS8700 device.
Definition fxos8700.h:84
fxos8700_measurement_t mag_cached
cached 3-axis magnetic field
Definition fxos8700.h:87
fxos8700_params_t p
configuration parameters
Definition fxos8700.h:89
fxos8700_measurement_t acc_cached
cached 3-axis acceleration
Definition fxos8700.h:86
uint8_t config
sensor configuration including active mode
Definition fxos8700.h:85
uint32_t last_read_time
last time when cached data was refreshed
Definition fxos8700.h:88