2020TPC-SW/2020TPCAppNoDFU.cydsn/COMM/BLE/COMM_BLE.h
Joe Kearney cc574022bd Pulled in the latest SystemK (with BLE v0.12) (#2)
This change refactors the BLE subsystem to support the changes introduced in the [KTag Beacon Specification v0.12](https://ktag.clubk.club/Technology/BLE/KTag%20Beacon%20Specification%20v0.12.pdf).

SystemK changes: Software/SystemK#5

Co-authored-by: Joe Kearney <joe@clubk.club>
Reviewed-on: #2
2025-09-01 18:18:36 +00:00

80 lines
1.8 KiB
C

/** \dir "BLE"
*
* \brief This directory contains source code for managing Bluetooth Low Energy communications.
*
*/
/** \file
* \brief This file defines the interface to the Bluetooth Low Energy communications used by this software.
*
*/
#ifndef COMM_BLE_H
#define COMM_BLE_H
#ifdef __cplusplus
extern "C" {
#endif
/* Preprocessor and Type Definitions */
// Define this to print out BLE trace statements to the console.
//#define TRACE_BLE
//#define VERBOSE_BLE_TRACE
#define COMM_BLE_TASK_STACK_SIZE_in_bytes 6144
typedef enum
{
COMM_BLE_DEFAULT,
COMM_BLE_INITIALIZING,
COMM_BLE_IDLE,
COMM_BLE_SCANNING_FOR_KTAG_PACKETS,
COMM_BLE_ADVERTISING_AS_PERIPHERAL,
COMM_BLE_ADVERTISING_AS_BROADCASTER,
COMM_BLE_SCANNING_AND_ADVERTISING
} COMM_BLE_StateID_T;
typedef enum
{
COMM_BLE_COMMAND_NO_OP,
COMM_BLE_REQUEST_STATE_CHANGE,
COMM_BLE_PROCESS_BLE_EVENTS,
COMM_BLE_SCAN_FOR_KTAG_PACKETS,
COMM_BLE_ADVERTISE_AS_BROADCASTER,
COMM_BLE_ADVERTISE_AS_PERIPHERAL,
COMM_BLE_STOP_SCANNING,
COMM_BLE_STOP_ADVERTISING,
COMM_BLE_SCAN_AND_ADVERTISE,
// COMM_BLE_COMMAND_IS_OUT_OF_RANGE is one more than the last valid command.
COMM_BLE_COMMAND_IS_OUT_OF_RANGE
} COMM_BLE_Command_ID_T;
typedef struct
{
COMM_BLE_Command_ID_T ID;
void * Data;
} COMM_BLE_Command_T;
/* Include Files */
/* Public Variables */
extern cy_stc_ble_conn_handle_t appConnHandle[CY_BLE_CONN_COUNT];
extern volatile uint8_t COMM_BLE_IASAlertLevel;
extern QueueHandle_t COMM_BLE_CommandQueue;
//! Handle of the COMM_BLE_Task() given when the task was created.
extern TaskHandle_t COMM_BLE_Task_Handle;
/* Public Functions */
void COMM_BLE_Init(void);
void COMM_BLE_Task(void * pvParameters);
void COMM_BLE_RequestState(COMM_BLE_StateID_T state);
#ifdef __cplusplus
}
#endif
#endif // COMM_BLE_H