rusEFI
The most advanced open source ECU
|
It looks like Bluetooth modules arrive in all kinds of initial configuration. Sometimes we need to execute a one-time initialization including settings the baud rate. rusEFI setting uartConsoleSerialSpeed or tunerStudioSerialSpeed has to match BT module configuration.
Definition in file bluetooth.cpp.
Functions | |
static void | btWrite (TsChannelBase *tsChannel, const char *str) |
static int | btReadLine (TsChannelBase *tsChannel, char *str, size_t max_len) |
static int | btWaitOk (SerialTsChannelBase *tsChannel) |
static int | btBaudOk (SerialTsChannelBase *tsChannel) |
static void | runCommands (SerialTsChannelBase *tsChannel) |
uint8_t | findBaudIndex (SerialTsChannelBase *tsChannel) |
void | bluetoothStart (bluetooth_module_e moduleType, const char *baudRate, const char *name, const char *pinCode) |
void | bluetoothSoftwareDisconnectNotify (SerialTsChannelBase *tsChannel) |
Variables | ||
static volatile bool | btSetupIsRequested = false | |
bluetooth_module_e | btModuleType | |
static int | setBaudIdx = -1 | |
static char | btName [20+1] | |
static char | btPinCode [4+1] | |
static uint8_t | workingBaudIndex | |
struct { | ||
uint32_t rate | ||
uint8_t code | ||
} | baudRates [] | |
static const int | btModuleTimeout = TIME_MS2I(2500) | |
void bluetoothSoftwareDisconnectNotify | ( | SerialTsChannelBase * | tsChannel | ) |
Called by runBinaryProtocolLoop() if a connection disconnect is detected. Bluetooth init code needs to make sure that there's no interference of the BT module and USB-UART (connected to PC)
Definition at line 338 of file bluetooth.cpp.
Referenced by tsProcessOne().
void bluetoothStart | ( | bluetooth_module_e | moduleType, |
const char * | baudRate, | ||
const char * | name, | ||
const char * | pinCode | ||
) |
Start Bluetooth module initialization using UART connection:
Definition at line 275 of file bluetooth.cpp.
Referenced by startTunerStudioConnectivity().
|
static |
Definition at line 108 of file bluetooth.cpp.
Referenced by findBaudIndex().
|
static |
Definition at line 63 of file bluetooth.cpp.
Referenced by btBaudOk(), btWaitOk(), and runCommands().
|
static |
Definition at line 93 of file bluetooth.cpp.
Referenced by findBaudIndex(), and runCommands().
|
static |
Definition at line 54 of file bluetooth.cpp.
Referenced by findBaudIndex(), and runCommands().
uint8_t findBaudIndex | ( | SerialTsChannelBase * | tsChannel | ) |
Called during bluetooth initialization. Checks to see if module responds to common baud rates returns the index of the found baud
Definition at line 233 of file bluetooth.cpp.
Referenced by runCommands().
|
static |
Definition at line 125 of file bluetooth.cpp.
Referenced by bluetoothSoftwareDisconnectNotify().
const struct { ... } baudRates[] |
Referenced by bluetoothStart(), findBaudIndex(), runCommands(), and spi_detectBaudRate().
|
static |
Definition at line 52 of file bluetooth.cpp.
Referenced by btReadLine().
bluetooth_module_e btModuleType |
Definition at line 31 of file bluetooth.cpp.
Referenced by bluetoothSoftwareDisconnectNotify(), bluetoothStart(), findBaudIndex(), and runCommands().
|
static |
Definition at line 33 of file bluetooth.cpp.
Referenced by bluetoothStart(), and runCommands().
|
static |
Definition at line 34 of file bluetooth.cpp.
Referenced by bluetoothStart(), and runCommands().
|
static |
Definition at line 29 of file bluetooth.cpp.
Referenced by bluetoothSoftwareDisconnectNotify(), and bluetoothStart().
uint8_t code |
Definition at line 40 of file bluetooth.cpp.
Referenced by WarningCodeState::addWarningCode(), analogGetDiagnostic(), check(), AemXSeriesWideband::decodeRusefiDiag(), describeUnexpected(), DisplayErrorCode(), firmwareError(), firmwareErrorV(), getCode(), initGmLS24(), WarningCodeState::isWarningNow(), SensorChecker::onSlowCallback(), runCommands(), sendErrorCode(), TunerStudio::sendErrorCode(), warning(), warningTsReport(), warningVA(), wrapAngle(), and wrapAngleMethod().
uint32_t rate |
Definition at line 39 of file bluetooth.cpp.
Referenced by findBaudIndex(), findCanConfig(), and runCommands().
|
static |
Definition at line 32 of file bluetooth.cpp.
Referenced by bluetoothStart(), and runCommands().
|
static |
Definition at line 35 of file bluetooth.cpp.
Referenced by runCommands().