From 0ea7dada3dbd0b675c13d6b57acc136489a93b25 Mon Sep 17 00:00:00 2001 From: Davide QUARANTIELLO Date: Thu, 6 Aug 2026 16:48:45 +0200 Subject: [PATCH 1/7] i3c support --- README.md | 20 +++- .../LSM6DSV16X_I3C_Basic.ino | 74 ++++++++++++ .../LSM6DSV16X_I3C_DynAddrAssign.ino | 106 ++++++++++++++++++ keywords.txt | 11 ++ library.properties | 2 +- src/LSM6DSV16XSensor.cpp | 69 ++++++++++++ src/LSM6DSV16XSensor.h | 53 +++++++++ 7 files changed, 333 insertions(+), 2 deletions(-) create mode 100644 examples/LSM6DSV16X_I3C_Basic/LSM6DSV16X_I3C_Basic.ino create mode 100644 examples/LSM6DSV16X_I3C_DynAddrAssign/LSM6DSV16X_I3C_DynAddrAssign.ino diff --git a/README.md b/README.md index 2121a23..1081d42 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Arduino library to support the LSM6DSV16X 3D accelerometer and 3D gyroscope ## API -This sensor uses I2C or SPI to communicate. +This sensor uses I2C, I3C or SPI to communicate. For I2C it is then required to create a TwoWire interface before accessing to the sensors: TwoWire dev_i2c(I2C_SDA, I2C_SCL); @@ -14,6 +14,10 @@ For SPI it is then required to create a SPI interface before accessing to the se SPIClass dev_spi(SPI_MOSI, SPI_MISO, SPI_SCK); dev_spi.begin(); +For I3C it is then required to create an I3C interface before accessing to the sensors: + + I3C.begin(I3C_SDA, I3C_SCL, 1000000U); + An instance can be created and enabled when the I2C bus is used following the procedure below: LSM6DSV16XSensor AccGyr(&dev_i2c); @@ -28,6 +32,16 @@ An instance can be created and enabled when the SPI bus is used following the pr AccGyr.Enable_X(); AccGyr.Enable_G(); +An instance can be created and enabled when the I3C bus is used following the procedure below: + + LSM6DSV16XSensor AccGyr(&I3C, LSM6DSV16X_I3C_ADD_H, 0x30); + I3C.resetDynamicAddresses(); + I3C.assignDynamicAddress(AccGyr.getStaticAddress(), AccGyr.getDynAddress()); + AccGyr.begin(); + I3C.setClock(12500000); + AccGyr.Enable_X(); + AccGyr.Enable_G(); + The access to the sensor values is done as explained below: Read accelerometer and gyroscope. @@ -43,6 +57,10 @@ The access to the sensor values is done as explained below: * LSM6DSV16X_6D_Orientation: This application shows how to use LSM6DSV16X accelerometer to find out the 6D orientation and display data on a hyperterminal. +* LSM6DSV16X_I3C_Basic: This application shows how to use LSM6DSV16X accelerometer and gyroscope over I3C using SETDASA. + +* LSM6DSV16X_I3C_DynAddrAssign: This application shows how to discover and use LSM6DSV16X dynamic address over I3C. + * LSM6DSV16X_Double_Tap_Detection: This application shows how to detect the double tap event using the LSM6DSV16X accelerometer. * LSM6DSV16X_Free_Fall_Detection: This application shows how to detect the free fall event using the LSM6DSV16X accelerometer. diff --git a/examples/LSM6DSV16X_I3C_Basic/LSM6DSV16X_I3C_Basic.ino b/examples/LSM6DSV16X_I3C_Basic/LSM6DSV16X_I3C_Basic.ino new file mode 100644 index 0000000..7836b9b --- /dev/null +++ b/examples/LSM6DSV16X_I3C_Basic/LSM6DSV16X_I3C_Basic.ino @@ -0,0 +1,74 @@ +#include "I3C.h" +#include "LSM6DSV16XSensor.h" + +LSM6DSV16XSensor sensor(&I3C, LSM6DSV16X_I3C_ADD_H, 0x30); + +void setup() { + Serial.begin(115200); + while (!Serial) {} + delay(1000); + + Serial.println("=== LSM6DSV16X SETDASA ==="); + + if (!I3C.begin(I3C_SDA, I3C_SCL, 1000000U)) { + Serial.println("begin() failed"); + while (1) {} + } + + if (!I3C.resetDynamicAddresses()) { + Serial.println("resetDynamicAddresses() failed"); + while (1) {} + } + + if (!I3C.assignDynamicAddress(sensor.getStaticAddress(), sensor.getDynAddress())) { + Serial.println("assignDynamicAddress() failed"); + while (1) {} + } + + if (sensor.begin() != LSM6DSV16X_OK) { + Serial.println("sensor.begin() failed"); + while (1) {} + } + + if (!I3C.setClock(12500000)) { + Serial.println("setClock() failed"); + while (1) {} + } + + if (sensor.Enable_X() != LSM6DSV16X_OK) { + Serial.println("sensor.Enable_X() failed"); + while (1) {} + } + + if (sensor.Enable_G() != LSM6DSV16X_OK) { + Serial.println("sensor.Enable_G() failed"); + while (1) {} + } + + Serial.println("LSM6DSV16X ready"); +} + +void loop() { + int32_t accel[3] = {0}; + int32_t angrate[3] = {0}; + + if (sensor.Get_X_Axes(accel) == LSM6DSV16X_OK && sensor.Get_G_Axes(angrate) == LSM6DSV16X_OK) { + Serial.print("Accel-X[mg]:"); + Serial.print(accel[0]); + Serial.print(",Accel-Y[mg]:"); + Serial.print(accel[1]); + Serial.print(",Accel-Z[mg]:"); + Serial.println(accel[2]); + + Serial.print("AngRate-X[mdps]:"); + Serial.print(angrate[0]); + Serial.print(",AngRate-Y[mdps]:"); + Serial.print(angrate[1]); + Serial.print(",AngRate-Z[mdps]:"); + Serial.println(angrate[2]); + } else { + Serial.println("Read failed"); + } + + delay(500); +} diff --git a/examples/LSM6DSV16X_I3C_DynAddrAssign/LSM6DSV16X_I3C_DynAddrAssign.ino b/examples/LSM6DSV16X_I3C_DynAddrAssign/LSM6DSV16X_I3C_DynAddrAssign.ino new file mode 100644 index 0000000..edf5372 --- /dev/null +++ b/examples/LSM6DSV16X_I3C_DynAddrAssign/LSM6DSV16X_I3C_DynAddrAssign.ino @@ -0,0 +1,106 @@ +#include "I3C.h" +#include "LSM6DSV16XSensor.h" + +LSM6DSV16XSensor sensor(&I3C); + +void setup() { + Serial.begin(115200); + while (!Serial) {} + delay(1000); + + Serial.println("=== LSM6DSV16X DAA ==="); + + if (!I3C.begin(I3C_SDA, I3C_SCL, 1000000U)) { + Serial.println("begin() failed"); + while (1) {} + } + + if (!I3C.resetDynamicAddresses()) { + Serial.println("resetDynamicAddresses() failed"); + while (1) {} + } + + I3CDiscoveredDevice devices[8] = {}; + size_t found = 0; + + if (I3C.discover(devices, 8, &found)) { + Serial.println("discover() failed"); + while (1) {} + } + + Serial.print("Devices found: "); + Serial.println(found); + + uint8_t lsmDynAddr = 0U; + + for (size_t i = 0; i < found; ++i) { + Serial.print("["); + Serial.print(i); + Serial.print("] PID=0x"); + Serial.print((uint32_t)(devices[i].pid >> 32), HEX); + Serial.print((uint32_t)(devices[i].pid & 0xFFFFFFFFULL), HEX); + Serial.print(" DYN=0x"); + Serial.println(devices[i].dynAddr, HEX); + + if ((devices[i].pid == LSM6DSV16X_I3C_PID_H) || (devices[i].pid == LSM6DSV16X_I3C_PID_L)) { + lsmDynAddr = devices[i].dynAddr; + } + } + + if (lsmDynAddr == 0U) { + Serial.println("Sensor not found"); + while (1) {} + } + + if (sensor.set_address(lsmDynAddr) != LSM6DSV16X_OK) { + Serial.println("set_address() failed"); + while (1) {} + } + + if (sensor.begin() != LSM6DSV16X_OK) { + Serial.println("sensor.begin() failed"); + while (1) {} + } + + if (!I3C.setClock(12500000)) { + Serial.println("setClock() failed"); + while (1) {} + } + + if (sensor.Enable_X() != LSM6DSV16X_OK) { + Serial.println("sensor.Enable_X() failed"); + while (1) {} + } + + if (sensor.Enable_G() != LSM6DSV16X_OK) { + Serial.println("sensor.Enable_G() failed"); + while (1) {} + } + + Serial.println("LSM6DSV16X ready"); +} + +void loop() { + int32_t accel[3] = {0}; + int32_t angrate[3] = {0}; + + if (sensor.Get_X_Axes(accel) == LSM6DSV16X_OK && sensor.Get_G_Axes(angrate) == LSM6DSV16X_OK) { + Serial.print("Accel-X[mg]:"); + Serial.print(accel[0]); + Serial.print(",Accel-Y[mg]:"); + Serial.print(accel[1]); + Serial.print(",Accel-Z[mg]:"); + Serial.println(accel[2]); + + Serial.print("AngRate-X[mdps]:"); + Serial.print(angrate[0]); + Serial.print(",AngRate-Y[mdps]:"); + Serial.print(angrate[1]); + Serial.print(",AngRate-Z[mdps]:"); + Serial.println(angrate[2]); + } else { + Serial.println("Read failed"); + } + + delay(500); +} diff --git a/keywords.txt b/keywords.txt index 738d01f..22bcc08 100644 --- a/keywords.txt +++ b/keywords.txt @@ -19,6 +19,9 @@ LSM6DSV16X_GYRO_Operating_Mode_t KEYWORD1 begin KEYWORD2 end KEYWORD2 ReadID KEYWORD2 +set_address KEYWORD2 +getStaticAddress KEYWORD2 +getDynAddress KEYWORD2 Enable_X KEYWORD2 Disable_X KEYWORD2 Get_X_Sensitivity KEYWORD2 @@ -139,6 +142,14 @@ LSM6DSV16X_OK LITERAL1 LSM6DSV16X_ERROR LITERAL1 LSM6DSV16X_INT1_PIN LITERAL1 LSM6DSV16X_INT2_PIN LITERAL1 +LSM6DSV16X_I2C_BUS LITERAL1 +LSM6DSV16X_SPI_4WIRES_BUS LITERAL1 +LSM6DSV16X_SPI_3WIRES_BUS LITERAL1 +LSM6DSV16X_I3C_BUS LITERAL1 +LSM6DSV16X_I3C_ADD_L LITERAL1 +LSM6DSV16X_I3C_ADD_H LITERAL1 +LSM6DSV16X_I3C_PID_L LITERAL1 +LSM6DSV16X_I3C_PID_H LITERAL1 LSM6DSV16X_ACC_SENSITIVITY_FS_2G LITERAL1 LSM6DSV16X_ACC_SENSITIVITY_FS_4G LITERAL1 LSM6DSV16X_ACC_SENSITIVITY_FS_8G LITERAL1 diff --git a/library.properties b/library.properties index 8565b48..8c98ed8 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=STM32duino LSM6DSV16X -version=2.0.3 +version=2.1.0 author=SRA maintainer=stm32duino sentence=Ultra Low Power inertial measurement unit. diff --git a/src/LSM6DSV16XSensor.cpp b/src/LSM6DSV16XSensor.cpp index bc3fcc3..2aadd5e 100644 --- a/src/LSM6DSV16XSensor.cpp +++ b/src/LSM6DSV16XSensor.cpp @@ -53,8 +53,13 @@ LSM6DSV16XSensor::LSM6DSV16XSensor(TwoWire *i2c, uint8_t address) : dev_i2c(i2c) reg_ctx.mdelay = LSM6DSV16X_sleep; reg_ctx.handle = (void *)this; dev_spi = NULL; +#if defined(I3C_SUPPORTED) + dev_i3c = NULL; +#endif + bus_type = LSM6DSV16X_I2C_BUS; acc_is_enabled = 0L; gyro_is_enabled = 0L; + initialized = 0U; } /** Constructor @@ -69,8 +74,60 @@ LSM6DSV16XSensor::LSM6DSV16XSensor(SPIClass *spi, int cs_pin, uint32_t spi_speed reg_ctx.mdelay = LSM6DSV16X_sleep; reg_ctx.handle = (void *)this; dev_i2c = NULL; +#if defined(I3C_SUPPORTED) + dev_i3c = NULL; +#endif + bus_type = LSM6DSV16X_SPI_4WIRES_BUS; + address = 0U; + acc_is_enabled = 0L; + gyro_is_enabled = 0L; + initialized = 0U; +} + +#if defined(I3C_SUPPORTED) +LSM6DSV16XSensor::LSM6DSV16XSensor(I3CBus *i3c, uint8_t staticAddr7, uint8_t dynAddr7) +{ + reg_ctx.write_reg = LSM6DSV16X_io_write; + reg_ctx.read_reg = LSM6DSV16X_io_read; + reg_ctx.mdelay = LSM6DSV16X_sleep; + reg_ctx.handle = (void *)this; + + dev_i2c = NULL; + dev_spi = NULL; + dev_i3c = i3c; + + address = (dynAddr7 != 0U) ? dynAddr7 : staticAddr7; + i3c_static7 = staticAddr7; + i3c_dyn7 = dynAddr7; + + bus_type = LSM6DSV16X_I3C_BUS; acc_is_enabled = 0L; gyro_is_enabled = 0L; + initialized = 0U; +} + +uint8_t LSM6DSV16XSensor::getStaticAddress() const +{ + return i3c_static7; +} + +uint8_t LSM6DSV16XSensor::getDynAddress() const +{ + return i3c_dyn7; +} +#endif + +LSM6DSV16XStatusTypeDef LSM6DSV16XSensor::set_address(uint8_t dynAddr7) +{ + if (initialized) { + return LSM6DSV16X_ERROR; + } + + address = dynAddr7; +#if defined(I3C_SUPPORTED) + i3c_dyn7 = dynAddr7; +#endif + return LSM6DSV16X_OK; } /** @@ -80,6 +137,7 @@ LSM6DSV16XSensor::LSM6DSV16XSensor(SPIClass *spi, int cs_pin, uint32_t spi_speed LSM6DSV16XStatusTypeDef LSM6DSV16XSensor::begin() { int32_t fs = 0; + uint8_t id = 0; if (dev_spi) { // Configure CS pin @@ -87,6 +145,17 @@ LSM6DSV16XStatusTypeDef LSM6DSV16XSensor::begin() digitalWrite(cs_pin, HIGH); } +#if defined(I3C_SUPPORTED) + if (dev_i3c != NULL) { + if (address < 0x08U || address > 0x77U) { + return LSM6DSV16X_ERROR; + } + if (ReadID(&id) != LSM6DSV16X_OK || id != LSM6DSV16X_ID) { + return LSM6DSV16X_ERROR; + } + } +#endif + /* Enable register address automatically incremented during a multiple byte access with a serial interface. */ if (lsm6dsv16x_auto_increment_set(®_ctx, PROPERTY_ENABLE) != LSM6DSV16X_OK) { diff --git a/src/LSM6DSV16XSensor.h b/src/LSM6DSV16XSensor.h index 42127d5..a15d250 100644 --- a/src/LSM6DSV16XSensor.h +++ b/src/LSM6DSV16XSensor.h @@ -48,6 +48,11 @@ #include "SPI.h" #include "lsm6dsv16x_reg.h" +#if (defined(I3C1_BASE) || defined(I3C2_BASE)) && !defined(I3C_SUPPORTED) + #define I3C_SUPPORTED + #include "I3C.h" +#endif + /* Defines -------------------------------------------------------------------*/ /* For compatibility with ESP32 platforms */ @@ -57,6 +62,19 @@ #endif #endif +#define LSM6DSV16X_I2C_BUS 0U +#define LSM6DSV16X_SPI_4WIRES_BUS 1U +#define LSM6DSV16X_SPI_3WIRES_BUS 2U +#define LSM6DSV16X_I3C_BUS 3U + +#if defined(I3C_SUPPORTED) + #define LSM6DSV16X_I3C_ADD_L 0x6AU + #define LSM6DSV16X_I3C_ADD_H 0x6BU + + static const uint64_t LSM6DSV16X_I3C_PID_L = 0x02080070120BULL; + static const uint64_t LSM6DSV16X_I3C_PID_H = 0x02080070920BULL; +#endif + #define LSM6DSV16X_ACC_SENSITIVITY_FS_2G 0.061f #define LSM6DSV16X_ACC_SENSITIVITY_FS_4G 0.122f #define LSM6DSV16X_ACC_SENSITIVITY_FS_8G 0.244f @@ -146,10 +164,19 @@ class LSM6DSV16XSensor { public: LSM6DSV16XSensor(TwoWire *i2c, uint8_t address = LSM6DSV16X_I2C_ADD_H); LSM6DSV16XSensor(SPIClass *spi, int cs_pin, uint32_t spi_speed = 2000000); + #if defined(I3C_SUPPORTED) + LSM6DSV16XSensor(I3CBus *i3c, uint8_t staticAddr7 = 0, uint8_t dynAddr7 = 0); + #endif LSM6DSV16XStatusTypeDef begin(); LSM6DSV16XStatusTypeDef end(); LSM6DSV16XStatusTypeDef ReadID(uint8_t *Id); + LSM6DSV16XStatusTypeDef set_address(uint8_t dynAddr7); + + #if defined(I3C_SUPPORTED) + uint8_t getStaticAddress() const; + uint8_t getDynAddress() const; + #endif LSM6DSV16XStatusTypeDef Enable_X(); LSM6DSV16XStatusTypeDef Disable_X(); @@ -323,6 +350,14 @@ class LSM6DSV16XSensor { return 0; } +#if defined(I3C_SUPPORTED) + if (dev_i3c) { + if (dev_i3c->readRegBuffer(address, RegisterAddr, pBuffer, NumByteToRead) == 0) { + return 0; + } + } +#endif + return 1; } @@ -367,6 +402,14 @@ class LSM6DSV16XSensor { return 0; } +#if defined(I3C_SUPPORTED) + if (dev_i3c) { + if (dev_i3c->writeRegBuffer(address, RegisterAddr, (uint8_t *)pBuffer, NumByteToWrite) == 0) { + return 0; + } + } +#endif + return 1; } @@ -387,12 +430,22 @@ class LSM6DSV16XSensor { /* Helper classes. */ TwoWire *dev_i2c; SPIClass *dev_spi; + #if defined(I3C_SUPPORTED) + I3CBus *dev_i3c; + #endif + + uint32_t bus_type; /*0 means I2C, 1 means SPI 4-Wires, 2 means SPI-3-Wires, 3 means I3C */ /* Configuration */ uint8_t address; int cs_pin; uint32_t spi_speed; + #if defined(I3C_SUPPORTED) + uint8_t i3c_static7; + uint8_t i3c_dyn7; + #endif + lsm6dsv16x_data_rate_t acc_odr; lsm6dsv16x_data_rate_t gyro_odr; lsm6dsv16x_xl_full_scale_t acc_fs; From 0e171a63512c517aafc805d2e0e489adb7c64ad9 Mon Sep 17 00:00:00 2001 From: Davide QUARANTIELLO Date: Tue, 1 Sep 2026 11:13:49 +0200 Subject: [PATCH 2/7] align i3c to latest update --- .github/workflows/Continuous-integration.yml | 6 ++- README.md | 19 +++++-- .../LSM6DSV16X_DataLog_Terminal_I2C.ino} | 4 +- .../LSM6DSV16X_Datalog_Terminal_I3C.ino} | 30 ++++++++--- ...SM6DSV16X_Datalog_Terminal_I3C_ENTDAA.ino} | 42 +++++++++------ keywords.txt | 1 - library.properties | 2 +- src/LSM6DSV16XSensor.cpp | 52 ++++++++++--------- src/LSM6DSV16XSensor.h | 27 +++++----- 9 files changed, 113 insertions(+), 70 deletions(-) rename examples/{LSM6DSV16X_DataLog_Terminal/LSM6DSV16X_DataLog_Terminal.ino => LSM6DSV16X_DataLog_Terminal_I2C/LSM6DSV16X_DataLog_Terminal_I2C.ino} (93%) rename examples/{LSM6DSV16X_I3C_Basic/LSM6DSV16X_I3C_Basic.ino => LSM6DSV16X_Datalog_Terminal_I3C/LSM6DSV16X_Datalog_Terminal_I3C.ino} (61%) rename examples/{LSM6DSV16X_I3C_DynAddrAssign/LSM6DSV16X_I3C_DynAddrAssign.ino => LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA.ino} (69%) diff --git a/.github/workflows/Continuous-integration.yml b/.github/workflows/Continuous-integration.yml index bfb1db3..5614a1d 100644 --- a/.github/workflows/Continuous-integration.yml +++ b/.github/workflows/Continuous-integration.yml @@ -59,8 +59,10 @@ jobs: id: compile uses: stm32duino/actions/compile-examples@main with: - board-pattern: "NUCLEO_L476RG" - + custom-config: "./extras/build_config.json" + board-pattern: "NUCLEO_L476RG|NUCLEO_H503RB" + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} # Use the output from the `Compilation` step - name: Compilation Errors if: failure() diff --git a/README.md b/README.md index 1081d42..29bff44 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,23 @@ An instance can be created and enabled when the SPI bus is used following the pr AccGyr.Enable_X(); AccGyr.Enable_G(); -An instance can be created and enabled when the I3C bus is used following the procedure below: - LSM6DSV16XSensor AccGyr(&I3C, LSM6DSV16X_I3C_ADD_H, 0x30); +An instance can be created and enabled when the I3C bus is used with SETDASA (static-to-dynamic address assignment): + LSM6DSV16XSensor AccGyr(&I3C, LSM6DSV16X_I3C_ADD_H); I3C.resetDynamicAddresses(); - I3C.assignDynamicAddress(AccGyr.getStaticAddress(), AccGyr.getDynAddress()); - AccGyr.begin(); + I3C.assignDynamicAddress(AccGyr.getStaticAddress(), LSM6DSV16X_DYNAMIC_ADDRESS); + AccGyr.begin(LSM6DSV16X_DYNAMIC_ADDRESS); + I3C.setClock(12500000); + AccGyr.Enable_X(); + AccGyr.Enable_G(); + +An instance can be created and enabled when the I3C bus is used with ENTDAA (dynamic address discovery): + + LSM6DSV16XSensor AccGyr(&I3C); + I3C.begin(I3C_SDA, I3C_SCL, 1000000U); + I3C.discover(devices, 8, &found); + // find dynAddr by matching LSM6DSV16X_I3C_PID_H in discovered devices + AccGyr.begin(dynAddr); I3C.setClock(12500000); AccGyr.Enable_X(); AccGyr.Enable_G(); diff --git a/examples/LSM6DSV16X_DataLog_Terminal/LSM6DSV16X_DataLog_Terminal.ino b/examples/LSM6DSV16X_DataLog_Terminal_I2C/LSM6DSV16X_DataLog_Terminal_I2C.ino similarity index 93% rename from examples/LSM6DSV16X_DataLog_Terminal/LSM6DSV16X_DataLog_Terminal.ino rename to examples/LSM6DSV16X_DataLog_Terminal_I2C/LSM6DSV16X_DataLog_Terminal_I2C.ino index a6d1c13..753028b 100644 --- a/examples/LSM6DSV16X_DataLog_Terminal/LSM6DSV16X_DataLog_Terminal.ino +++ b/examples/LSM6DSV16X_DataLog_Terminal_I2C/LSM6DSV16X_DataLog_Terminal_I2C.ino @@ -1,9 +1,9 @@ /* - @file LSM6DSV16X_DataLog_Terminal.ino + @file LSM6DSV16X_DataLog_Terminal_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X inertial measurement sensor ******************************************************************************* - Copyright (c) 2022, STMicroelectronics + Copyright (c) 2026, STMicroelectronics All rights reserved. This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this file except in compliance with the diff --git a/examples/LSM6DSV16X_I3C_Basic/LSM6DSV16X_I3C_Basic.ino b/examples/LSM6DSV16X_Datalog_Terminal_I3C/LSM6DSV16X_Datalog_Terminal_I3C.ino similarity index 61% rename from examples/LSM6DSV16X_I3C_Basic/LSM6DSV16X_I3C_Basic.ino rename to examples/LSM6DSV16X_Datalog_Terminal_I3C/LSM6DSV16X_Datalog_Terminal_I3C.ino index 7836b9b..680e05c 100644 --- a/examples/LSM6DSV16X_I3C_Basic/LSM6DSV16X_I3C_Basic.ino +++ b/examples/LSM6DSV16X_Datalog_Terminal_I3C/LSM6DSV16X_Datalog_Terminal_I3C.ino @@ -1,9 +1,26 @@ -#include "I3C.h" +/* + @file LSM6DSV16X_DataLog_Terminal_I3C.ino + @author STMicroelectronics + @brief Example to use the LSM6DSV16X sensor with I3C and SETDASA command + ******************************************************************************* + Copyright (c) 2026, STMicroelectronics + All rights reserved. + + This software component is licensed by ST under BSD 3-Clause license, + the "License"; You may not use this file except in compliance with the + License. You may obtain a copy of the License at: + opensource.org/licenses/BSD-3-Clause + + ******************************************************************************* +*/ #include "LSM6DSV16XSensor.h" -LSM6DSV16XSensor sensor(&I3C, LSM6DSV16X_I3C_ADD_H, 0x30); +#define LSM6DSV16X_DYNAMIC_ADDRESS 0x30 + +LSM6DSV16XSensor sensor(&I3C, LSM6DSV16X_I3C_ADD_H); -void setup() { +void setup() +{ Serial.begin(115200); while (!Serial) {} delay(1000); @@ -20,12 +37,12 @@ void setup() { while (1) {} } - if (!I3C.assignDynamicAddress(sensor.getStaticAddress(), sensor.getDynAddress())) { + if (!I3C.assignDynamicAddress(sensor.getStaticAddress(), LSM6DSV16X_DYNAMIC_ADDRESS)) { Serial.println("assignDynamicAddress() failed"); while (1) {} } - if (sensor.begin() != LSM6DSV16X_OK) { + if (sensor.begin(LSM6DSV16X_DYNAMIC_ADDRESS) != LSM6DSV16X_OK) { Serial.println("sensor.begin() failed"); while (1) {} } @@ -48,7 +65,8 @@ void setup() { Serial.println("LSM6DSV16X ready"); } -void loop() { +void loop() +{ int32_t accel[3] = {0}; int32_t angrate[3] = {0}; diff --git a/examples/LSM6DSV16X_I3C_DynAddrAssign/LSM6DSV16X_I3C_DynAddrAssign.ino b/examples/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA.ino similarity index 69% rename from examples/LSM6DSV16X_I3C_DynAddrAssign/LSM6DSV16X_I3C_DynAddrAssign.ino rename to examples/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA.ino index edf5372..671c318 100644 --- a/examples/LSM6DSV16X_I3C_DynAddrAssign/LSM6DSV16X_I3C_DynAddrAssign.ino +++ b/examples/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA.ino @@ -1,9 +1,25 @@ -#include "I3C.h" +/* + @file LSM6DSV16X_DataLog_Terminal_I3C_ENTDAA.ino + @author STMicroelectronics + @brief Example to use the LSM6DSV16X sensor with I3C dynamic address assignment + ******************************************************************************* + Copyright (c) 2026, STMicroelectronics + All rights reserved. + + This software component is licensed by ST under BSD 3-Clause license, + the "License"; You may not use this file except in compliance with the + License. You may obtain a copy of the License at: + opensource.org/licenses/BSD-3-Clause + + ******************************************************************************* +*/ + #include "LSM6DSV16XSensor.h" LSM6DSV16XSensor sensor(&I3C); -void setup() { +void setup() +{ Serial.begin(115200); while (!Serial) {} delay(1000); @@ -27,23 +43,16 @@ void setup() { Serial.println("discover() failed"); while (1) {} } - - Serial.print("Devices found: "); - Serial.println(found); - + uint8_t lsmDynAddr = 0U; for (size_t i = 0; i < found; ++i) { - Serial.print("["); - Serial.print(i); - Serial.print("] PID=0x"); - Serial.print((uint32_t)(devices[i].pid >> 32), HEX); - Serial.print((uint32_t)(devices[i].pid & 0xFFFFFFFFULL), HEX); - Serial.print(" DYN=0x"); - Serial.println(devices[i].dynAddr, HEX); - - if ((devices[i].pid == LSM6DSV16X_I3C_PID_H) || (devices[i].pid == LSM6DSV16X_I3C_PID_L)) { + Serial.println(devices[i].pid, HEX); + if (devices[i].pid == LSM6DSV16X_I3C_PID_H) { lsmDynAddr = devices[i].dynAddr; + Serial.print("lsmDynAddr="); + Serial.println(lsmDynAddr, HEX); + break; } } @@ -80,7 +89,8 @@ void setup() { Serial.println("LSM6DSV16X ready"); } -void loop() { +void loop() +{ int32_t accel[3] = {0}; int32_t angrate[3] = {0}; diff --git a/keywords.txt b/keywords.txt index 22bcc08..a7e7aaf 100644 --- a/keywords.txt +++ b/keywords.txt @@ -19,7 +19,6 @@ LSM6DSV16X_GYRO_Operating_Mode_t KEYWORD1 begin KEYWORD2 end KEYWORD2 ReadID KEYWORD2 -set_address KEYWORD2 getStaticAddress KEYWORD2 getDynAddress KEYWORD2 Enable_X KEYWORD2 diff --git a/library.properties b/library.properties index 8c98ed8..db87fe8 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=STM32duino LSM6DSV16X -version=2.1.0 +version=2.2.0 author=SRA maintainer=stm32duino sentence=Ultra Low Power inertial measurement unit. diff --git a/src/LSM6DSV16XSensor.cpp b/src/LSM6DSV16XSensor.cpp index 2aadd5e..f20dabb 100644 --- a/src/LSM6DSV16XSensor.cpp +++ b/src/LSM6DSV16XSensor.cpp @@ -2,13 +2,13 @@ ****************************************************************************** * @file LSM6DSV16XSensor.cpp * @author STMicroelectronics - * @version V1.0.0 - * @date July 2022 + * @version V1.1.0 + * @date September 2026 * @brief Implementation of a LSM6DSV16X inertial measurement sensor. ****************************************************************************** * @attention * - *

© COPYRIGHT(c) 2022 STMicroelectronics

+ *

© COPYRIGHT(c) 2026 STMicroelectronics

* * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -85,7 +85,7 @@ LSM6DSV16XSensor::LSM6DSV16XSensor(SPIClass *spi, int cs_pin, uint32_t spi_speed } #if defined(I3C_SUPPORTED) -LSM6DSV16XSensor::LSM6DSV16XSensor(I3CBus *i3c, uint8_t staticAddr7, uint8_t dynAddr7) +LSM6DSV16XSensor::LSM6DSV16XSensor(I3CBus *i3c, uint8_t static_addr7) { reg_ctx.write_reg = LSM6DSV16X_io_write; reg_ctx.read_reg = LSM6DSV16X_io_read; @@ -96,9 +96,9 @@ LSM6DSV16XSensor::LSM6DSV16XSensor(I3CBus *i3c, uint8_t staticAddr7, uint8_t dyn dev_spi = NULL; dev_i3c = i3c; - address = (dynAddr7 != 0U) ? dynAddr7 : staticAddr7; - i3c_static7 = staticAddr7; - i3c_dyn7 = dynAddr7; + address = static_addr7; + i3c_static7 = static_addr7; + i3c_dyn7 = 0; bus_type = LSM6DSV16X_I3C_BUS; acc_is_enabled = 0L; @@ -117,24 +117,11 @@ uint8_t LSM6DSV16XSensor::getDynAddress() const } #endif -LSM6DSV16XStatusTypeDef LSM6DSV16XSensor::set_address(uint8_t dynAddr7) -{ - if (initialized) { - return LSM6DSV16X_ERROR; - } - - address = dynAddr7; -#if defined(I3C_SUPPORTED) - i3c_dyn7 = dynAddr7; -#endif - return LSM6DSV16X_OK; -} - /** * @brief Initialize the LSM6DSV16X sensor * @retval 0 in case of success, an error code otherwise */ -LSM6DSV16XStatusTypeDef LSM6DSV16XSensor::begin() +LSM6DSV16XStatusTypeDef LSM6DSV16XSensor::begin(uint8_t new_address) { int32_t fs = 0; uint8_t id = 0; @@ -144,21 +131,38 @@ LSM6DSV16XStatusTypeDef LSM6DSV16XSensor::begin() pinMode(cs_pin, OUTPUT); digitalWrite(cs_pin, HIGH); } - #if defined(I3C_SUPPORTED) - if (dev_i3c != NULL) { - if (address < 0x08U || address > 0x77U) { + if (dev_i3c != nullptr) { + Serial.println("dev_i3c != nullptr"); + if (new_address < 0x08 || new_address > 0x77) { + Serial.println("addres not ok"); + return LSM6DSV16X_ERROR; + } else { + Serial.println("addres ok"); + + address = new_address; + i3c_dyn7 = new_address; } + uint8_t id = 0; if (ReadID(&id) != LSM6DSV16X_OK || id != LSM6DSV16X_ID) { + Serial.println("id non ok"); + Serial.println(id); + Serial.println(LSM6DSV16X_ID); + + return LSM6DSV16X_ERROR; } + Serial.println("id ok"); + } #endif /* Enable register address automatically incremented during a multiple byte access with a serial interface. */ if (lsm6dsv16x_auto_increment_set(®_ctx, PROPERTY_ENABLE) != LSM6DSV16X_OK) { + Serial.println("AI no ok" ); + return LSM6DSV16X_ERROR; } diff --git a/src/LSM6DSV16XSensor.h b/src/LSM6DSV16XSensor.h index a15d250..6d6c5e8 100644 --- a/src/LSM6DSV16XSensor.h +++ b/src/LSM6DSV16XSensor.h @@ -2,13 +2,13 @@ ****************************************************************************** * @file LSM6DSV16XSensor.h * @author STMicroelectronics - * @version V1.0.0 - * @date July 2022 + * @version V1.1.0 + * @date September 2026 * @brief Abstract Class of a LSM6DSV16X inertial measurement sensor. ****************************************************************************** * @attention * - *

© COPYRIGHT(c) 2022 STMicroelectronics

+ *

© COPYRIGHT(c) 2026 STMicroelectronics

* * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: @@ -164,19 +164,18 @@ class LSM6DSV16XSensor { public: LSM6DSV16XSensor(TwoWire *i2c, uint8_t address = LSM6DSV16X_I2C_ADD_H); LSM6DSV16XSensor(SPIClass *spi, int cs_pin, uint32_t spi_speed = 2000000); - #if defined(I3C_SUPPORTED) - LSM6DSV16XSensor(I3CBus *i3c, uint8_t staticAddr7 = 0, uint8_t dynAddr7 = 0); - #endif +#if defined(I3C_SUPPORTED) + LSM6DSV16XSensor(I3CBus *i3c, uint8_t static_addr7 = 0); +#endif - LSM6DSV16XStatusTypeDef begin(); + LSM6DSV16XStatusTypeDef begin(uint8_t new_address = 0); LSM6DSV16XStatusTypeDef end(); LSM6DSV16XStatusTypeDef ReadID(uint8_t *Id); - LSM6DSV16XStatusTypeDef set_address(uint8_t dynAddr7); - #if defined(I3C_SUPPORTED) +#if defined(I3C_SUPPORTED) uint8_t getStaticAddress() const; uint8_t getDynAddress() const; - #endif +#endif LSM6DSV16XStatusTypeDef Enable_X(); LSM6DSV16XStatusTypeDef Disable_X(); @@ -430,9 +429,9 @@ class LSM6DSV16XSensor { /* Helper classes. */ TwoWire *dev_i2c; SPIClass *dev_spi; - #if defined(I3C_SUPPORTED) +#if defined(I3C_SUPPORTED) I3CBus *dev_i3c; - #endif +#endif uint32_t bus_type; /*0 means I2C, 1 means SPI 4-Wires, 2 means SPI-3-Wires, 3 means I3C */ @@ -441,10 +440,10 @@ class LSM6DSV16XSensor { int cs_pin; uint32_t spi_speed; - #if defined(I3C_SUPPORTED) +#if defined(I3C_SUPPORTED) uint8_t i3c_static7; uint8_t i3c_dyn7; - #endif +#endif lsm6dsv16x_data_rate_t acc_odr; lsm6dsv16x_data_rate_t gyro_odr; From f1165a29dba334d84bc6ab123edc3003cf2d4b51 Mon Sep 17 00:00:00 2001 From: Davide QUARANTIELLO Date: Tue, 1 Sep 2026 11:23:35 +0200 Subject: [PATCH 3/7] fix astyle --- src/LSM6DSV16XSensor.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/LSM6DSV16XSensor.cpp b/src/LSM6DSV16XSensor.cpp index f20dabb..1659029 100644 --- a/src/LSM6DSV16XSensor.cpp +++ b/src/LSM6DSV16XSensor.cpp @@ -133,36 +133,22 @@ LSM6DSV16XStatusTypeDef LSM6DSV16XSensor::begin(uint8_t new_address) } #if defined(I3C_SUPPORTED) if (dev_i3c != nullptr) { - Serial.println("dev_i3c != nullptr"); if (new_address < 0x08 || new_address > 0x77) { - Serial.println("addres not ok"); - return LSM6DSV16X_ERROR; } else { - Serial.println("addres ok"); - address = new_address; i3c_dyn7 = new_address; } uint8_t id = 0; if (ReadID(&id) != LSM6DSV16X_OK || id != LSM6DSV16X_ID) { - Serial.println("id non ok"); - Serial.println(id); - Serial.println(LSM6DSV16X_ID); - - return LSM6DSV16X_ERROR; } - Serial.println("id ok"); - } #endif /* Enable register address automatically incremented during a multiple byte access with a serial interface. */ if (lsm6dsv16x_auto_increment_set(®_ctx, PROPERTY_ENABLE) != LSM6DSV16X_OK) { - Serial.println("AI no ok" ); - return LSM6DSV16X_ERROR; } @@ -1447,7 +1433,7 @@ LSM6DSV16XStatusTypeDef LSM6DSV16XSensor::Enable_Wake_Up_Detection(LSM6DSV16X_Se return LSM6DSV16X_ERROR; } - /* Set wake-up durantion */ + /* Set wake-up duration */ if (Set_Wake_Up_Duration(0) != LSM6DSV16X_OK) { return LSM6DSV16X_ERROR; } @@ -1542,7 +1528,7 @@ LSM6DSV16XStatusTypeDef LSM6DSV16XSensor::Disable_Wake_Up_Detection() return LSM6DSV16X_ERROR; } - /* Reset wake-up durantion */ + /* Reset wake-up duration */ if (Set_Wake_Up_Duration(0) != LSM6DSV16X_OK) { return LSM6DSV16X_ERROR; } From d38c47660804a0e81877ad38c5514daa1b3bd2e7 Mon Sep 17 00:00:00 2001 From: Davide QUARANTIELLO Date: Tue, 1 Sep 2026 11:27:06 +0200 Subject: [PATCH 4/7] fix codespell --- extras/codespell-ignore-words-list.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/codespell-ignore-words-list.txt b/extras/codespell-ignore-words-list.txt index 146ac38..8a7e8a9 100644 --- a/extras/codespell-ignore-words-list.txt +++ b/extras/codespell-ignore-words-list.txt @@ -1 +1,2 @@ -ois \ No newline at end of file +ois +daa \ No newline at end of file From 9f9c0b74c36a83fc12ad83a40f83cc2a519f7ff2 Mon Sep 17 00:00:00 2001 From: Davide QUARANTIELLO Date: Tue, 1 Sep 2026 13:54:31 +0200 Subject: [PATCH 5/7] add build_confing.json --- README.md | 6 ++--- ...LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA.ino | 7 +----- extras/build_config.json | 25 +++++++++++++++++++ src/LSM6DSV16XSensor.cpp | 2 +- src/LSM6DSV16XSensor.h | 2 +- 5 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 extras/build_config.json diff --git a/README.md b/README.md index 29bff44..333453b 100644 --- a/README.md +++ b/README.md @@ -64,13 +64,13 @@ The access to the sensor values is done as explained below: ## Examples -* LSM6DSV16X_DataLog_Terminal: This application shows how to get data from LSM6DSV16X accelerometer and gyroscope and print them on terminal. +* LSM6DSV16X_DataLog_Terminal_I2C: This application shows how to get data from LSM6DSV16X accelerometer and gyroscope and print them on terminal over I2C. * LSM6DSV16X_6D_Orientation: This application shows how to use LSM6DSV16X accelerometer to find out the 6D orientation and display data on a hyperterminal. -* LSM6DSV16X_I3C_Basic: This application shows how to use LSM6DSV16X accelerometer and gyroscope over I3C using SETDASA. +* LSM6DSV16X_Datalog_Terminal_I3C: This application shows how to use LSM6DSV16X accelerometer and gyroscope over I3C using SETDASA. -* LSM6DSV16X_I3C_DynAddrAssign: This application shows how to discover and use LSM6DSV16X dynamic address over I3C. +* LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA: This application shows how to discover and use LSM6DSV16X dynamic address over I3C. * LSM6DSV16X_Double_Tap_Detection: This application shows how to detect the double tap event using the LSM6DSV16X accelerometer. diff --git a/examples/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA.ino b/examples/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA.ino index 671c318..fe50e1f 100644 --- a/examples/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA.ino +++ b/examples/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA/LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA.ino @@ -61,12 +61,7 @@ void setup() while (1) {} } - if (sensor.set_address(lsmDynAddr) != LSM6DSV16X_OK) { - Serial.println("set_address() failed"); - while (1) {} - } - - if (sensor.begin() != LSM6DSV16X_OK) { + if (sensor.begin(lsmDynAddr) != LSM6DSV16X_OK) { Serial.println("sensor.begin() failed"); while (1) {} } diff --git a/extras/build_config.json b/extras/build_config.json new file mode 100644 index 0000000..9253f07 --- /dev/null +++ b/extras/build_config.json @@ -0,0 +1,25 @@ +{ + "cores": [ + { + "maintainer": "STMicroelectronics", + "architecture": "stm32", + "boards": [ + ], + "sketches": [ + { + "pattern": "[^I][^3][^C]", + "applicable": true, + "boards": [ + "NUCLEO_L476RG", + "NUCLEO_H503RB" + ] + }, + { + "pattern": "I3C", + "applicable": true, + "boards": [ "NUCLEO_H503RB"] + } + ] + } + ] +} diff --git a/src/LSM6DSV16XSensor.cpp b/src/LSM6DSV16XSensor.cpp index 1659029..da44c37 100644 --- a/src/LSM6DSV16XSensor.cpp +++ b/src/LSM6DSV16XSensor.cpp @@ -2,7 +2,7 @@ ****************************************************************************** * @file LSM6DSV16XSensor.cpp * @author STMicroelectronics - * @version V1.1.0 + * @version V2.2.0 * @date September 2026 * @brief Implementation of a LSM6DSV16X inertial measurement sensor. ****************************************************************************** diff --git a/src/LSM6DSV16XSensor.h b/src/LSM6DSV16XSensor.h index 6d6c5e8..1e8df56 100644 --- a/src/LSM6DSV16XSensor.h +++ b/src/LSM6DSV16XSensor.h @@ -2,7 +2,7 @@ ****************************************************************************** * @file LSM6DSV16XSensor.h * @author STMicroelectronics - * @version V1.1.0 + * @version V2.2.0 * @date September 2026 * @brief Abstract Class of a LSM6DSV16X inertial measurement sensor. ****************************************************************************** From fd88cdcd968ec0c054e7297fb56ffbac85a5d40e Mon Sep 17 00:00:00 2001 From: Davide QUARANTIELLO Date: Tue, 1 Sep 2026 16:07:12 +0200 Subject: [PATCH 6/7] fix version add _i2c --- README.md | 24 +++++++++---------- .../LSM6DSV16X_6D_Orientation_I2C.ino} | 2 +- .../LSM6DSV16X_Double_Tap_Detection_I2C.ino} | 2 +- .../LSM6DSV16X_FIFO_Interrupt_I2C.ino} | 2 +- .../LSM6DSV16X_FIFO_Polling_I2C.ino} | 2 +- .../LSM6DSV16X_Free_Fall_Detection_I2C.ino} | 2 +- .../LSM6DSV16X_MLC_I2C.ino} | 2 +- ...m6dsv16x_activity_recognition_for_mobile.h | 0 .../LSM6DSV16X_Pedometer_I2C.ino} | 2 +- .../LSM6DSV16X_Qvar_Polling_I2C.ino} | 2 +- .../LSM6DSV16X_Sensor_Fusion_I2C.ino} | 2 +- .../LSM6DSV16X_Single_Tap_Detection_I2C.ino} | 2 +- .../LSM6DSV16X_Tilt_Detection_I2C.ino} | 2 +- .../LSM6DSV16X_Wake_Up_Detection_I2C.ino} | 2 +- library.properties | 2 +- src/LSM6DSV16XSensor.cpp | 2 +- src/LSM6DSV16XSensor.h | 2 +- 17 files changed, 27 insertions(+), 27 deletions(-) rename examples/{LSM6DSV16X_6D_Orientation/LSM6DSV16X_6D_Orientation.ino => LSM6DSV16X_6D_Orientation_I2C/LSM6DSV16X_6D_Orientation_I2C.ino} (98%) rename examples/{LSM6DSV16X_Double_Tap_Detection/LSM6DSV16X_Double_Tap_Detection.ino => LSM6DSV16X_Double_Tap_Detection_I2C/LSM6DSV16X_Double_Tap_Detection_I2C.ino} (96%) rename examples/{LSM6DSV16X_FIFO_Interrupt/LSM6DSV16X_FIFO_Interrupt.ino => LSM6DSV16X_FIFO_Interrupt_I2C/LSM6DSV16X_FIFO_Interrupt_I2C.ino} (99%) rename examples/{LSM6DSV16X_FIFO_Polling/LSM6DSV16X_FIFO_Polling.ino => LSM6DSV16X_FIFO_Polling_I2C/LSM6DSV16X_FIFO_Polling_I2C.ino} (99%) rename examples/{LSM6DSV16X_Free_Fall_Detection/LSM6DSV16X_Free_Fall_Detection.ino => LSM6DSV16X_Free_Fall_Detection_I2C/LSM6DSV16X_Free_Fall_Detection_I2C.ino} (96%) rename examples/{LSM6DSV16X_MLC/LSM6DSV16X_MLC.ino => LSM6DSV16X_MLC_I2C/LSM6DSV16X_MLC_I2C.ino} (98%) rename examples/{LSM6DSV16X_MLC => LSM6DSV16X_MLC_I2C}/lsm6dsv16x_activity_recognition_for_mobile.h (100%) rename examples/{LSM6DSV16X_Pedometer/LSM6DSV16X_Pedometer.ino => LSM6DSV16X_Pedometer_I2C/LSM6DSV16X_Pedometer_I2C.ino} (98%) rename examples/{LSM6DSV16X_Qvar_Polling/LSM6DSV16X_Qvar_Polling.ino => LSM6DSV16X_Qvar_Polling_I2C/LSM6DSV16X_Qvar_Polling_I2C.ino} (96%) rename examples/{LSM6DSV16X_Sensor_Fusion/LSM6DSV16X_Sensor_Fusion.ino => LSM6DSV16X_Sensor_Fusion_I2C/LSM6DSV16X_Sensor_Fusion_I2C.ino} (98%) rename examples/{LSM6DSV16X_Single_Tap_Detection/LSM6DSV16X_Single_Tap_Detection.ino => LSM6DSV16X_Single_Tap_Detection_I2C/LSM6DSV16X_Single_Tap_Detection_I2C.ino} (96%) rename examples/{LSM6DSV16X_Tilt_Detection/LSM6DSV16X_Tilt_Detection.ino => LSM6DSV16X_Tilt_Detection_I2C/LSM6DSV16X_Tilt_Detection_I2C.ino} (97%) rename examples/{LSM6DSV16X_Wake_Up_Detection/LSM6DSV16X_Wake_Up_Detection.ino => LSM6DSV16X_Wake_Up_Detection_I2C/LSM6DSV16X_Wake_Up_Detection_I2C.ino} (96%) diff --git a/README.md b/README.md index 333453b..74e0b58 100644 --- a/README.md +++ b/README.md @@ -66,33 +66,33 @@ The access to the sensor values is done as explained below: * LSM6DSV16X_DataLog_Terminal_I2C: This application shows how to get data from LSM6DSV16X accelerometer and gyroscope and print them on terminal over I2C. -* LSM6DSV16X_6D_Orientation: This application shows how to use LSM6DSV16X accelerometer to find out the 6D orientation and display data on a hyperterminal. +* LSM6DSV16X_6D_Orientation_I2C: This application shows how to use LSM6DSV16X accelerometer to find out the 6D orientation and display data on a hyperterminal over I2C. * LSM6DSV16X_Datalog_Terminal_I3C: This application shows how to use LSM6DSV16X accelerometer and gyroscope over I3C using SETDASA. * LSM6DSV16X_Datalog_Terminal_I3C_ENTDAA: This application shows how to discover and use LSM6DSV16X dynamic address over I3C. -* LSM6DSV16X_Double_Tap_Detection: This application shows how to detect the double tap event using the LSM6DSV16X accelerometer. +* LSM6DSV16X_Double_Tap_Detection_I2C: This application shows how to detect the double tap event using the LSM6DSV16X accelerometer over I2C. -* LSM6DSV16X_Free_Fall_Detection: This application shows how to detect the free fall event using the LSM6DSV16X accelerometer. +* LSM6DSV16X_Free_Fall_Detection_I2C: This application shows how to detect the free fall event using the LSM6DSV16X accelerometer over I2C. -* LSM6DSV16X_MLC: This application shows how to detect the activity using the LSM6DSV16X Machine Learning Core. +* LSM6DSV16X_MLC_I2C: This application shows how to detect the activity using the LSM6DSV16X Machine Learning Core over I2C. -* LSM6DSV16X_Pedometer: This application shows how to use LSM6DSV16X accelerometer to count steps. +* LSM6DSV16X_Pedometer_I2C: This application shows how to use LSM6DSV16X accelerometer to count steps over I2C. -* LSM6DSV16X_Qvar_Polling: This application shows how to use LSM6DSV16X Qvar features in polling mode. +* LSM6DSV16X_Qvar_Polling_I2C: This application shows how to use LSM6DSV16X Qvar features in polling mode over I2C. -* LSM6DSV16X_Sensor_Fusion: This application shows how to use LSM6DSV16X Sensor Fusion features for reading quaternions. +* LSM6DSV16X_Sensor_Fusion_I2C: This application shows how to use LSM6DSV16X Sensor Fusion features for reading quaternions over I2C. -* LSM6DSV16X_Single_Tap_Detection: This application shows how to detect the single tap event using the LSM6DSV16X accelerometer. +* LSM6DSV16X_Single_Tap_Detection_I2C: This application shows how to detect the single tap event using the LSM6DSV16X accelerometer over I2C. -* LSM6DSV16X_Tilt_Detection: This application shows how to detect the tilt event using the LSM6DSV16X accelerometer. +* LSM6DSV16X_Tilt_Detection_I2C: This application shows how to detect the tilt event using the LSM6DSV16X accelerometer over I2C. -* LSM6DSV16X_Wake_Up_Detection: This application shows how to detect the wake-up event using the LSM6DSV16X accelerometer. +* LSM6DSV16X_Wake_Up_Detection_I2C: This application shows how to detect the wake-up event using the LSM6DSV16X accelerometer over I2C. -* LSM6DSV16X_FIFO_Polling: This application shows how to get accelerometer and gyroscope data from FIFO in pooling mode and print them on terminal. +* LSM6DSV16X_FIFO_Polling_I2C: This application shows how to get accelerometer and gyroscope data from FIFO in pooling mode and print them on terminal over I2C. -* LSM6DSV16X_FIFO_Interrupt: This application shows how to get accelerometer and gyroscope data from FIFO using interrupt and print them on terminal. +* LSM6DSV16X_FIFO_Interrupt_I2C: This application shows how to get accelerometer and gyroscope data from FIFO using interrupt and print them on terminal over I2C. ## Documentation You can find the source files at diff --git a/examples/LSM6DSV16X_6D_Orientation/LSM6DSV16X_6D_Orientation.ino b/examples/LSM6DSV16X_6D_Orientation_I2C/LSM6DSV16X_6D_Orientation_I2C.ino similarity index 98% rename from examples/LSM6DSV16X_6D_Orientation/LSM6DSV16X_6D_Orientation.ino rename to examples/LSM6DSV16X_6D_Orientation_I2C/LSM6DSV16X_6D_Orientation_I2C.ino index bd70b93..6182767 100644 --- a/examples/LSM6DSV16X_6D_Orientation/LSM6DSV16X_6D_Orientation.ino +++ b/examples/LSM6DSV16X_6D_Orientation_I2C/LSM6DSV16X_6D_Orientation_I2C.ino @@ -1,5 +1,5 @@ /* - @file LSM6DSV16X_HelloWorld.ino + @file LSM6DSV16X_6D_Orientation_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X 6D Orientation ******************************************************************************* diff --git a/examples/LSM6DSV16X_Double_Tap_Detection/LSM6DSV16X_Double_Tap_Detection.ino b/examples/LSM6DSV16X_Double_Tap_Detection_I2C/LSM6DSV16X_Double_Tap_Detection_I2C.ino similarity index 96% rename from examples/LSM6DSV16X_Double_Tap_Detection/LSM6DSV16X_Double_Tap_Detection.ino rename to examples/LSM6DSV16X_Double_Tap_Detection_I2C/LSM6DSV16X_Double_Tap_Detection_I2C.ino index fcadae1..df406df 100644 --- a/examples/LSM6DSV16X_Double_Tap_Detection/LSM6DSV16X_Double_Tap_Detection.ino +++ b/examples/LSM6DSV16X_Double_Tap_Detection_I2C/LSM6DSV16X_Double_Tap_Detection_I2C.ino @@ -1,5 +1,5 @@ /* - @file LSM6DSV16X_Double_Tap_Detection.ino + @file LSM6DSV16X_Double_Tap_Detection_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X Double Tap Detection ******************************************************************************* diff --git a/examples/LSM6DSV16X_FIFO_Interrupt/LSM6DSV16X_FIFO_Interrupt.ino b/examples/LSM6DSV16X_FIFO_Interrupt_I2C/LSM6DSV16X_FIFO_Interrupt_I2C.ino similarity index 99% rename from examples/LSM6DSV16X_FIFO_Interrupt/LSM6DSV16X_FIFO_Interrupt.ino rename to examples/LSM6DSV16X_FIFO_Interrupt_I2C/LSM6DSV16X_FIFO_Interrupt_I2C.ino index 8a30eda..ed2864f 100644 --- a/examples/LSM6DSV16X_FIFO_Interrupt/LSM6DSV16X_FIFO_Interrupt.ino +++ b/examples/LSM6DSV16X_FIFO_Interrupt_I2C/LSM6DSV16X_FIFO_Interrupt_I2C.ino @@ -1,5 +1,5 @@ /* - @file STEVAL_MEMS_FIFO_Interrupt.ino + @file LSM6DSV16X_FIFO_Interrupt_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X library with FIFO status interrupts. ******************************************************************************* diff --git a/examples/LSM6DSV16X_FIFO_Polling/LSM6DSV16X_FIFO_Polling.ino b/examples/LSM6DSV16X_FIFO_Polling_I2C/LSM6DSV16X_FIFO_Polling_I2C.ino similarity index 99% rename from examples/LSM6DSV16X_FIFO_Polling/LSM6DSV16X_FIFO_Polling.ino rename to examples/LSM6DSV16X_FIFO_Polling_I2C/LSM6DSV16X_FIFO_Polling_I2C.ino index d3697d3..f487b6d 100644 --- a/examples/LSM6DSV16X_FIFO_Polling/LSM6DSV16X_FIFO_Polling.ino +++ b/examples/LSM6DSV16X_FIFO_Polling_I2C/LSM6DSV16X_FIFO_Polling_I2C.ino @@ -1,5 +1,5 @@ /* - @file STEVAL_MEMS_FIFO_Interrupt.ino + @file LSM6DSV16X_FIFO_Polling_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X library with FIFO status interrupts. ******************************************************************************* diff --git a/examples/LSM6DSV16X_Free_Fall_Detection/LSM6DSV16X_Free_Fall_Detection.ino b/examples/LSM6DSV16X_Free_Fall_Detection_I2C/LSM6DSV16X_Free_Fall_Detection_I2C.ino similarity index 96% rename from examples/LSM6DSV16X_Free_Fall_Detection/LSM6DSV16X_Free_Fall_Detection.ino rename to examples/LSM6DSV16X_Free_Fall_Detection_I2C/LSM6DSV16X_Free_Fall_Detection_I2C.ino index 7beae01..aa24236 100644 --- a/examples/LSM6DSV16X_Free_Fall_Detection/LSM6DSV16X_Free_Fall_Detection.ino +++ b/examples/LSM6DSV16X_Free_Fall_Detection_I2C/LSM6DSV16X_Free_Fall_Detection_I2C.ino @@ -1,5 +1,5 @@ /* - @file LSM6DSV16X_Free_Fall_Detection.ino + @file LSM6DSV16X_Free_Fall_Detection_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X Free Fall Detection ******************************************************************************* diff --git a/examples/LSM6DSV16X_MLC/LSM6DSV16X_MLC.ino b/examples/LSM6DSV16X_MLC_I2C/LSM6DSV16X_MLC_I2C.ino similarity index 98% rename from examples/LSM6DSV16X_MLC/LSM6DSV16X_MLC.ino rename to examples/LSM6DSV16X_MLC_I2C/LSM6DSV16X_MLC_I2C.ino index 5bc61e8..0e3189d 100644 --- a/examples/LSM6DSV16X_MLC/LSM6DSV16X_MLC.ino +++ b/examples/LSM6DSV16X_MLC_I2C/LSM6DSV16X_MLC_I2C.ino @@ -1,5 +1,5 @@ /* - @file LSM6DSV16X_MLC.ino + @file LSM6DSV16X_MLC_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X Machine Learning Core ******************************************************************************* diff --git a/examples/LSM6DSV16X_MLC/lsm6dsv16x_activity_recognition_for_mobile.h b/examples/LSM6DSV16X_MLC_I2C/lsm6dsv16x_activity_recognition_for_mobile.h similarity index 100% rename from examples/LSM6DSV16X_MLC/lsm6dsv16x_activity_recognition_for_mobile.h rename to examples/LSM6DSV16X_MLC_I2C/lsm6dsv16x_activity_recognition_for_mobile.h diff --git a/examples/LSM6DSV16X_Pedometer/LSM6DSV16X_Pedometer.ino b/examples/LSM6DSV16X_Pedometer_I2C/LSM6DSV16X_Pedometer_I2C.ino similarity index 98% rename from examples/LSM6DSV16X_Pedometer/LSM6DSV16X_Pedometer.ino rename to examples/LSM6DSV16X_Pedometer_I2C/LSM6DSV16X_Pedometer_I2C.ino index b2a4f52..eacd9ba 100644 --- a/examples/LSM6DSV16X_Pedometer/LSM6DSV16X_Pedometer.ino +++ b/examples/LSM6DSV16X_Pedometer_I2C/LSM6DSV16X_Pedometer_I2C.ino @@ -1,5 +1,5 @@ /* - @file LSM6DSV16X_Pedometer.ino + @file LSM6DSV16X_Pedometer_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X Pedometer ******************************************************************************* diff --git a/examples/LSM6DSV16X_Qvar_Polling/LSM6DSV16X_Qvar_Polling.ino b/examples/LSM6DSV16X_Qvar_Polling_I2C/LSM6DSV16X_Qvar_Polling_I2C.ino similarity index 96% rename from examples/LSM6DSV16X_Qvar_Polling/LSM6DSV16X_Qvar_Polling.ino rename to examples/LSM6DSV16X_Qvar_Polling_I2C/LSM6DSV16X_Qvar_Polling_I2C.ino index a159242..8ddd208 100644 --- a/examples/LSM6DSV16X_Qvar_Polling/LSM6DSV16X_Qvar_Polling.ino +++ b/examples/LSM6DSV16X_Qvar_Polling_I2C/LSM6DSV16X_Qvar_Polling_I2C.ino @@ -1,5 +1,5 @@ /* - @file LSM6DSV16X_Qvar.ino + @file LSM6DSV16X_Qvar_Polling_I2C.ino @author STMicroelectronics @brief Example to use LSM6DSV16X Qvar features ******************************************************************************* diff --git a/examples/LSM6DSV16X_Sensor_Fusion/LSM6DSV16X_Sensor_Fusion.ino b/examples/LSM6DSV16X_Sensor_Fusion_I2C/LSM6DSV16X_Sensor_Fusion_I2C.ino similarity index 98% rename from examples/LSM6DSV16X_Sensor_Fusion/LSM6DSV16X_Sensor_Fusion.ino rename to examples/LSM6DSV16X_Sensor_Fusion_I2C/LSM6DSV16X_Sensor_Fusion_I2C.ino index c6d7d45..173810e 100644 --- a/examples/LSM6DSV16X_Sensor_Fusion/LSM6DSV16X_Sensor_Fusion.ino +++ b/examples/LSM6DSV16X_Sensor_Fusion_I2C/LSM6DSV16X_Sensor_Fusion_I2C.ino @@ -1,5 +1,5 @@ /* - @file LSM6DSV16X_Sensor_Fusion.ino + @file LSM6DSV16X_Sensor_Fusion_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X library with Sensor Fusion Low Power. ******************************************************************************* diff --git a/examples/LSM6DSV16X_Single_Tap_Detection/LSM6DSV16X_Single_Tap_Detection.ino b/examples/LSM6DSV16X_Single_Tap_Detection_I2C/LSM6DSV16X_Single_Tap_Detection_I2C.ino similarity index 96% rename from examples/LSM6DSV16X_Single_Tap_Detection/LSM6DSV16X_Single_Tap_Detection.ino rename to examples/LSM6DSV16X_Single_Tap_Detection_I2C/LSM6DSV16X_Single_Tap_Detection_I2C.ino index 2039f25..7ffd66f 100644 --- a/examples/LSM6DSV16X_Single_Tap_Detection/LSM6DSV16X_Single_Tap_Detection.ino +++ b/examples/LSM6DSV16X_Single_Tap_Detection_I2C/LSM6DSV16X_Single_Tap_Detection_I2C.ino @@ -1,5 +1,5 @@ /* - @file LSM6DSV16X_Single_Tap_Detection.ino + @file LSM6DSV16X_Single_Tap_Detection_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X Single Tap Detection ******************************************************************************* diff --git a/examples/LSM6DSV16X_Tilt_Detection/LSM6DSV16X_Tilt_Detection.ino b/examples/LSM6DSV16X_Tilt_Detection_I2C/LSM6DSV16X_Tilt_Detection_I2C.ino similarity index 97% rename from examples/LSM6DSV16X_Tilt_Detection/LSM6DSV16X_Tilt_Detection.ino rename to examples/LSM6DSV16X_Tilt_Detection_I2C/LSM6DSV16X_Tilt_Detection_I2C.ino index 9bbdd6b..7df3a96 100644 --- a/examples/LSM6DSV16X_Tilt_Detection/LSM6DSV16X_Tilt_Detection.ino +++ b/examples/LSM6DSV16X_Tilt_Detection_I2C/LSM6DSV16X_Tilt_Detection_I2C.ino @@ -1,5 +1,5 @@ /* - @file LSM6DSV16X_Tilt_Detection.ino + @file LSM6DSV16X_Tilt_Detection_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X Tilt Detection ******************************************************************************* diff --git a/examples/LSM6DSV16X_Wake_Up_Detection/LSM6DSV16X_Wake_Up_Detection.ino b/examples/LSM6DSV16X_Wake_Up_Detection_I2C/LSM6DSV16X_Wake_Up_Detection_I2C.ino similarity index 96% rename from examples/LSM6DSV16X_Wake_Up_Detection/LSM6DSV16X_Wake_Up_Detection.ino rename to examples/LSM6DSV16X_Wake_Up_Detection_I2C/LSM6DSV16X_Wake_Up_Detection_I2C.ino index 23ea7c9..cf77fc3 100644 --- a/examples/LSM6DSV16X_Wake_Up_Detection/LSM6DSV16X_Wake_Up_Detection.ino +++ b/examples/LSM6DSV16X_Wake_Up_Detection_I2C/LSM6DSV16X_Wake_Up_Detection_I2C.ino @@ -1,5 +1,5 @@ /* - @file LSM6DSV16X_Wake_Up_Detection.ino + @file LSM6DSV16X_Wake_Up_Detection_I2C.ino @author STMicroelectronics @brief Example to use the LSM6DSV16X Wake Up Detection ******************************************************************************* diff --git a/library.properties b/library.properties index db87fe8..8c98ed8 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=STM32duino LSM6DSV16X -version=2.2.0 +version=2.1.0 author=SRA maintainer=stm32duino sentence=Ultra Low Power inertial measurement unit. diff --git a/src/LSM6DSV16XSensor.cpp b/src/LSM6DSV16XSensor.cpp index da44c37..b568a76 100644 --- a/src/LSM6DSV16XSensor.cpp +++ b/src/LSM6DSV16XSensor.cpp @@ -2,7 +2,7 @@ ****************************************************************************** * @file LSM6DSV16XSensor.cpp * @author STMicroelectronics - * @version V2.2.0 + * @version V2.1.0 * @date September 2026 * @brief Implementation of a LSM6DSV16X inertial measurement sensor. ****************************************************************************** diff --git a/src/LSM6DSV16XSensor.h b/src/LSM6DSV16XSensor.h index 1e8df56..bece2c5 100644 --- a/src/LSM6DSV16XSensor.h +++ b/src/LSM6DSV16XSensor.h @@ -2,7 +2,7 @@ ****************************************************************************** * @file LSM6DSV16XSensor.h * @author STMicroelectronics - * @version V2.2.0 + * @version V2.1.0 * @date September 2026 * @brief Abstract Class of a LSM6DSV16X inertial measurement sensor. ****************************************************************************** From c6aab52ac45f24201ae53792e06ec58d844561f0 Mon Sep 17 00:00:00 2001 From: Davide QUARANTIELLO Date: Tue, 1 Sep 2026 17:32:59 +0200 Subject: [PATCH 7/7] add c5 to CI --- .github/workflows/Continuous-integration.yml | 2 +- extras/build_config.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Continuous-integration.yml b/.github/workflows/Continuous-integration.yml index 5614a1d..5708e70 100644 --- a/.github/workflows/Continuous-integration.yml +++ b/.github/workflows/Continuous-integration.yml @@ -60,7 +60,7 @@ jobs: uses: stm32duino/actions/compile-examples@main with: custom-config: "./extras/build_config.json" - board-pattern: "NUCLEO_L476RG|NUCLEO_H503RB" + board-pattern: "NUCLEO_L476RG|NUCLEO_H503RB|NUCLEO_C562RE" env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} # Use the output from the `Compilation` step diff --git a/extras/build_config.json b/extras/build_config.json index 9253f07..ca99740 100644 --- a/extras/build_config.json +++ b/extras/build_config.json @@ -11,13 +11,14 @@ "applicable": true, "boards": [ "NUCLEO_L476RG", - "NUCLEO_H503RB" + "NUCLEO_H503RB", + "NUCLEO_C562RE" ] }, { "pattern": "I3C", "applicable": true, - "boards": [ "NUCLEO_H503RB"] + "boards": [ "NUCLEO_H503RB","NUCLEO_C562RE"] } ] }