Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
flybrianfly committed Nov 18, 2018
1 parent 3874b2d commit 5c2dace
Show file tree
Hide file tree
Showing 14 changed files with 3,161 additions and 1 deletion.
548 changes: 547 additions & 1 deletion README.md

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions examples/Basic_I2C/Basic_I2C.ino
@@ -0,0 +1,74 @@
/*
* Brian R Taylor
* brian.taylor@bolderflight.com
*
* Copyright (c) 2018 Bolder Flight Systems
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "BMI088.h"

/* accel object */
Bmi088Accel accel(Wire,0x18);
/* gyro object */
Bmi088Gyro gyro(Wire,0x68);

void setup()
{
int status;
/* USB Serial to print data */
Serial.begin(115200);
while(!Serial) {}
/* start the sensors */
status = accel.begin();
if (status < 0) {
Serial.println("Accel Initialization Error");
Serial.println(status);
while (1) {}
}
status = gyro.begin();
if (status < 0) {
Serial.println("Gyro Initialization Error");
Serial.println(status);
while (1) {}
}
}

void loop()
{
/* read the accel */
accel.readSensor();
/* read the gyro */
gyro.readSensor();
/* print the data */
Serial.print(accel.getAccelX_mss());
Serial.print("\t");
Serial.print(accel.getAccelY_mss());
Serial.print("\t");
Serial.print(accel.getAccelZ_mss());
Serial.print("\t");
Serial.print(gyro.getGyroX_rads());
Serial.print("\t");
Serial.print(gyro.getGyroY_rads());
Serial.print("\t");
Serial.print(gyro.getGyroZ_rads());
Serial.print("\t");
Serial.print(accel.getTemperature_C());
Serial.print("\n");
/* delay to help with printing */
delay(20);
}
74 changes: 74 additions & 0 deletions examples/Basic_SPI/Basic_SPI.ino
@@ -0,0 +1,74 @@
/*
* Brian R Taylor
* brian.taylor@bolderflight.com
*
* Copyright (c) 2018 Bolder Flight Systems
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "BMI088.h"

/* accel object */
Bmi088Accel accel(SPI,10);
/* gyro object */
Bmi088Gyro gyro(SPI,9);

void setup()
{
int status;
/* USB Serial to print data */
Serial.begin(115200);
while(!Serial) {}
/* start the sensors */
status = accel.begin();
if (status < 0) {
Serial.println("Accel Initialization Error");
Serial.println(status);
while (1) {}
}
status = gyro.begin();
if (status < 0) {
Serial.println("Gyro Initialization Error");
Serial.println(status);
while (1) {}
}
}

void loop()
{
/* read the accel */
accel.readSensor();
/* read the gyro */
gyro.readSensor();
/* print the data */
Serial.print(accel.getAccelX_mss());
Serial.print("\t");
Serial.print(accel.getAccelY_mss());
Serial.print("\t");
Serial.print(accel.getAccelZ_mss());
Serial.print("\t");
Serial.print(gyro.getGyroX_rads());
Serial.print("\t");
Serial.print(gyro.getGyroY_rads());
Serial.print("\t");
Serial.print(gyro.getGyroZ_rads());
Serial.print("\t");
Serial.print(accel.getTemperature_C());
Serial.print("\n");
/* delay to help with printing */
delay(20);
}
101 changes: 101 additions & 0 deletions examples/Int_I2C/Int_I2C.ino
@@ -0,0 +1,101 @@
/*
* Brian R Taylor
* brian.taylor@bolderflight.com
*
* Copyright (c) 2018 Bolder Flight Systems
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "BMI088.h"

/* accel object */
Bmi088Accel accel(Wire,0x18);
/* gyro object */
Bmi088Gyro gyro(Wire,0x68);

volatile bool accel_flag, gyro_flag;

void accel_drdy()
{
accel_flag = true;
}

void gyro_drdy()
{
gyro_flag = true;
}

void setup()
{
int status;
/* USB Serial to print data */
Serial.begin(115200);
while(!Serial) {}
/* start the sensors */
status = accel.begin();
if (status < 0) {
Serial.println("Accel Initialization Error");
Serial.println(status);
while (1) {}
}
status = accel.setOdr(Bmi088Accel::ODR_100HZ_BW_19HZ);
status = accel.pinModeInt1(Bmi088Accel::PUSH_PULL,Bmi088Accel::ACTIVE_HIGH);
status = accel.mapDrdyInt1(true);


status = gyro.begin();
if (status < 0) {
Serial.println("Gyro Initialization Error");
Serial.println(status);
while (1) {}
}
status = gyro.setOdr(Bmi088Gyro::ODR_100HZ_BW_12HZ);
status = gyro.pinModeInt3(Bmi088Gyro::PUSH_PULL,Bmi088Gyro::ACTIVE_HIGH);
status = gyro.mapDrdyInt3(true);

pinMode(3,INPUT);
attachInterrupt(3,accel_drdy,RISING);
pinMode(4,INPUT);
attachInterrupt(4,gyro_drdy,RISING);
}

void loop()
{
if (accel_flag && gyro_flag) {
accel_flag = false;
gyro_flag = false;
/* read the accel */
accel.readSensor();
/* read the gyro */
gyro.readSensor();
/* print the data */
Serial.print(accel.getAccelX_mss());
Serial.print("\t");
Serial.print(accel.getAccelY_mss());
Serial.print("\t");
Serial.print(accel.getAccelZ_mss());
Serial.print("\t");
Serial.print(gyro.getGyroX_rads());
Serial.print("\t");
Serial.print(gyro.getGyroY_rads());
Serial.print("\t");
Serial.print(gyro.getGyroZ_rads());
Serial.print("\t");
Serial.print(accel.getTemperature_C());
Serial.print("\n");
}
}
107 changes: 107 additions & 0 deletions examples/Sync_SPI/Sync_SPI.ino
@@ -0,0 +1,107 @@
/*
* Brian R Taylor
* brian.taylor@bolderflight.com
*
* Copyright (c) 2018 Bolder Flight Systems
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "BMI088.h"

/* BMI088 object */
Bmi088 bmi(SPI,10,9);

void drdy()
{
/* read the imu */
bmi.readSensor();
/* print the data */
Serial.print(bmi.getAccelX_mss());
Serial.print("\t");
Serial.print(bmi.getAccelY_mss());
Serial.print("\t");
Serial.print(bmi.getAccelZ_mss());
Serial.print("\t");
Serial.print(bmi.getGyroX_rads());
Serial.print("\t");
Serial.print(bmi.getGyroY_rads());
Serial.print("\t");
Serial.print(bmi.getGyroZ_rads());
Serial.print("\t");
Serial.print(bmi.getTemperature_C());
Serial.print("\n");
}

void setup()
{
int status;
/* USB Serial to print data */
Serial.begin(115200);
while(!Serial) {}
/* start the sensors */
status = bmi.begin();
if (status < 0) {
Serial.println("IMU Initialization Error");
Serial.println(status);
while (1) {}
}
/* set the ranges */
status = bmi.setRange(Bmi088::ACCEL_RANGE_6G,Bmi088::GYRO_RANGE_500DPS);
if (status < 0) {
Serial.println("Failed to set ranges");
Serial.println(status);
while (1) {}
}
/* set the output data rate */
status = bmi.setOdr(Bmi088::ODR_400HZ);
if (status < 0) {
Serial.println("Failed to set ODR");
Serial.println(status);
while (1) {}
}
/* specify whether to use pin 3 or pin 4 to loop back the gyro interrupt */
status = bmi.mapSync(Bmi088::PIN_3);
if (status < 0) {
Serial.println("Failed to map sync pin");
Serial.println(status);
while (1) {}
}
/*
* specify whether to use pin 1 or pin 2 to indicate data ready, the other pin will be used
* for gyro interrupt input
*/
status = bmi.mapDrdy(Bmi088::PIN_2);
if (status < 0) {
Serial.println("Failed to map data ready pin");
Serial.println(status);
while (1) {}
}
/* set the data ready pin to push-pull and active high */
status = bmi.pinModeDrdy(Bmi088::PUSH_PULL,Bmi088::ACTIVE_HIGH);
if (status < 0) {
Serial.println("Failed to setup data ready pin");
Serial.println(status);
while (1) {}
}
/* attach the corresponding uC pin to an interrupt */
pinMode(1,INPUT);
attachInterrupt(1,drdy,RISING);
}

void loop()
{
}
Binary file added extras/BMI088_Shuttleboardflyer_BST_20171211.pdf
Binary file not shown.
Binary file added extras/BST-BMI088-DS001.pdf
Binary file not shown.
Binary file added extras/BST-BMI08x-AN002.pdf
Binary file not shown.
Binary file added extras/BST-MIS-HS000-02.pdf
Binary file not shown.
Binary file added extras/Bosch_Sensortec_Product_flyer_BMI088.pdf
Binary file not shown.
27 changes: 27 additions & 0 deletions keywords.txt
@@ -0,0 +1,27 @@
Bmi088Accel KEYWORD1
Bmi088Gyro KEYWORD1
Bmi088 KEYWORD1
begin KEYWORD2
setOdr KEYWORD2
setRange KEYWORD2
pinModeInt1 KEYWORD2
pinModeInt2 KEYWORD2
pinModeInt3 KEYWORD2
pinModeInt4 KEYWORD2
mapDrdyInt1 KEYWORD2
mapDrdyInt2 KEYWORD2
mapDrdyInt3 KEYWORD2
mapDrdyInt4 KEYWORD2
mapDrdy KEYWORD2
mapSync KEYWORD2
pinModeDrdy KEYWORD2
getDrdyStatus KEYWORD2
readSensor KEYWORD2
getAccelX_mss KEYWORD2
getAccelY_mss KEYWORD2
getAccelZ_mss KEYWORD2
getGyroX_rads KEYWORD2
getGyroY_rads KEYWORD2
getGyroZ_rads KEYWORD2
getTemperature_C KEYWORD2
getTime_ps KEYWORD2
10 changes: 10 additions & 0 deletions library.properties
@@ -0,0 +1,10 @@
name=Bolder Flight Systems BMI088
version=1.0.0
author=Brian Taylor <brian.taylor@bolderflight.com>
maintainer=Brian Taylor <brian.taylor@bolderflight.com>
sentence=Library for communicating with the Bosch BMI088 6 axis IMU.
paragraph=This library supports both I2C and SPI communication with the BMI088 along with accessing the BMI088 advanced features, such as synchronized output.
category=Sensors
url=https://github.com/bolderflight/BMI088
architectures=*
includes=BMI088.h

0 comments on commit 5c2dace

Please sign in to comment.