This commit is contained in:
parent
4271e8c6ff
commit
6e1a1dc3ed
|
@ -42,19 +42,19 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// How often to perform periodic event
|
// How often to perform periodic event
|
||||||
#define SBP_PERIODIC_EVT_PERIOD (160 * 10 * 5) // (160 = 100ms)
|
#define SBP_PERIODIC_EVT_PERIOD (160 * 10 * 1) // (160 = 100ms)
|
||||||
|
|
||||||
// How often to perform read rssi event
|
// How often to perform read rssi event
|
||||||
#define SBP_READ_RSSI_EVT_PERIOD (1600 * 3) // (160 = 100ms)
|
#define SBP_READ_RSSI_EVT_PERIOD (1600 * 3) // (160 = 100ms)
|
||||||
|
|
||||||
// Parameter update delay
|
// Parameter update delay
|
||||||
#define SBP_PARAM_UPDATE_DELAY (1600 * 4)
|
#define SBP_PARAM_UPDATE_DELAY (1600 * 1)
|
||||||
|
|
||||||
// PHY update delay
|
// PHY update delay
|
||||||
#define SBP_PHY_UPDATE_DELAY (1600 * 2)
|
#define SBP_PHY_UPDATE_DELAY (1600 * 1)
|
||||||
|
|
||||||
// What is the advertising interval when device is discoverable (units of 625us, 80=50ms)
|
// What is the advertising interval when device is discoverable (units of 625us, 80=50ms)
|
||||||
#define DEFAULT_ADVERTISING_INTERVAL (160 * 1)
|
#define DEFAULT_ADVERTISING_INTERVAL (160 * 10)
|
||||||
|
|
||||||
// Limited discoverable mode advertises for 30.72s, and then stops
|
// Limited discoverable mode advertises for 30.72s, and then stops
|
||||||
// General discoverable mode advertises indefinitely
|
// General discoverable mode advertises indefinitely
|
||||||
|
@ -492,8 +492,8 @@ static void Peripheral_LinkEstablished(gapRoleEvent_t *pEvent)
|
||||||
peripheralConnList.connInterval = event->connInterval;
|
peripheralConnList.connInterval = event->connInterval;
|
||||||
peripheralConnList.connSlaveLatency = event->connLatency;
|
peripheralConnList.connSlaveLatency = event->connLatency;
|
||||||
peripheralConnList.connTimeout = event->connTimeout;
|
peripheralConnList.connTimeout = event->connTimeout;
|
||||||
peripheralMTU = ATT_MTU_SIZE;
|
// peripheralMTU = ATT_MTU_SIZE;
|
||||||
// peripheralMTU = BLE_BUFF_MAX_LEN;
|
peripheralMTU = BLE_BUFF_MAX_LEN - 4;
|
||||||
// Set timer for periodic event
|
// Set timer for periodic event
|
||||||
tmos_start_task(Peripheral_TaskID, SBP_PERIODIC_EVT, SBP_PERIODIC_EVT_PERIOD);
|
tmos_start_task(Peripheral_TaskID, SBP_PERIODIC_EVT, SBP_PERIODIC_EVT_PERIOD);
|
||||||
|
|
||||||
|
@ -748,7 +748,7 @@ static void performPeriodicTask(void)
|
||||||
// {
|
// {
|
||||||
// humi = 0;
|
// humi = 0;
|
||||||
// }
|
// }
|
||||||
// peripheralChar4Notify(&RawData.buf[0], RawData.len);
|
peripheralChar4Notify(&RawData.buf[0], RawData.len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
@ -776,8 +776,10 @@ static void peripheralChar4Notify(uint8_t *pValue, uint16_t len)
|
||||||
tmos_memcpy(noti.pValue, pValue, noti.len);
|
tmos_memcpy(noti.pValue, pValue, noti.len);
|
||||||
if (simpleProfile_Notify(peripheralConnList.connHandle, ¬i) != SUCCESS)
|
if (simpleProfile_Notify(peripheralConnList.connHandle, ¬i) != SUCCESS)
|
||||||
{
|
{
|
||||||
|
logError("Noti Err");
|
||||||
GATT_bm_free((gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI);
|
GATT_bm_free((gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI);
|
||||||
}
|
}
|
||||||
|
logDebug("Noti Success");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,6 +879,9 @@ static void simpleProfileChangeCB(uint8_t paramID, uint8_t *pValue, uint16_t len
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
|
||||||
// TODO:应用加入广播数据更新部分状态数据
|
// TODO:应用加入广播数据更新部分状态数据
|
||||||
// 动态更新广播数据
|
// 动态更新广播数据
|
||||||
// taskID: 请求更改广播任务的 ID
|
// taskID: 请求更改广播任务的 ID
|
||||||
|
@ -888,10 +893,13 @@ void Peripheral_UpdateAdvertData(uint8_t adType, uint8_t dataLen, uint8_t *pAdve
|
||||||
GAP_UpdateAdvertisingData(Peripheral_TaskID, adType, dataLen, pAdvertData);
|
GAP_UpdateAdvertisingData(Peripheral_TaskID, adType, dataLen, pAdvertData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "stdarg.h"
|
#include "stdarg.h"
|
||||||
|
|
||||||
// TODO:应用加入广播数据更新部分状态数据
|
// TODO:先不弄,后面改广播名,应用加入广播数据更新部分状态数据
|
||||||
void Peripheral_SetMacName(void)
|
void Peripheral_SetMacName(void)
|
||||||
{
|
{
|
||||||
uint8_t mac_addr[6];
|
uint8_t mac_addr[6];
|
||||||
|
@ -931,3 +939,4 @@ void Peripheral_SetMacName(void)
|
||||||
// // 更新扫描响应体
|
// // 更新扫描响应体
|
||||||
GAP_UpdateAdvertisingData(Peripheral_TaskID, FALSE, scan_rsp_data, len);
|
GAP_UpdateAdvertisingData(Peripheral_TaskID, FALSE, scan_rsp_data, len);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @Author : stark1898y 1658608470@qq.com
|
* @Author : stark1898y 1658608470@qq.com
|
||||||
* @Date : 2024-12-12 15:54:57
|
* @Date : 2024-12-12 15:54:57
|
||||||
* @LastEditors : stark1898y 1658608470@qq.com
|
* @LastEditors : stark1898y 1658608470@qq.com
|
||||||
* @LastEditTime : 2024-12-12 16:47:22
|
* @LastEditTime : 2024-12-16 08:55:00
|
||||||
* @FilePath : \BLE_TYQ_CH592F\BSP\src\bsp_flash.c
|
* @FilePath : \BLE_TYQ_CH592F\BSP\src\bsp_flash.c
|
||||||
* @Description :
|
* @Description :
|
||||||
*
|
*
|
||||||
|
@ -44,7 +44,7 @@ void BSP_FLASH_Init(void)
|
||||||
EEPROM_ERASE(FLASH_INFO_ADDR, DATA_FLASH_PAGE_SIZE); // 擦除待写区
|
EEPROM_ERASE(FLASH_INFO_ADDR, DATA_FLASH_PAGE_SIZE); // 擦除待写区
|
||||||
EEPROM_WRITE(FLASH_INFO_WRITE_FLAG_ADDR, &flash_write_flag, FLASH_INFO_WRITE_FLAG_LEN);
|
EEPROM_WRITE(FLASH_INFO_WRITE_FLAG_ADDR, &flash_write_flag, FLASH_INFO_WRITE_FLAG_LEN);
|
||||||
|
|
||||||
logWarning("First Init flash_write_flag:%d", flash_write_flag);
|
logWarning("First Init flash_write_flag:%04X", flash_write_flag);
|
||||||
}
|
}
|
||||||
logDebug("BSP_FLASH_Init");
|
logDebug("BSP_FLASH_Init");
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@
|
||||||
#define BLE_TX_NUM_EVENT 1
|
#define BLE_TX_NUM_EVENT 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef BLE_TX_POWER
|
#ifndef BLE_TX_POWER
|
||||||
#define BLE_TX_POWER LL_TX_POWEER_0_DBM
|
#define BLE_TX_POWER LL_TX_POWEER_4_DBM
|
||||||
#endif
|
#endif
|
||||||
#ifndef PERIPHERAL_MAX_CONNECTION
|
#ifndef PERIPHERAL_MAX_CONNECTION
|
||||||
#define PERIPHERAL_MAX_CONNECTION 1
|
#define PERIPHERAL_MAX_CONNECTION 1
|
||||||
|
|
Loading…
Reference in New Issue