SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
bhi260ap_activity.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 bhi260ap_activity.ino:

Go to the source code of this file.

Macros

#define USE_I2C_INTERFACE
 
#define BHI260_SDA   2
 
#define BHI260_SCL   3
 
#define BHI260_IRQ   8
 
#define BHI260_RST   -1
 
#define BOSCH_APP30_SHUTTLE_BHI260_FW
 
#define USING_SENSOR_IRQ_METHOD
 

Functions

SensorActivity activity (bhy)
 
void dataReadyISR ()
 
void progress_callback (uint32_t total, uint32_t transferred, void *user_data)
 
void setup ()
 
void loop ()
 

Variables

SensorBHI260AP bhy
 
bool force_update_flash_firmware = true
 
volatile bool isInterruptTriggered = false
 

Detailed Description

@license MIT License

Copyright (c) 2025 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
2025-02-04
Note
Changed from Boschsensortec API https://github.com/boschsensortec/BHY2_SensorAPI

Definition in file bhi260ap_activity.ino.

Macro Definition Documentation

◆ BHI260_IRQ

#define BHI260_IRQ   8

Definition at line 77 of file bhi260ap_activity.ino.

◆ BHI260_RST

#define BHI260_RST   -1

Definition at line 82 of file bhi260ap_activity.ino.

◆ BHI260_SCL

#define BHI260_SCL   3

Definition at line 72 of file bhi260ap_activity.ino.

◆ BHI260_SDA

#define BHI260_SDA   2

Definition at line 68 of file bhi260ap_activity.ino.

◆ BOSCH_APP30_SHUTTLE_BHI260_FW

#define BOSCH_APP30_SHUTTLE_BHI260_FW

Definition at line 89 of file bhi260ap_activity.ino.

◆ USE_I2C_INTERFACE

#define USE_I2C_INTERFACE

Definition at line 39 of file bhi260ap_activity.ino.

◆ USING_SENSOR_IRQ_METHOD

#define USING_SENSOR_IRQ_METHOD

Definition at line 120 of file bhi260ap_activity.ino.

Function Documentation

◆ activity()

SensorActivity activity ( bhy  )

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

◆ dataReadyISR()

void dataReadyISR ( )

Definition at line 126 of file bhi260ap_activity.ino.

References isInterruptTriggered.

Referenced by setup().

◆ loop()

void loop ( )

Definition at line 238 of file bhi260ap_activity.ino.

References activity(), bhy, and isInterruptTriggered.

◆ progress_callback()

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

Definition at line 133 of file bhi260ap_activity.ino.

◆ setup()

void setup ( )

Configure the activity recognition sensor of the BHI260AP sensor.

This function sets the sampling rate and report latency for the activity recognition sensor. The sampling rate determines how often the sensor takes measurements, and the report latency determines the delay between when a measurement is taken and when it is reported. The activity recognition sensor will only be triggered when there is a change.

Parameters
samplingRateThe sampling rate of the sensor. A value greater than 1 enables the sensor, while a value of 0 disables it.
latencyMsThe report latency in milliseconds.

Definition at line 141 of file bhi260ap_activity.ino.

References activity(), BHI260_IRQ, BHI260_RST, BHI260_SCL, BHI260_SDA, bhy, dataReadyISR(), force_update_flash_firmware, SensorBHI260AP::setBootFromFlash(), SPI_MISO, SPI_MOSI, and SPI_SCK.

Variable Documentation

◆ bhy

Definition at line 85 of file bhi260ap_activity.ino.

Referenced by loop(), and setup().

◆ force_update_flash_firmware

bool force_update_flash_firmware = true

Definition at line 117 of file bhi260ap_activity.ino.

Referenced by setup().

◆ isInterruptTriggered

volatile bool isInterruptTriggered = false

Definition at line 124 of file bhi260ap_activity.ino.

Referenced by dataReadyISR(), and loop().