Skip to content

Commit

Permalink
Rework hybrid IMU's
Browse files Browse the repository at this point in the history
  • Loading branch information
LiquidCGS committed Dec 7, 2024
1 parent 5a2c860 commit b5c6622
Show file tree
Hide file tree
Showing 77 changed files with 211 additions and 2,671 deletions.
2 changes: 1 addition & 1 deletion src/F_AK09918.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "F_AK09918.hpp"


int AK09918::init(calData cal, uint8_t address)
int AK09918::init(calData cal, uint8_t address = AK09918_DEFAULT_ADDRESS)
{
if (cal.valid == false)
{
Expand Down
3 changes: 2 additions & 1 deletion src/F_AK09918.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define AK09918_HOFL_BIT 0x08 // Sensor Over Flow
#define AK09918_DOR_BIT 0x02 // Data Over Run
#define AK09918_DRDY_BIT 0x01 // Data Ready
#define AK09918_DEFAULT_ADDRESS 0x0C

enum AK09918_mode_type_t {
AK09918_POWER_DOWN = 0x00,
Expand Down Expand Up @@ -62,7 +63,7 @@ class AK09918 : public IMUBase {
explicit AK09918(TwoWire& wire = Wire) : wire(wire) {};

// Inherited via IMUBase
int init(calData cal, uint8_t address) override;
int init(calData cal, uint8_t address = AK09918_DEFAULT_ADDRESS) override;

void update() override;
void getAccel(AccelData* out) override;
Expand Down
2 changes: 1 addition & 1 deletion src/F_AK8963.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "F_AK8963.hpp"


int AK8963::init(calData cal, uint8_t address)
int AK8963::init(calData cal, uint8_t address = AK8963_DEFAULT_ADDRESS)
{
//initialize address variable and calibration data.
IMUAddress = address;
Expand Down
3 changes: 2 additions & 1 deletion src/F_AK8963.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
#define AK8963_ASAX 0x10 // Fuse ROM x-axis sensitivity adjustment value
#define AK8963_ASAY 0x11 // Fuse ROM y-axis sensitivity adjustment value
#define AK8963_ASAZ 0x12 // Fuse ROM z-axis sensitivity adjustment value
#define AK8963_DEFAULT_ADDRESS 0x0C


class AK8963 : public IMUBase {
public:
explicit AK8963(TwoWire& wire = Wire) : wire(wire) {};

// Inherited via IMUBase
int init(calData cal, uint8_t address) override;
int init(calData cal, uint8_t address = AK8963_DEFAULT_ADDRESS) override;

void update() override;
void getAccel(AccelData* out) override;
Expand Down
2 changes: 1 addition & 1 deletion src/F_AK8975.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "F_AK8975.hpp"


int AK8975::init(calData cal, uint8_t address)
int AK8975::init(calData cal, uint8_t address = AK8975_DEFAULT_ADDRESS)
{
//initialize address variable and calibration data.
IMUAddress = address;
Expand Down
4 changes: 2 additions & 2 deletions src/F_AK8975.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
#define AK8975_ASAX 0x10 // Fuse ROM x-axis sensitivity adjustment value
#define AK8975_ASAY 0x11 // Fuse ROM y-axis sensitivity adjustment value
#define AK8975_ASAZ 0x12 // Fuse ROM z-axis sensitivity adjustment value

#define AK8975_DEFAULT_ADDRESS 0x0C

class AK8975 : public IMUBase {
public:
explicit AK8975(TwoWire& wire = Wire) : wire(wire) {};

// Inherited via IMUBase
int init(calData cal, uint8_t address) override;
int init(calData cal, uint8_t address = AK8975_DEFAULT_ADDRESS) override;

void update() override;
void getAccel(AccelData* out) override;
Expand Down
2 changes: 1 addition & 1 deletion src/F_BMI055.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "F_BMI055.hpp"

int BMI055::init(calData cal, uint8_t address)
int BMI055::init(calData cal, uint8_t address = BMI055_DEFAULT_ADDRESS)
{
//initialize address variable and calibration data.
if (address == 0x18 || address == 0x68) {
Expand Down
4 changes: 2 additions & 2 deletions src/F_BMI055.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
#define BMI055_GYR_BW 0x10
#define BMI055_GYR_LPM1 0x11
#define BMI055_GYR_BGW_SOFTRESET 0x14

#define BMI055_DEFAULT_ADDRESS 0x18

class BMI055 : public IMUBase {
public:
explicit BMI055(TwoWire& wire = Wire) : wire(wire) {};

// Inherited via IMUBase
int init(calData cal, uint8_t address) override;
int init(calData cal, uint8_t address = BMI055_DEFAULT_ADDRESS) override;

void update() override;
void getAccel(AccelData* out) override;
Expand Down
76 changes: 0 additions & 76 deletions src/F_BMI055_AK8975.hpp

This file was deleted.

76 changes: 0 additions & 76 deletions src/F_BMI055_HMC5883L.hpp

This file was deleted.

76 changes: 0 additions & 76 deletions src/F_BMI055_QMC5883L.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion src/F_BMI160.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//Original code: https://github.com/hideakitai/MPU9250/blob/master/MPU9250.h

int BMI160::init(calData cal, uint8_t address)
int BMI160::init(calData cal, uint8_t address = BMI160_DEFAULT_ADDRESS)
{
//initialize address variable and calibration data.
IMUAddress = address;
Expand Down
3 changes: 2 additions & 1 deletion src/F_BMI160.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@
#define BMI160_ERR_REG 0x02
#define BMI160_CHIP_ID 0x00
#define BMI160_CHIP_ID_DEFAULT_VALUE 0xD1
#define BMI160_DEFAULT_ADDRESS 0x69

class BMI160 : public IMUBase {
public:
explicit BMI160(TwoWire& wire = Wire) : wire(wire) {};

// Inherited via IMUBase
int init(calData cal, uint8_t address) override;
int init(calData cal, uint8_t address = BMI160_DEFAULT_ADDRESS) override;

void update() override;
void getAccel(AccelData* out) override;
Expand Down
Loading

0 comments on commit b5c6622

Please sign in to comment.