1 /* USER CODE BEGIN Header */ 2 /** 3 ****************************************************************************** 4 * @file app_ble.h 5 * @author MCD Application Team 6 * @brief Header for ble application 7 ****************************************************************************** 8 * @attention 9 * 10 * Copyright (c) 2024 STMicroelectronics. 11 * All rights reserved. 12 * 13 * This software is licensed under terms that can be found in the LICENSE file 14 * in the root directory of this software component. 15 * If no LICENSE file comes with this software, it is provided AS-IS. 16 * 17 ****************************************************************************** 18 */ 19 /* USER CODE END Header */ 20 21 /* Define to prevent recursive inclusion -------------------------------------*/ 22 #ifndef APP_BLE_H 23 #define APP_BLE_H 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 /* Includes ------------------------------------------------------------------*/ 30 #include "ble_events.h" 31 /* Private includes ----------------------------------------------------------*/ 32 /* USER CODE BEGIN Includes */ 33 34 /* USER CODE END Includes */ 35 36 /* Exported types ------------------------------------------------------------*/ 37 38 typedef enum 39 { 40 APP_BLE_IDLE, 41 APP_BLE_LP_CONNECTING, 42 APP_BLE_CONNECTED_SERVER, 43 APP_BLE_CONNECTED_CLIENT, 44 APP_BLE_ADV_FAST, 45 APP_BLE_ADV_LP, 46 /* USER CODE BEGIN ConnStatus_t */ 47 48 /* USER CODE END ConnStatus_t */ 49 } APP_BLE_ConnStatus_t; 50 51 typedef enum 52 { 53 PROC_GAP_GEN_PHY_TOGGLE, 54 PROC_GAP_GEN_CONN_TERMINATE, 55 PROC_GATT_EXCHANGE_CONFIG, 56 /* USER CODE BEGIN ProcGapGeneralId_t*/ 57 58 /* USER CODE END ProcGapGeneralId_t */ 59 }ProcGapGeneralId_t; 60 61 typedef enum 62 { 63 PROC_GAP_PERIPH_ADVERTISE_START_LP, 64 PROC_GAP_PERIPH_ADVERTISE_START_FAST, 65 PROC_GAP_PERIPH_ADVERTISE_STOP, 66 PROC_GAP_PERIPH_ADVERTISE_DATA_UPDATE, 67 PROC_GAP_PERIPH_CONN_PARAM_UPDATE, 68 PROC_GAP_PERIPH_CONN_TERMINATE, 69 70 PROC_GAP_PERIPH_SET_BROADCAST_MODE, 71 /* USER CODE BEGIN ProcGapPeripheralId_t */ 72 73 /* USER CODE END ProcGapPeripheralId_t */ 74 }ProcGapPeripheralId_t; 75 76 typedef enum 77 { 78 PROC_GAP_CENTRAL_SCAN_START, 79 PROC_GAP_CENTRAL_SCAN_TERMINATE, 80 /* USER CODE BEGIN ProcGapCentralId_t */ 81 82 /* USER CODE END ProcGapCentralId_t */ 83 }ProcGapCentralId_t; 84 85 /* USER CODE BEGIN ET */ 86 87 /* USER CODE END ET */ 88 89 /* Exported constants --------------------------------------------------------*/ 90 /* USER CODE BEGIN EC */ 91 92 /* USER CODE END EC */ 93 94 /* External variables --------------------------------------------------------*/ 95 96 /* USER CODE BEGIN EV */ 97 98 /* USER CODE END EV */ 99 100 /* Exported macro ------------------------------------------------------------*/ 101 #define SCAN_WIN_MS(x) ((uint16_t)((x)/0.625f)) 102 #define SCAN_INT_MS(x) ((uint16_t)((x)/0.625f)) 103 #define CONN_INT_MS(x) ((uint16_t)((x)/1.25f)) 104 #define CONN_SUP_TIMEOUT_MS(x) ((uint16_t)((x)/10.0f)) 105 #define CONN_CE_LENGTH_MS(x) ((uint16_t)((x)/0.625f)) 106 107 /* STM32WB09 Transparent Mode/DTM version (Bluetooth LE stack v4.0) */ 108 #define DTM_FW_VERSION_MAJOR 1 109 #define DTM_FW_VERSION_MINOR 0 110 #define DTM_FW_VERSION_PATCH 0 111 112 #define UART_INTERFACE 113 114 #ifdef UART_INTERFACE 115 #define DTM_VARIANT 1 116 #endif 117 #ifdef SPI_INTERFACE 118 #define DTM_VARIANT 2 119 #endif 120 /* USER CODE BEGIN EM */ 121 122 /* USER CODE END EM */ 123 124 /* Exported functions ---------------------------------------------*/ 125 void ModulesInit(void); 126 void BLE_Init(void); 127 void APP_BLE_Init(void); 128 /* USER CODE BEGIN EF */ 129 130 /* USER CODE END EF */ 131 132 #ifdef __cplusplus 133 } 134 #endif 135 136 #endif /*APP_BLE_H */ 137