From 683297b804cb1275fdd17bae2d5493cb7daa7410 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sat, 4 Feb 2023 13:46:04 +0100 Subject: [PATCH] Added Bluetooth pairing PIN output for rnodeconf --- Bluetooth.h | 1 + Framing.h | 1 + Utilities.h | 13 +++++++++++++ 3 files changed, 15 insertions(+) diff --git a/Bluetooth.h b/Bluetooth.h index ecfbaf5..1763bea 100644 --- a/Bluetooth.h +++ b/Bluetooth.h @@ -32,6 +32,7 @@ char bt_devname[11]; void bt_confirm_pairing(uint32_t numVal) { bt_ssp_pin = numVal; + kiss_indicate_btpin(); if (bt_allow_pairing) { SerialBT.confirmReply(true); } else { diff --git a/Framing.h b/Framing.h index 8bd9f3a..e1bf15a 100644 --- a/Framing.h +++ b/Framing.h @@ -49,6 +49,7 @@ #define CMD_FB_READL 0x44 #define CMD_DISP_INT 0x45 #define CMD_BT_CTRL 0x46 + #define CMD_BT_PIN 0x62 #define CMD_BOARD 0x47 #define CMD_PLATFORM 0x48 diff --git a/Utilities.h b/Utilities.h index 6029b00..56b870d 100644 --- a/Utilities.h +++ b/Utilities.h @@ -26,6 +26,7 @@ #endif #if HAS_BLUETOOTH == true + void kiss_indicate_btpin(); #include "Bluetooth.h" #endif @@ -674,6 +675,18 @@ void kiss_indicate_frequency() { serial_write(FEND); } +void kiss_indicate_btpin() { + #if HAS_BLUETOOTH + serial_write(FEND); + serial_write(CMD_BT_PIN); + escaped_serial_write(bt_ssp_pin>>24); + escaped_serial_write(bt_ssp_pin>>16); + escaped_serial_write(bt_ssp_pin>>8); + escaped_serial_write(bt_ssp_pin); + serial_write(FEND); + #endif +} + void kiss_indicate_random(uint8_t byte) { serial_write(FEND); serial_write(CMD_RANDOM);