Pulled in the latest SystemK (with new BLE). (#2)

The new spec is here: [KTag Beacon Specification v0.11](https://ktag.clubk.club/Technology/BLE/KTag%20Beacon%20Specification%20v0.11.pdf)

Co-authored-by: Joe Kearney <joe@clubk.club>
Reviewed-on: #2
This commit is contained in:
Joe Kearney 2025-06-08 22:05:06 +00:00
parent af01bfed91
commit 7a7ce06d66
46 changed files with 2364 additions and 1531 deletions

View file

@ -11,7 +11,8 @@
static const char *TAG = "BLE";
static bool Host_And_Controller_Synced = false;
static bool Is_Scanning_And_Advertising = false;
static bool Is_Scanning = false;
static bool Is_Advertising = false;
static uint8_t Advertising_Data[BLE_KTAG_PACKET_TOTAL_SIZE] = {0x1E, 0xFF, 0xFF, 0xFF, 'K', 'T', 'a', 'g'};
@ -247,7 +248,7 @@ SystemKResult_T BLE_SetAdvertisingData(BLE_AdvertisingData_T *data)
memcpy(Advertising_Data, data, BLE_KTAG_PACKET_TOTAL_SIZE);
}
if (Is_Scanning_And_Advertising == true)
if (Is_Advertising == true)
{
// Restart advertising to put the new data into the advertisement.
ble_gap_adv_stop();
@ -263,11 +264,32 @@ SystemKResult_T BLE_ScanAndAdvertise(void)
if (Host_And_Controller_Synced == true)
{
if (Is_Scanning_And_Advertising == false)
if (Is_Scanning == false)
{
ble_scan();
Is_Scanning = true;
}
if (Is_Advertising == false)
{
ble_advertise();
Is_Scanning_And_Advertising = true;
Is_Advertising = true;
}
result = SYSTEMK_RESULT_SUCCESS;
}
return result;
}
SystemKResult_T BLE_StopAdvertising(void)
{
SystemKResult_T result = SYSTEMK_RESULT_NOT_READY;
if (Host_And_Controller_Synced == true)
{
if (Is_Advertising == true)
{
ble_gap_adv_stop();
Is_Advertising = false;
}
result = SYSTEMK_RESULT_SUCCESS;
}