File tree Expand file tree Collapse file tree 5 files changed +37
-7
lines changed
Expand file tree Collapse file tree 5 files changed +37
-7
lines changed Original file line number Diff line number Diff line change 11#include " JY901.h"
22#include " string.h"
33
4+ #ifdef WT901_INSTEAD_OF_SOUND
45CJY901 ::CJY901 (HardwareSerial *serial)
6+ #elif WT901
7+ CJY901 ::CJY901 (SerialPIO *serial)
8+ #endif
59{
610 this ->serial = serial;
711}
Original file line number Diff line number Diff line change @@ -141,7 +141,11 @@ class CJY901
141141 struct SLonLat stcLonLat;
142142 struct SGPSV stcGPSV;
143143
144- CJY901 (HardwareSerial *serial);
144+ #ifdef WT901_INSTEAD_OF_SOUND
145+ CJY901 (HardwareSerial *serial);
146+ #elif WT901
147+ CJY901 (SerialPIO *serial);
148+ #endif
145149
146150 void begin (int baudrate = 9600 );
147151 // Call as often as possible to fetch data from serial
@@ -150,7 +154,11 @@ class CJY901
150154
151155
152156 private:
157+ #ifdef WT901_INSTEAD_OF_SOUND
153158 HardwareSerial *serial;
159+ #elif WT901
160+ SerialPIO *serial;
161+ #endif
154162 unsigned char ucRxBuffer[250 ];
155163 unsigned char ucRxCnt = 0 ;
156164
Original file line number Diff line number Diff line change @@ -77,3 +77,12 @@ lib_deps = ${env.lib_deps}
7777 JY901_SERIAL
7878build_flags =
7979 ${env.build_flags} -DWT901_INSTEAD_OF_SOUND -DHW_0_9_X
80+
81+ [env:0_9_X_WT901]
82+ lib_ignore = JY901_I2C
83+ build_src_filter = ${env.build_src_filter} +<imu/WT901_SERIAL/> +<soundsystem.cpp>
84+ lib_deps = ${env.lib_deps}
85+ JY901_SERIAL
86+ powerbroker2/DFPlayerMini_Fast@^1.2.4
87+ build_flags =
88+ ${env.build_flags} -DWT901 -DHW_0_9_X -DENABLE_SOUND_MODULE
Original file line number Diff line number Diff line change 22#include " pins.h"
33#include < JY901.h>
44
5+ #ifdef WT901_INSTEAD_OF_SOUND
56CJY901 IMU (&Serial2);
7+ #elif WT901
8+ SerialPIO imuSerial (PIN_WT901_TX, PIN_WT901_RX, 250 ); // set hardware pin
9+ CJY901 IMU (&imuSerial);
10+ #endif
611
712bool init_imu ()
813{
14+ #ifdef WT901_INSTEAD_OF_SOUND
915 Serial2.setRX (PIN_WT901_RX); // set hardware pin
1016 Serial2.setTX (PIN_WT901_TX);
17+ #endif
1118
1219 IMU.begin ();
1320
Original file line number Diff line number Diff line change 3232#define PIN_SOUND_RX 9
3333#endif
3434
35- //This is used as a hack to use WT901 on older mainboards.
3635#ifdef WT901_INSTEAD_OF_SOUND
37- #ifdef ENABLE_SOUND_MODULE
38- #error you can not enable sound and have wt901 on sound port at the same time.
39- #endif
40- #define PIN_WT901_TX 8
41- #define PIN_WT901_RX 9
36+ #ifdef ENABLE_SOUND_MODULE
37+ #error you can not enable sound and have wt901 on sound port at the same time.
38+ #endif
39+ #define PIN_WT901_TX 8
40+ #define PIN_WT901_RX 9
41+ #elif WT901 //This is to use WT901 on MPU9250 Slot via Serial.
42+ #define PIN_WT901_TX 17
43+ #define PIN_WT901_RX 16
4244#endif
4345
4446#elif HW_0_10_X
You can’t perform that action at this time.
0 commit comments