rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
console
binary
bluetooth.h
Go to the documentation of this file.
1
/**
2
* @file bluetooth.h
3
* @file Bluethoot modules hardware initialization
4
*
5
* @date Aug 26, 2013
6
* @author andreika, (c) 2017
7
* @author Andrey Belomutskiy, (c) 2012-2020
8
*/
9
10
#pragma once
11
#include "
global.h
"
12
#include "
tunerstudio_io.h
"
13
14
15
// The Bluetooth setup procedure will wait (TS_COMMUNICATION_TIMEOUT + 3) seconds for the user to disconnect BT.
16
// This is required because the BT setup procedure reads a response from the module during the communication.
17
// Thus any bytes sent from the Console Software may interfere with the procedure.
18
#define BLUETOOTH_SILENT_TIMEOUT TIME_MS2I(3000)
19
20
// Supported Bluetooth module types
21
typedef
enum
{
22
BLUETOOTH_HC_05
,
23
BLUETOOTH_HC_06
,
24
/**
25
* See https://rusefi.com/forum/viewtopic.php?f=13&t=1999
26
*/
27
BLUETOOTH_BK3231
,
28
// fun fact: those use BK3232 see above
29
BLUETOOTH_JDY_3x
,
30
BLUETOOTH_JDY_31
,
31
}
bluetooth_module_e
;
32
33
/**
34
* Start Bluetooth module initialization using UART connection:
35
* - wait for PC communication disconnect;
36
* - reconfigure the UART;
37
* - send AT-commands to the module;
38
* - restore connection to PC.
39
*/
40
void
bluetoothStart
(
bluetooth_module_e
moduleType,
const
char
*baudRate,
const
char
*name,
const
char
*pinCode);
41
42
/**
43
* Called by runBinaryProtocolLoop() if a connection disconnect is detected.
44
* Bluetooth init code needs to make sure that there's no interference of the BT module and USB-UART (connected to PC)
45
*/
46
void
bluetoothSoftwareDisconnectNotify
(
SerialTsChannelBase
* tsChannel);
47
48
/**
49
* Called during bluetooth initialization. Checks to see if module responds to common baud rates
50
* returns the index of the found baud
51
*/
52
uint8_t
findBaudIndex
(
SerialTsChannelBase
* tsChannel);
bluetooth_module_e
bluetooth_module_e
Definition
bluetooth.h:21
BLUETOOTH_HC_05
@ BLUETOOTH_HC_05
Definition
bluetooth.h:22
BLUETOOTH_BK3231
@ BLUETOOTH_BK3231
Definition
bluetooth.h:27
BLUETOOTH_JDY_3x
@ BLUETOOTH_JDY_3x
Definition
bluetooth.h:29
BLUETOOTH_JDY_31
@ BLUETOOTH_JDY_31
Definition
bluetooth.h:30
BLUETOOTH_HC_06
@ BLUETOOTH_HC_06
Definition
bluetooth.h:23
bluetoothSoftwareDisconnectNotify
void bluetoothSoftwareDisconnectNotify(SerialTsChannelBase *tsChannel)
Definition
bluetooth.cpp:338
findBaudIndex
uint8_t findBaudIndex(SerialTsChannelBase *tsChannel)
Definition
bluetooth.cpp:233
bluetoothStart
void bluetoothStart(bluetooth_module_e moduleType, const char *baudRate, const char *name, const char *pinCode)
Definition
bluetooth.cpp:275
SerialTsChannelBase
Definition
tunerstudio_io.h:98
global.h
tunerstudio_io.h
Generated on Sat Sep 27 2025 00:10:04 for rusEFI by
1.9.8