Reworked BLE according to v0.12 of the KTag Beacon Specification (#5)

This change to SystemK implements version 0.12 of the KTag Beacon Specification.

The spec. is here: [KTag Beacon Specification v0.12](https://ktag.clubk.club/Technology/BLE/KTag%20Beacon%20Specification%20v0.12.pdf)
This change also includes the 31AUG2025 changes to the State Machine (now documented [here](https://ktag.clubk.club/Technology/SystemK/SystemKStateMachine.drawio.png)), as well as changes to support automated testing.

**All projects should update to this version.**

Co-authored-by: Joe Kearney <joe@clubk.club>
Reviewed-on: #5
This commit is contained in:
Joe Kearney 2025-09-01 17:44:10 +00:00
parent 7aa827563a
commit 430aec54b8
22 changed files with 368 additions and 47 deletions

View file

@ -100,6 +100,9 @@ typedef enum
BLE_EVENT_CONFIGURED = 2,
BLE_EVENT_WRAPUP_COMPLETE = 3,
BLE_EVENT_GAME_OVER = 4,
BLE_EVENT_QUIET = 5,
BLE_EVENT_UNQUIET = 6,
BLE_EVENT_FORCE_STATE = 7,
BLE_EVENT_UNUSED = 0xFFFFFFFF
} BLE_EventID_T;
@ -174,7 +177,7 @@ typedef enum
BLE_ACKNOWLEDGE_PARAMETER_CHANGE = 0x03,
BLE_ERROR_CHANGING_PARAMETERS = 0x04,
BLE_ERROR_RESPONDING_TO_REQUEST = 0xFF
} BLE_ConfigurationSubtype_T;
} BLE_ParametersSubtype_T;
typedef enum
{
@ -292,10 +295,11 @@ void BLE_InitPacketBuffers(void);
BLE_Packet_T *BLE_DecodeKTagPacket(const uint8_t *received_data, uint8_t received_data_length, uint8_t peer_BD_ADDR[BD_ADDR_SIZE], int8_t rssi_in_dBm);
void BLE_UpdateInstigationPacket(uint32_t Game_Length_in_ms, uint32_t Time_Remaining_Until_Countdown_in_ms);
void BLE_UpdateEventPacket(uint8_t target_BD_ADDR[BD_ADDR_SIZE], BLE_EventID_T event, uint32_t data);
void BLE_UpdateStatusPacket(uint8_t current_state);
void BLE_UpdateTagPacket(int16_t damage, color_t color, uint8_t target_BD_ADDR[BD_ADDR_SIZE]);
void BLE_RespondToConfigurationPacket(const BLE_ParametersPacket_T *const packet, BLE_ConfigurationSubtype_T response);
void BLE_BroadcastCurrentParameterInfoPacket(const BLE_ParameterKey_T key_one, const uint32_t value_one, const BLE_ParameterKey_T key_two, const uint32_t value_two);
void BLE_RespondToConfigurationPacket(const BLE_ParametersPacket_T *const packet, BLE_ParametersSubtype_T response);
void BLE_UpdateParametersPacket(BLE_ParametersSubtype_T subtype, const uint8_t target_BD_ADDR[BD_ADDR_SIZE], const BLE_ParameterKey_T key_one, const uint32_t value_one, const BLE_ParameterKey_T key_two, const uint32_t value_two);
void BLE_UpdateHelloPacket();
bool BLE_IsBLEPacketForMe(const uint8_t BD_ADDR[BD_ADDR_SIZE]);