SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
bhi360_aux_bmm350_euler.ino File Reference

@license MIT License More...

#include <Wire.h>
#include <SPI.h>
#include <Arduino.h>
#include <ImuDrv.hpp>
#include <BoschFirmware.h>
Include dependency graph for bhi360_aux_bmm350_euler.ino:

Go to the source code of this file.

Macros

#define USE_I2C_INTERFACE
 
#define BHI360_SDA   2
 
#define BHI360_SCL   3
 
#define BHI360_IRQ   8
 
#define BHI360_RST   -1
 
#define BOSCH_SHUTTLE3_BHI360_BMM350C
 
#define USING_SENSOR_IRQ_METHOD
 

Functions

void dataReadyISR ()
 
void progress_callback (uint32_t total, uint32_t transferred, void *user_data)
 
void parse_euler_data (uint8_t sensor_id, const uint8_t *data_ptr, uint32_t len, uint64_t *timestamp, void *user_data)
 Parse the quaternion data from the sensor and convert it to Euler angles.
 
void setup ()
 
void loop ()
 

Variables

SensorBHI360 bhy
 
bool isReadyFlag = false
 

Detailed Description

@license MIT License

Copyright (c) 2026 lewis he

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.

Author
Lewis He (lewis.nosp@m.he@o.nosp@m.utloo.nosp@m.k.co.nosp@m.m)
Date
2026-02-25
Note
Changed from Boschsensortec API https://github.com/boschsensortec/BHY2_SensorAPI

Definition in file bhi360_aux_bmm350_euler.ino.

Macro Definition Documentation

◆ BHI360_IRQ

#define BHI360_IRQ   8

Definition at line 78 of file bhi360_aux_bmm350_euler.ino.

◆ BHI360_RST

#define BHI360_RST   -1

Definition at line 83 of file bhi360_aux_bmm350_euler.ino.

◆ BHI360_SCL

#define BHI360_SCL   3

Definition at line 73 of file bhi360_aux_bmm350_euler.ino.

◆ BHI360_SDA

#define BHI360_SDA   2

Definition at line 69 of file bhi360_aux_bmm350_euler.ino.

◆ BOSCH_SHUTTLE3_BHI360_BMM350C

#define BOSCH_SHUTTLE3_BHI360_BMM350C

Definition at line 113 of file bhi360_aux_bmm350_euler.ino.

◆ USE_I2C_INTERFACE

#define USE_I2C_INTERFACE

Definition at line 40 of file bhi360_aux_bmm350_euler.ino.

◆ USING_SENSOR_IRQ_METHOD

#define USING_SENSOR_IRQ_METHOD

Definition at line 132 of file bhi360_aux_bmm350_euler.ino.

Function Documentation

◆ dataReadyISR()

void dataReadyISR ( )

Definition at line 138 of file bhi360_aux_bmm350_euler.ino.

References isReadyFlag.

Referenced by setup().

◆ loop()

void loop ( )

Definition at line 326 of file bhi360_aux_bmm350_euler.ino.

References bhy, euler(), and isReadyFlag.

◆ parse_euler_data()

void parse_euler_data ( uint8_t  sensor_id,
const uint8_t *  data_ptr,
uint32_t  len,
uint64_t *  timestamp,
void *  user_data 
)

Parse the quaternion data from the sensor and convert it to Euler angles.

This function serves as a callback to handle the sensor data related to the game rotation vector. It takes the raw quaternion data received from the sensor, converts it into Euler angles (roll, pitch, and heading),

Parameters
sensor_idThe ID of the sensor that generated the data. It helps in identifying which specific sensor the data is coming from, especially in systems with multiple sensors.
data_ptrA pointer to the buffer containing the raw quaternion data. The data in this buffer represents the orientation of the sensor in quaternion format.
lenThe length of the data buffer, indicating the size of the quaternion data in bytes.
timestampA pointer to a 64 - bit unsigned integer representing the timestamp when the sensor data was captured. This can be used to correlate the data with a specific point in time.
user_dataA generic pointer to user - defined data.

Definition at line 169 of file bhi360_aux_bmm350_euler.ino.

References bhy, and timestamp.

Referenced by setup().

◆ progress_callback()

void progress_callback ( uint32_t  total,
uint32_t  transferred,
void *  user_data 
)

Definition at line 145 of file bhi360_aux_bmm350_euler.ino.

◆ setup()

void setup ( )

Set the axis remapping for the sensor based on the specified orientation.

This function allows you to configure the sensor's axis remapping according to a specific physical orientation of the chip. By passing one of the values from the SensorRemap enum, you can ensure that the sensor data is correctly interpreted based on how the chip is placed. bst-bhi260ab-ds000.pdf 20.3 Sensing axes and axes remapping

Parameters
remapAn enumeration value from SensorRemap that specifies the desired axis remapping.
Returns
Returns true if the axis remapping is successfully set; false otherwise.

Definition at line 196 of file bhi360_aux_bmm350_euler.ino.

References BHI360_IRQ, BHI360_RST, BHI360_SCL, BHI360_SDA, bhy, dataReadyISR(), euler(), parse_euler_data(), SPI_MISO, SPI_MOSI, and SPI_SCK.

Variable Documentation

◆ bhy

Definition at line 86 of file bhi360_aux_bmm350_euler.ino.

Referenced by loop(), parse_euler_data(), and setup().

◆ isReadyFlag

bool isReadyFlag = false

Definition at line 136 of file bhi360_aux_bmm350_euler.ino.

Referenced by dataReadyISR(), and loop().