SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
bhi260ap_klio_recognize_multiple.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_klio_recognize_multiple.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_BHI260_KLIO
 
#define USING_SENSOR_IRQ_METHOD
 

Functions

void dataReadyISR ()
 
void progress_callback (uint32_t total, uint32_t transferred, void *user_data)
 
void recognition_event_callback (uint8_t pattern_id, float count, void *user_data)
 Callback function for KLIO sensor recognition events.
 
void beginRecognition ()
 
void setup ()
 
void loop ()
 

Variables

SensorBHI260AP bhy
 
SensorBHI260AP_Klio klio (bhy)
 
bool force_update_flash_firmware = true
 
uint8_t action1_pattern_id = 1
 
uint8_t action1_pattern []
 
uint8_t action2_pattern_id = 2
 
const uint8_t action2_pattern []
 
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-02
Note
Changed from Boschsensortec API https://github.com/boschsensortec/BHY2_SensorAPI

Definition in file bhi260ap_klio_recognize_multiple.ino.

Macro Definition Documentation

◆ BHI260_IRQ

#define BHI260_IRQ   8

Definition at line 78 of file bhi260ap_klio_recognize_multiple.ino.

◆ BHI260_RST

#define BHI260_RST   -1

Definition at line 83 of file bhi260ap_klio_recognize_multiple.ino.

◆ BHI260_SCL

#define BHI260_SCL   3

Definition at line 73 of file bhi260ap_klio_recognize_multiple.ino.

◆ BHI260_SDA

#define BHI260_SDA   2

Definition at line 69 of file bhi260ap_klio_recognize_multiple.ino.

◆ BOSCH_BHI260_KLIO

#define BOSCH_BHI260_KLIO

Definition at line 90 of file bhi260ap_klio_recognize_multiple.ino.

◆ USE_I2C_INTERFACE

#define USE_I2C_INTERFACE

Definition at line 40 of file bhi260ap_klio_recognize_multiple.ino.

◆ USING_SENSOR_IRQ_METHOD

#define USING_SENSOR_IRQ_METHOD

Definition at line 156 of file bhi260ap_klio_recognize_multiple.ino.

Function Documentation

◆ beginRecognition()

◆ dataReadyISR()

void dataReadyISR ( )

Definition at line 162 of file bhi260ap_klio_recognize_multiple.ino.

References isInterruptTriggered.

Referenced by setup().

◆ loop()

void loop ( )

Definition at line 357 of file bhi260ap_klio_recognize_multiple.ino.

References bhy, and isInterruptTriggered.

◆ progress_callback()

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

Definition at line 169 of file bhi260ap_klio_recognize_multiple.ino.

◆ recognition_event_callback()

void recognition_event_callback ( uint8_t  pattern_id,
float  count,
void *  user_data 
)

Callback function for KLIO sensor recognition events.

This function serves as a callback that gets triggered when the KLIO sensor successfully recognizes a pattern. It's designed to handle the recognition event and provide information about the recognized pattern.

Parameters
pattern_idThe unique identifier of the recognized pattern. Each pattern in the KLIO sensor's recognition library is assigned a distinct ID, and this parameter indicates which specific pattern has been recognized.
countA floating point value representing the number of actions with the recognized pattern
user_dataA generic pointer to user - defined data. This can be used to pass additional context or information from the calling code to the callback function.

Definition at line 194 of file bhi260ap_klio_recognize_multiple.ino.

References beginRecognition(), SensorBHI260AP_Klio::disable(), and klio.

Referenced by setup().

◆ setup()

Variable Documentation

◆ action1_pattern

uint8_t action1_pattern[]
Initial value:
= {
0x52, 0x42, 0x31, 0x06, 0x03, 0xfd, 0xad, 0x80,
0x40, 0x0a, 0xd7, 0x23, 0x3c, 0x78, 0xe2, 0x44,
0xbf, 0x63, 0xe1, 0x0d, 0xc0, 0x19, 0x39, 0x97,
0xbf, 0xdb, 0x93, 0x04, 0x3f, 0xce, 0x07, 0xb7,
0x3e, 0x5e, 0xda, 0xf0, 0x3d, 0xe3, 0x6f, 0x8f,
0x3e, 0x65, 0x7c, 0x4f, 0x40, 0x46, 0x3f, 0xb4,
0x3f, 0xdf, 0xd1, 0x3d, 0xbf, 0xfa, 0x5a, 0x82,
0xbf, 0x35, 0xf6, 0x16, 0x3e, 0xbe, 0x70, 0x82,
0x40, 0xaa, 0x21, 0x70, 0x41, 0xcb, 0x27, 0xf0,
0x40, 0x19, 0x06, 0xd9, 0xbf, 0x3a, 0x10, 0xa7,
0xbf, 0x27, 0x07, 0x31, 0x3f, 0x27, 0x23, 0xc9,
0xbd, 0x44, 0x29, 0x2f, 0x40, 0xa6, 0x61, 0x97,
0xc0, 0x29, 0x5d, 0x21, 0xbe, 0x82, 0xd4, 0x0d,
0x3e, 0xc0, 0xf0, 0x15, 0x3d, 0x00, 0xbc, 0xda,
0x3d, 0x14, 0x0c, 0xc5, 0xbd, 0x46, 0xa0, 0x03,
0x3e, 0xca, 0x5c, 0x95, 0x3d, 0x24, 0xe5, 0x13,
0x3c, 0x70, 0x0a, 0x81, 0x3c, 0x69, 0x22, 0xd6,
0x3c, 0x51, 0xa4, 0xdf, 0x3e, 0x4c, 0xa8, 0x55,
0xbf, 0xe1, 0xe8, 0xc7, 0xbd, 0xe8, 0x7c, 0xbe,
0x3d, 0xf7, 0x5b, 0x21, 0x3c
}

Definition at line 106 of file bhi260ap_klio_recognize_multiple.ino.

Referenced by beginRecognition().

◆ action1_pattern_id

uint8_t action1_pattern_id = 1

Definition at line 105 of file bhi260ap_klio_recognize_multiple.ino.

Referenced by beginRecognition().

◆ action2_pattern

const uint8_t action2_pattern[]
Initial value:
= {
0x52, 0x42, 0x31, 0x06, 0x03, 0xfd, 0xad, 0x80,
0x40, 0x0a, 0xd7, 0x23, 0x3c, 0x38, 0xf3, 0x08,
0x40, 0x1a, 0x9e, 0x06, 0xbf, 0xde, 0xcd, 0xca,
0x3d, 0x88, 0xb3, 0x9b, 0x3e, 0x01, 0x26, 0xb9,
0x3d, 0x8f, 0xe9, 0x88, 0x3d, 0x6e, 0xc3, 0x13,
0xc1, 0x4f, 0x1e, 0x09, 0x40, 0x75, 0x7a, 0x2d,
0xc0, 0x80, 0x31, 0xdb, 0xbd, 0x2f, 0x1e, 0x83,
0x3f, 0xc0, 0x6f, 0x10, 0x3d, 0xf7, 0xc1, 0x26,
0xbf, 0x5a, 0x36, 0x00, 0x3f, 0x8b, 0x31, 0x77,
0xbe, 0x51, 0x09, 0x3b, 0xbf, 0x16, 0xa9, 0xa0,
0xbf, 0x6d, 0x90, 0x89, 0x3d, 0x39, 0x79, 0xb3,
0x3d, 0x39, 0x0e, 0x9f, 0xbd, 0xfc, 0x77, 0x55,
0xbd, 0x69, 0x44, 0x13, 0xbf, 0x02, 0x31, 0x14,
0x3e, 0x60, 0xe6, 0x75, 0x3b, 0xd2, 0x69, 0x19,
0xbc, 0xa8, 0x41, 0x46, 0x3d, 0x87, 0x45, 0x88,
0x3e, 0x70, 0xf7, 0x87, 0x3d, 0x81, 0x8a, 0xe2,
0x3d, 0xea, 0x15, 0x8d, 0x3b, 0xf5, 0x2e, 0xc1,
0x3c, 0x1e, 0xcc, 0x05, 0x3e, 0x00, 0x70, 0x16,
0x3c, 0x41, 0x8b, 0x07, 0xbe, 0x4e, 0xd8, 0xb0,
0x3d, 0x94, 0xd9, 0x40, 0x3b
}

Definition at line 132 of file bhi260ap_klio_recognize_multiple.ino.

Referenced by beginRecognition().

◆ action2_pattern_id

uint8_t action2_pattern_id = 2

Definition at line 131 of file bhi260ap_klio_recognize_multiple.ino.

Referenced by beginRecognition().

◆ bhy

Definition at line 86 of file bhi260ap_klio_recognize_multiple.ino.

Referenced by loop(), and setup().

◆ force_update_flash_firmware

bool force_update_flash_firmware = true

Definition at line 101 of file bhi260ap_klio_recognize_multiple.ino.

Referenced by setup().

◆ isInterruptTriggered

volatile bool isInterruptTriggered = false

Definition at line 160 of file bhi260ap_klio_recognize_multiple.ino.

Referenced by dataReadyISR(), and loop().

◆ klio