79 lines
1.8 KiB
C
79 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 4096
|
|
|
|
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_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
|