Loading...
Searching...
No Matches
bmx055.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Freie Universität Berlin
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
26#ifndef BMX055_H
27#define BMX055_H
28
29#include <stdint.h>
30
31#include "periph/i2c.h"
32#include "periph/gpio.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
50#ifndef CONFIG_BMX055_MAG_ADDR_DEFAULT
51#define CONFIG_BMX055_MAG_ADDR_DEFAULT (0x10U)
52#endif
53
61#ifndef CONFIG_BMX055_ACC_ADDR_DEFAULT
62#define CONFIG_BMX055_ACC_ADDR_DEFAULT (0x18U)
63#endif
64
72#ifndef CONFIG_BMX055_GYRO_ADDR_DEFAULT
73#define CONFIG_BMX055_GYRO_ADDR_DEFAULT (0x68U)
74#endif
80enum {
87};
88
102
112
123
127typedef struct {
129 uint8_t addr_mag;
130 uint8_t addr_acc;
131 uint8_t addr_gyro;
132 gpio_t int1_pin;
133 gpio_t int2_pin;
134 uint8_t mag_rate;
135 uint8_t acc_range;
136 uint8_t gyro_scale;
138
142typedef struct {
144} bmx055_t;
145
157int bmx055_init(bmx055_t *dev, const bmx055_params_t *params);
158
169int bmx055_mag_read(const bmx055_t *dev, int16_t *data);
170
181int bmx055_acc_read(const bmx055_t *dev, int16_t *data);
182
196int bmx055_gyro_read(const bmx055_t *dev, int16_t *data);
197
198#ifdef __cplusplus
199}
200#endif
201
202#endif /* BMX055_H */
Low-level GPIO peripheral driver interface definitions.
int bmx055_gyro_read(const bmx055_t *dev, int16_t *data)
Read angular speed value in degree per second from gyroscope.
bmx055_gyro_scale_t
Measurement scale for the gyro.
Definition bmx055.h:116
bmx055_acc_range_t
Range for Accelerometer.
Definition bmx055.h:106
int bmx055_acc_read(const bmx055_t *dev, int16_t *data)
Read acceleration value in g from accelerometer.
int bmx055_init(bmx055_t *dev, const bmx055_params_t *params)
Initialize modules magnetometer, accelerometer, gyroscope.
bmx055_mag_rate_t
Datarate for Magnetometer.
Definition bmx055.h:92
int bmx055_mag_read(const bmx055_t *dev, int16_t *data)
Read magnetic field value in Gauss per second from magnetometer.
@ BMX055_GYRO_SCALE_0125DPS
scale: 125 degree per second
Definition bmx055.h:121
@ BMX055_GYRO_SCALE_0250DPS
scale: 250 degree per second
Definition bmx055.h:120
@ BMX055_GYRO_SCALE_1000DPS
scale: 1000 degree per second
Definition bmx055.h:118
@ BMX055_GYRO_SCALE_0500DPS
scale: 500 degree per second
Definition bmx055.h:119
@ BMX055_GYRO_SCALE_2000DPS
scale: 2000 degree per second
Definition bmx055.h:117
@ BMX055_ACC_RANGE_4G
range: 4g
Definition bmx055.h:108
@ BMX055_ACC_RANGE_2G
range: 2g
Definition bmx055.h:107
@ BMX055_ACC_RANGE_8G
range: 8g
Definition bmx055.h:109
@ BMX055_ACC_RANGE_16G
range: 16g
Definition bmx055.h:110
@ BMX055_MAG_DRATE_30HZ
output data rate: 30 Hz
Definition bmx055.h:100
@ BMX055_MAG_DRATE_25HZ
output data rate: 25 Hz
Definition bmx055.h:99
@ BMX055_MAG_DRATE_15HZ
output data rate: 15 Hz
Definition bmx055.h:97
@ BMX055_MAG_DRATE_DEFAULT
output data rate: 10 Hz
Definition bmx055.h:93
@ BMX055_MAG_DRATE_02HZ
output data rate: 2 Hz
Definition bmx055.h:94
@ BMX055_MAG_DRATE_06HZ
output data rate: 6 Hz
Definition bmx055.h:95
@ BMX055_MAG_DRATE_08HZ
output data rate: 8 Hz
Definition bmx055.h:96
@ BMX055_MAG_DRATE_20HZ
output data rate: 20 Hz
Definition bmx055.h:98
@ BMX055_NOWRITE
cannot write data to module
Definition bmx055.h:85
@ BMX055_NOBUS
cannot connect to module on i2c bus
Definition bmx055.h:82
@ BMX055_OK
exit without error
Definition bmx055.h:81
@ BMX055_NOTREADY
no new data ready for reading
Definition bmx055.h:86
@ BMX055_NOREAD
cannot read data from module
Definition bmx055.h:84
@ BMX055_NODEV
cannot read any data from module
Definition bmx055.h:83
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:151
Low-level I2C peripheral driver interface definition.
Data structure holding the device parameters needed for initialization.
Definition bmx055.h:127
uint8_t mag_rate
datarate of magnetometer
Definition bmx055.h:134
uint8_t addr_acc
the accelerometer address on that bus
Definition bmx055.h:130
uint8_t gyro_scale
range of gyroscope
Definition bmx055.h:136
gpio_t int1_pin
GPIO pin connected to the INT1 line.
Definition bmx055.h:132
uint8_t acc_range
range of accelerometer
Definition bmx055.h:135
uint8_t addr_mag
the magnetometer address on that bus
Definition bmx055.h:129
uint8_t addr_gyro
the gyroscope address on that bus
Definition bmx055.h:131
gpio_t int2_pin
GPIO pin connected to the INT2 line.
Definition bmx055.h:133
i2c_t i2c
I2C bus the device is connected to.
Definition bmx055.h:128
Device descriptor for BMX055 sensors.
Definition bmx055.h:142
bmx055_params_t p
Device initialization parameters.
Definition bmx055.h:143