dgatf / msrc

Multi Sensor for RC with RP2040 - FrSky D, SmartPort, XBUS, SRXL, IBUS, SBUS, Multiplex Sensor Bus, Jeti Ex Bus, Hitec
GNU General Public License v3.0
168 stars 41 forks source link

XBus won't work with Teensy fix #43

Closed KHeintz closed 2 years ago

KHeintz commented 3 years ago

In xbus.h etc use i2c_t3.h in place of wire.h tested with Teensy LC and 3.2 and AR8020T

#if defined(__MKL26Z64__) || defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
#include <i2c_t3.h>
#else
#include <Wire.h>
#endif

In xbus.cpp line 125 change to this

#if defined(__MKL26Z64__) || defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
#if CONFIG_ESC_PROTOCOL != PROTOCOL_NONE && CONFIG_ESC_PROTOCOL != PROTOCOL_PWM && CONFIG_ESC_PROTOCOL != PROTOCOL_CASTLE
    ESC_SERIAL.begin(19200);
    ESC_SERIAL.setTimeout(ESCSERIAL_TIMEOUT);
#endif
    Wire.begin(I2C_SLAVE, XBUS_AIRSPEED, XBUS_BATTERY,I2C_PINS_18_19, I2C_PULLUP_EXT, 400000);//Begin mask XBUS_AIRSPEED  end mask XBUS_BATTERY 
    Wire.onRequest(i2c_request_handler);
    I2C0_RA = XBUS_RPM_VOLT_TEMP << 1;
#endif
dgatf commented 2 years ago

Thank you!

Added support for i2c_t3 library. xbus fixed for teensy lc/3.x. Now it is also feasible to use i2c sensor with xbus