Skip to content

Commit 09a28f0

Browse files
authored
Feature/LSM6DSO (#112)
* Add LSM6DSO for HW 0.9.x * Add LSMDSO for HW 0.10 and 0.11 * Add new LSM6DSO variants to CI
1 parent 42f5810 commit 09a28f0

File tree

4 files changed

+50
-7
lines changed

4 files changed

+50
-7
lines changed

.github/workflows/ci.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ jobs:
9696
cp Firmware/LowLevel/.pio/build/0_11_X_WT901/firmware.elf ./artifacts/0_11_X_WT901
9797
cp Firmware/LowLevel/.pio/build/0_11_X_WT901/firmware.uf2 ./artifacts/0_11_X_WT901
9898
99+
mkdir ./artifacts/0_11_X_LSM6DSO
100+
cp Firmware/LowLevel/.pio/build/0_11_X_LSM6DSO/firmware.elf ./artifacts/0_11_X_LSM6DSO
101+
cp Firmware/LowLevel/.pio/build/0_11_X_LSM6DSO/firmware.uf2 ./artifacts/0_11_X_LSM6DSO
102+
99103
mkdir ./artifacts/0_10_X_MPU9250
100104
cp Firmware/LowLevel/.pio/build/0_10_X_MPU9250/firmware.elf ./artifacts/0_10_X_MPU9250
101105
cp Firmware/LowLevel/.pio/build/0_10_X_MPU9250/firmware.uf2 ./artifacts/0_10_X_MPU9250
@@ -104,6 +108,10 @@ jobs:
104108
cp Firmware/LowLevel/.pio/build/0_10_X_WT901/firmware.elf ./artifacts/0_10_X_WT901
105109
cp Firmware/LowLevel/.pio/build/0_10_X_WT901/firmware.uf2 ./artifacts/0_10_X_WT901
106110
111+
mkdir ./artifacts/0_10_X_LSM6DSO
112+
cp Firmware/LowLevel/.pio/build/0_10_X_LSM6DSO/firmware.elf ./artifacts/0_10_X_LSM6DSO
113+
cp Firmware/LowLevel/.pio/build/0_10_X_LSM6DSO/firmware.uf2 ./artifacts/0_10_X_LSM6DSO
114+
107115
mkdir ./artifacts/0_9_X_MPU9250
108116
cp Firmware/LowLevel/.pio/build/0_9_X_MPU9250/firmware.elf ./artifacts/0_9_X_MPU9250
109117
cp Firmware/LowLevel/.pio/build/0_9_X_MPU9250/firmware.uf2 ./artifacts/0_9_X_MPU9250
@@ -115,7 +123,11 @@ jobs:
115123
mkdir ./artifacts/0_9_X_WT901_INSTEAD_OF_SOUND
116124
cp Firmware/LowLevel/.pio/build/0_9_X_WT901_INSTEAD_OF_SOUND/firmware.elf ./artifacts/0_9_X_WT901_INSTEAD_OF_SOUND
117125
cp Firmware/LowLevel/.pio/build/0_9_X_WT901_INSTEAD_OF_SOUND/firmware.uf2 ./artifacts/0_9_X_WT901_INSTEAD_OF_SOUND
118-
126+
127+
mkdir ./artifacts/0_9_X_LSM6DSO
128+
cp Firmware/LowLevel/.pio/build/0_9_X_LSM6DSO/firmware.elf ./artifacts/0_9_X_LSM6DSO
129+
cp Firmware/LowLevel/.pio/build/0_9_X_LSM6DSO/firmware.uf2 ./artifacts/0_9_X_LSM6DSO
130+
119131
- name: Upload Artifacts
120132
uses: actions/upload-artifact@v4
121133
with:

Firmware/LowLevel/platformio.ini

+26
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ lib_deps = ${env.lib_deps}
8181
JY901_I2C
8282
build_flags = ${env.build_flags} -DWT901_I2C -DHW_0_11_X -DENABLE_SOUND_MODULE
8383

84+
[env:0_11_X_LSM6DSO]
85+
build_src_filter = ${env.build_src_filter} +<imu/LSM6DSO/>
86+
lib_ignore = JY901_SERIAL,JY901_I2C
87+
lib_deps = ${env.lib_deps}
88+
${sound.lib_deps}
89+
stm32duino/STM32duino LSM6DSO@^2.0.3
90+
jpiat/PioSPI@^0.0.1
91+
build_flags = ${env.build_flags} -DHW_0_11_X -DENABLE_SOUND_MODULE
92+
8493

8594
[env:0_10_X_MPU9250]
8695
lib_ignore = JY901_SERIAL,JY901_I2C
@@ -98,6 +107,15 @@ lib_deps = ${env.lib_deps}
98107
JY901_I2C
99108
build_flags = ${env.build_flags} -DWT901_I2C -DHW_0_10_X -DENABLE_SOUND_MODULE
100109

110+
[env:0_10_X_LSM6DSO]
111+
build_src_filter = ${env.build_src_filter} +<imu/LSM6DSO/>
112+
lib_ignore = JY901_SERIAL,JY901_I2C
113+
lib_deps = ${env.lib_deps}
114+
${sound.lib_deps}
115+
stm32duino/STM32duino LSM6DSO@^2.0.3
116+
jpiat/PioSPI@^0.0.1
117+
build_flags = ${env.build_flags} -DHW_0_10_X -DENABLE_SOUND_MODULE
118+
101119

102120
[env:0_9_X_MPU9250]
103121
lib_ignore = JY901_SERIAL,JY901_I2C
@@ -121,3 +139,11 @@ lib_deps = ${env.lib_deps}
121139
${sound.lib_deps}
122140
JY901_SERIAL
123141
build_flags = ${env.build_flags} -DWT901 -DHW_0_9_X -DENABLE_SOUND_MODULE
142+
143+
[env:0_9_X_LSM6DSO]
144+
lib_ignore = JY901_SERIAL,JY901_I2C
145+
build_src_filter = ${env.build_src_filter} +<imu/LSM6DSO/>
146+
lib_deps = ${env.lib_deps}
147+
${sound.lib_deps}
148+
stm32duino/STM32duino LSM6DSO@^2.0.3
149+
build_flags = ${env.build_flags} -DHW_0_9_X -DENABLE_SOUND_MODULE

Firmware/LowLevel/src/imu/LSM6DSO/imu.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#include "pins.h"
33
#include <LSM6DSOSensor.h>
44

5-
#ifdef HW_0_12_X
6-
// Needs software UART because pins were messed up in 0.12
5+
#if defined(HW_0_10_X) || defined(HW_0_11_X) || defined(HW_0_12_X)
6+
// Needs software SPI because pins were messed up in 0.10-0.12
77
#include <PioSPI.h>
88
PioSPI spiBus(PIN_IMU_MOSI, PIN_IMU_MISO, PIN_IMU_SCK, PIN_IMU_CS, SPI_MODE3, 1000000);
99
#else
@@ -16,7 +16,7 @@ int32_t accelerometer[3];
1616
int32_t gyroscope[3];
1717

1818
bool init_imu() {
19-
#ifdef HW_0_12_X
19+
#if defined(HW_0_10_X) || defined(HW_0_11_X) || defined(HW_0_12_X)
2020
spiBus.begin();
2121
#else
2222
spiBus.setCS(PIN_IMU_CS);

Firmware/LowLevel/src/pins.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

33
#ifdef HW_0_9_X
4-
#define PIN_IMU_CS 17
54
#define PIN_ANALOG_BATTERY_VOLTAGE 27
65
#define PIN_ANALOG_CHARGE_VOLTAGE 26
76
#define PIN_ANALOG_CHARGE_CURRENT 28
@@ -32,15 +31,21 @@
3231
#define PIN_SOUND_RX 9
3332
#endif
3433

35-
#ifdef WT901_INSTEAD_OF_SOUND
34+
// IMU Variants
35+
#ifdef WT901_INSTEAD_OF_SOUND // WT901 via HardwareSerial
3636
#ifdef ENABLE_SOUND_MODULE
3737
#error you can not enable sound and have wt901 on sound port at the same time.
3838
#endif
3939
#define PIN_WT901_TX 8
4040
#define PIN_WT901_RX 9
41-
#elif WT901 //This is to use WT901 on MPU9250 Slot via Serial.
41+
#elif WT901 // WT901 on MPU9250 Slot via SerialPIO.
4242
#define PIN_WT901_TX 17
4343
#define PIN_WT901_RX 16
44+
#else
45+
#define PIN_IMU_CS 17 // MPU9250
46+
#define PIN_IMU_RX 16 // LSM6DSx
47+
#define PIN_IMU_TX 19 // LSM6DSx
48+
#define PIN_IMU_SCK 18 // LSM6DSx
4449
#endif
4550

4651
#elif HW_0_10_X || HW_0_11_X || HW_0_12_X

0 commit comments

Comments
 (0)