You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Arduino_BHY2/docs/readme.md
+6-9Lines changed: 6 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,9 @@
1
1
# Bosch BHY2 Sensor Library for Arduino
2
2
3
-
The Bosch BHY2 Sensor Library provides an interface with the [Bosch BHY2-Sensor-API](https://github.com/BoschSensortec/BHY2-Sensor-API) for communicating with the BHI260AP and a custom library for the BME688 sensors of the Nicla Sense ME.
4
-
3
+
This library allows the Nicla Sense ME to interface with the onboard 6-axis IMU (BHI260AP) and environmental sensor (BME688).
5
4
## Features
6
5
7
-
- Easy access to data from Nicla Sense ME sensors
6
+
- Easy access to data from Nicla Sense ME sensors using sensor ID
8
7
- Wrapper for [Bosch BHY2-Sensor-API](https://github.com/BoschSensortec/BHY2-Sensor-API)
9
8
- DFU (Device Firmware Update) of the ANNA-B112 and the BHI260AP
10
9
- All functionality avaliable over both ESLOV and BLE
@@ -31,18 +30,16 @@ A UML diagram of the main library classes are provided in the diagram below, pro
31
30
32
31
For additional information on the Arduino_BHY2 library (including a list of Sensor IDs) and how you can use it with the Nicla Sense ME, see the [Arduino Nicla Sense ME Cheat Sheet](https://docs.arduino.cc/tutorials/nicla-sense-me/cheat-sheet) page.
33
32
34
-
35
-
36
33
## Examples
37
34
38
35
-[App](https://github.com/arduino-libraries/Arduino_BHY2/blob/main/examples/App/App.ino) : Control Nicla Sense ME from an external device acting as a host via I2C or ESLOV
39
36
-[AppLowDelay](https://github.com/arduino-libraries/Arduino_BHY2/blob/main/examples/AppLowDelay/AppLowDelay.ino) : Control Nicla Sense ME from an external device acting as a host via I2C or ESLOV with a lower delay
40
-
-[BHYFirmwareUpdate](https://github.com/arduino-libraries/Arduino_BHY2/tree/main/examples/BHYFirmwareUpdate) : Update ANNA-B112 and BHI260 firmware
41
-
-[Fail_Safe_flasher](https://github.com/arduino-libraries/Arduino_BHY2/blob/main/examples/Fail_Safe_flasher/Fail_Safe_flasher.ino) : Fail Safe flashing of a RGB blink sketch
42
-
-[ReadSensorConfiguration](https://github.com/arduino-libraries/Arduino_BHY2/blob/main/examples/ReadSensorConfiguration/ReadSensorConfiguration.ino) : Read motion, temperature and gas data and send over Serial
37
+
-[BHYFirmwareUpdate](https://github.com/arduino-libraries/Arduino_BHY2/tree/main/examples/BHYFirmwareUpdate) : Update BHI260 firmware to latest version. Can also be used to upload custom firmware binary.
38
+
-[Fail_Safe_flasher](https://github.com/arduino-libraries/Arduino_BHY2/blob/main/examples/Fail_Safe_flasher/Fail_Safe_flasher.ino) : Fail Safe flashing of a RGB blink sketch. Writes binary file to the SPI flash, then peforms CRC to ensure successful writing of binary file to flash memory.
39
+
-[ReadSensorConfiguration](https://github.com/arduino-libraries/Arduino_BHY2/blob/main/examples/ReadSensorConfiguration/ReadSensorConfiguration.ino) : Send sample rate, latency and range for accelerator, gyroscope, rotation, temperature and gas sensor over Serial
43
40
-[ShowSensorList](https://github.com/arduino-libraries/Arduino_BHY2/blob/main/examples/ShowSensorList/ShowSensorList.ino) : List sensors of the Nicla Sense ME board
44
41
-[Standalone](https://github.com/arduino-libraries/Arduino_BHY2/blob/main/examples/Standalone/Standalone.ino) : Read motion, temperature and gas data and send over Serial
45
-
-[StandaloneFlashStorage](https://github.com/arduino-libraries/Arduino_BHY2/blob/main/examples/StandaloneFlashStorage/StandaloneFlashStorage.ino) : Read motion, temperatureand gas data and send over and save on Flash storage
42
+
-[StandaloneFlashStorage](https://github.com/arduino-libraries/Arduino_BHY2/blob/main/examples/StandaloneFlashStorage/StandaloneFlashStorage.ino) : Save accelerator, gryoscope, temperature, gas and rotation sensor values to the onboard SPI flash in a .CSV file.
* @brief Enumeration for defining wiring configuration over ESLOV or Shield.
19
+
* @brief Enumeration for defining wiring configuration between host board and Nicla client. We can select between an I2C connection over ESLOV (NICLA_VIA_ESLOV) or as a Shield for the MKR boards (NICAL_AS_SHIELD).
20
20
*
21
21
* For NICLA_AS_SHIELD configuration, see https://docs.arduino.cc/tutorials/nicla-sense-me/use-as-mkr-shield
22
22
*
23
23
*/
24
24
enum NiclaWiring {
25
-
NICLA_VIA_ESLOV = 0x10,
26
-
NICLA_AS_SHIELD = 0x20
25
+
NICLA_VIA_ESLOV = 0x10,/*!< Host connects to Nicla board via ESLOV */
26
+
NICLA_AS_SHIELD = 0x20/*!< Host connects to Nicla board as a Shield */
27
27
};
28
28
29
29
/**
30
-
* @brief Enumeration for defining I2C or BLE communication configuration.
30
+
* @brief Enumeration for defining I2C (wired) or BLE communication configuration between host board and Nicla client. Alternatively, the Nicla Sense ME can also run in a standalone configuration.
31
+
*
32
+
* @note Both ESLOV and Shield should be considered as implementations of I2C communication (NICLA_I2C)
31
33
*
32
-
* @see Arduino_BHY2::begin()
33
34
*/
34
35
enum NiclaConfig {
35
-
NICLA_I2C = 0x1, /*!< I2C */
36
-
NICLA_BLE = 0x2, /*!< Bluetooth via ANNA-B112 module */
37
-
NICLA_BLE_AND_I2C = NICLA_I2C | NICLA_BLE,/*!< Enable I2C and BLE simultaneously */
36
+
NICLA_I2C = 0x1, /*!< I2C Configuration, relavent for both ESLOV and Shield configurations */
37
+
NICLA_BLE = 0x2, /*!< Bluetooth via the onboard ANNA-B112 module */
38
+
NICLA_BLE_AND_I2C = NICLA_I2C | NICLA_BLE,/*!< Enable I2C (ESLOV/Shield) and BLE simultaneously */
38
39
NICLA_STANDALONE = 0x4/*!< Operate in standalone, without external data transfer */
39
40
};
40
41
41
42
/**
42
-
* @brief Class for storing Nicla state
43
+
* @brief Class for configuring the host-client communication, based on the @ref NiclaConfig enumeration.
* @param config Instance of @see SensorConfigurationPacket class, with sensorID, sampleRate and latency
123
+
*
124
+
* @code
125
+
* #set virtual sensor SENSOR_ID_DEVICE_ORI_WU to have sample rate of 1 Hz and latency of 500 milliseconds
126
+
* SensorConfigurationPacket config(70, 1, 500);
127
+
* BHY2.configureSensor(config)
128
+
* @endcode
129
+
*
130
+
* @note Alternatively, we can directly configure the virtual sensor without creating a SensorConfigurationPacket class
100
131
*
101
-
* @param sensorId Sensor ID for sensor
102
-
* @param sampleRate Polling rate for sensor
103
-
* @param latency Latency in milliseconds
132
+
* @param sensorId SensorID for virtual sensor
133
+
* @param sampleRate Polling rate for sensor in Hz
134
+
* @param latency Latency in milliseconds
135
+
*
136
+
* @note For list of SensorID, see src/SensorID.h. Or see Table 79 in the <a href="https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bhi260ab-ds000.pdf">BHI260 datasheet</a>
* @brief Extract data from the FIFO buffer for a specific SensorID and save into an instance of the SensorDataPacket struct. Eliminate oldest data when sensor queue is full.
110
143
*
111
-
* @param sensorData Data packet from sensor
144
+
* @param sensorData Struct containing SensorID (uint8_t), data payload size (uint8_t) and data corresponding to SensorID (uint8_t).
112
145
*/
113
146
voidaddSensorData(SensorDataPacket &sensorData);
114
147
/**
115
-
* @brief Handlo FIFO of data queue for long sensor data
116
-
*
117
-
* @param sensorData Data packet from sensor
148
+
* @brief Extract data from the FIFO buffer for a specific SensorID and save into an instance of the SensorLongDataPacket struct. Eliminate oldest data when sensor queue is full.
149
+
*
150
+
* @param sensorData Struct containing SensorID (uint8_t), long data payload size (uint8_t) and data corresponding to SensorID (uint8_t).
0 commit comments