rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
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
21typedef enum {
24 /**
25 * See https://rusefi.com/forum/viewtopic.php?f=13&t=1999
26 */
28 // fun fact: those use BK3232 see above
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 */
40void 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 */
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 */
52uint8_t findBaudIndex(SerialTsChannelBase* tsChannel);
bluetooth_module_e
Definition bluetooth.h:21
@ BLUETOOTH_HC_05
Definition bluetooth.h:22
@ BLUETOOTH_BK3231
Definition bluetooth.h:27
@ BLUETOOTH_JDY_3x
Definition bluetooth.h:29
@ BLUETOOTH_JDY_31
Definition bluetooth.h:30
@ BLUETOOTH_HC_06
Definition bluetooth.h:23
void bluetoothSoftwareDisconnectNotify(SerialTsChannelBase *tsChannel)
uint8_t findBaudIndex(SerialTsChannelBase *tsChannel)
void bluetoothStart(bluetooth_module_e moduleType, const char *baudRate, const char *name, const char *pinCode)