You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
5 years ago
|
#pragma once
|
||
|
|
||
2 years ago
|
#include "system/sensord/sensors/i2c_sensor.h"
|
||
5 years ago
|
|
||
|
// Address of the chip on the bus
|
||
|
#define BMX055_ACCEL_I2C_ADDR 0x18
|
||
|
|
||
|
// Registers of the chip
|
||
|
#define BMX055_ACCEL_I2C_REG_ID 0x00
|
||
4 years ago
|
#define BMX055_ACCEL_I2C_REG_X_LSB 0x02
|
||
5 years ago
|
#define BMX055_ACCEL_I2C_REG_TEMP 0x08
|
||
5 years ago
|
#define BMX055_ACCEL_I2C_REG_BW 0x10
|
||
3 years ago
|
#define BMX055_ACCEL_I2C_REG_PMU 0x11
|
||
5 years ago
|
#define BMX055_ACCEL_I2C_REG_HBW 0x13
|
||
|
#define BMX055_ACCEL_I2C_REG_FIFO 0x3F
|
||
|
|
||
|
// Constants
|
||
|
#define BMX055_ACCEL_CHIP_ID 0xFA
|
||
|
|
||
|
#define BMX055_ACCEL_HBW_ENABLE 0b10000000
|
||
|
#define BMX055_ACCEL_HBW_DISABLE 0b00000000
|
||
3 years ago
|
#define BMX055_ACCEL_DEEP_SUSPEND 0b00100000
|
||
|
#define BMX055_ACCEL_NORMAL_MODE 0b00000000
|
||
5 years ago
|
|
||
|
#define BMX055_ACCEL_BW_7_81HZ 0b01000
|
||
|
#define BMX055_ACCEL_BW_15_63HZ 0b01001
|
||
|
#define BMX055_ACCEL_BW_31_25HZ 0b01010
|
||
|
#define BMX055_ACCEL_BW_62_5HZ 0b01011
|
||
|
#define BMX055_ACCEL_BW_125HZ 0b01100
|
||
|
#define BMX055_ACCEL_BW_250HZ 0b01101
|
||
|
#define BMX055_ACCEL_BW_500HZ 0b01110
|
||
|
#define BMX055_ACCEL_BW_1000HZ 0b01111
|
||
|
|
||
|
class BMX055_Accel : public I2CSensor {
|
||
|
uint8_t get_device_address() {return BMX055_ACCEL_I2C_ADDR;}
|
||
|
public:
|
||
|
BMX055_Accel(I2CBus *bus);
|
||
|
int init();
|
||
3 years ago
|
bool get_event(MessageBuilder &msg, uint64_t ts = 0);
|
||
3 years ago
|
int shutdown();
|
||
5 years ago
|
};
|