Fix doc path
[opentx.git] / radio / src / bluetooth.h
blobf0201e43174167d1f2096fa6baa32034d63347bb
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 enum BluetoothStates {
22 #if defined(PCBX9E) && !defined(USEHORUSBT)
23 BLUETOOTH_INIT,
24 BLUETOOTH_WAIT_TTM,
25 BLUETOOTH_WAIT_BAUDRATE_CHANGE,
26 #endif
27 BLUETOOTH_STATE_OFF,
28 BLUETOOTH_STATE_FACTORY_BAUDRATE_INIT,
29 BLUETOOTH_STATE_BAUDRATE_SENT,
30 BLUETOOTH_STATE_BAUDRATE_INIT,
31 BLUETOOTH_STATE_NAME_SENT,
32 BLUETOOTH_STATE_POWER_SENT,
33 BLUETOOTH_STATE_ROLE_SENT,
34 BLUETOOTH_STATE_IDLE,
35 BLUETOOTH_STATE_DISCOVER_REQUESTED,
36 BLUETOOTH_STATE_DISCOVER_SENT,
37 BLUETOOTH_STATE_DISCOVER_START,
38 BLUETOOTH_STATE_DISCOVER_END,
39 BLUETOOTH_STATE_BIND_REQUESTED,
40 BLUETOOTH_STATE_CONNECT_SENT,
41 BLUETOOTH_STATE_CONNECTED,
42 BLUETOOTH_STATE_DISCONNECTED,
45 #define LEN_BLUETOOTH_ADDR 16
47 #if (defined(PCBX7) || defined(PCBXLITE)) && !defined(SIMU)
48 extern uint8_t btChipPresent;
49 #define IS_BLUETOOTH_CHIP_PRESENT() (btChipPresent)
50 #else
51 #define IS_BLUETOOTH_CHIP_PRESENT() (true)
52 #endif
54 extern volatile uint8_t bluetoothState;
55 extern char bluetoothLocalAddr[LEN_BLUETOOTH_ADDR+1];
56 extern char bluetoothDistantAddr[LEN_BLUETOOTH_ADDR+1];
58 char * bluetoothReadline(bool error_reset=true);
59 void bluetoothWriteString(const char * command);
60 void bluetoothForwardTelemetry(uint8_t data);
61 void bluetoothWakeup();