Skip to content

Commit

Permalink
began Bno055Interface structure
Browse files Browse the repository at this point in the history
  • Loading branch information
a-day-old-bagel committed Jul 7, 2016
1 parent 2f782e3 commit f1f2b86
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Bno055Interface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// Created by volundr on 7/6/16.
//

#include "Bno055Interface.h"

namespace bno055 {

}
18 changes: 18 additions & 0 deletions Bno055Interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Created by volundr on 7/6/16.
//

#ifndef BNO055_BNO055INTERFACE_H
#define BNO055_BNO055INTERFACE_H

#include "bno055Enum.h"

namespace bno055 {

class Bno055Interface {

};

}

#endif //BNO055_BNO055INTERFACE_H
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ endif()

set( LIBS ${LIBS} )
set( INCLUDE_DIRS ${INCLUDE_DIRS} )
set( SOURCE_FILES ${SOURCE_FILES} )
set( SOURCE_FILES ${SOURCE_FILES}
Bno055Interface.cpp
Bno055Interface.h
bno055Enum.h)

# Build
include_directories( ${INCLUDE_DIRS} )
Expand Down
4 changes: 3 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
An attempt to communicate with the bosch BNO055 using only standard linux headers as per the general guide at http://www.raspberry-projects.com/pi/programming-in-c/uart-serial-port/using-the-uart
An attempt to communicate with the bosch BNO055 over UART in C++ using
only standard linux headers as per the general guide at http://www.raspberry-projects.com/pi/programming-in-c/uart-serial-port/using-the-uart
(designed for the Pi)
215 changes: 215 additions & 0 deletions bno055Enum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
//
// Created by volundr on 7/6/16.
//

#ifndef BNO055_BNO055ENUM_H
#define BNO055_BNO055ENUM_H

#include <stdint.h>

namespace bno055 {

enum Registers {

PAGE_ID=0x07,

PAGE0_CHIP_ID=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NM_SET,
PAGE1_GYR_INT_SET,
PAGE1_GYR_HR_X_SET,
PAGE1_GYR_DUR_X,
PAGE1_GYR_HR_Y_SET,
PAGE1_GYR_DUR_Y,
PAGE1_GYR_HR_Z_SET,
PAGE1_GYR_DUR_Z,
PAGE1_GYR_AM_THRES,
PAGE1_GYR_AM_SET,

//RESERVED

PAGE1_UNIQE_ID_B0=0x50,
PAGE1_UNIQE_ID_B1=0x51,
PAGE1_UNIQE_ID_B2=0x52,
PAGE1_UNIQE_ID_B3=0x53,
PAGE1_UNIQE_ID_B4=0x54,
PAGE1_UNIQE_ID_B5=0x55,
PAGE1_UNIQE_ID_B6=0x56,
PAGE1_UNIQE_ID_B7=0x57,
PAGE1_UNIQE_ID_B8=0x58,
PAGE1_UNIQE_ID_B9=0x59,
PAGE1_UNIQE_ID_BA=0x5A,
PAGE1_UNIQE_ID_BB=0x5B,
PAGE1_UNIQE_ID_BC=0x5C,
PAGE1_UNIQE_ID_BD=0x5D,
PAGE1_UNIQE_ID_BE=0x5E,
PAGE1_UNIQE_ID_BF=0x5F,

//RESERVED

};

enum OpMode {
OP_MODE_CONFIG,
OP_MODE_ACCONLY,
OP_MODE_MAGONLY,
OP_MODE_GYROONLY,
OP_MODE_ACCMAG,
OP_MODE_ACCGYRO,
OP_MODE_MAGGYRO,
OP_MODE_AMG,
OP_MODE_IMU,
OP_MODE_COMPASS,
OP_MODE_M4G,
OP_MODE_NDOF_FMC_OFF,
OP_MODE_NDOF,
};


enum PowerMode {
PWR_MODE_NORMAL,
PWR_MODE_LOW,
PWR_MODE_SUSPEND
};

struct ImuData {
union {
struct {
int16_t AccelX;//0 1
int16_t AccelY;//2 3
int16_t AccelZ;//4 5
int16_t MagnetX;//6 7
int16_t MagnetY;//8 9
int16_t MagnetZ;//10 11
int16_t GyroX;//12 13
int16_t GyroY;//14 15
int16_t GyroZ;//16 17
int16_t Heading;//18 19
int16_t Roll;//20 21
int16_t Pitch;//22 23
int16_t QuatW;// 24 25
int16_t QuatX;// 26 27
int16_t QuatY;// 28 29
int16_t QuatZ;// 30 31
int16_t LinAccelX;//32 33
int16_t LinAccelY;//34 35
int16_t LinAccelZ;//36 37
int16_t GravX;//38 39
int16_t GravY;//40 41
int16_t GravZ;//42 43
} imu;
uint16_t imuArray[22];
};
int8_t temp;
uint8_t calibration;
};

}

#endif //BNO055_BNO055ENUM_H

0 comments on commit f1f2b86

Please sign in to comment.