暂存,改per.c
This commit is contained in:
parent
ba4f6509cb
commit
76de810741
|
@ -43,16 +43,16 @@
|
|||
*/
|
||||
|
||||
// How often to perform periodic event
|
||||
#define SBP_PERIODIC_EVT_PERIOD 1600
|
||||
#define SBP_PERIODIC_EVT_PERIOD (160 * 10) // (160 = 100ms)
|
||||
|
||||
// How often to perform read rssi event
|
||||
#define SBP_READ_RSSI_EVT_PERIOD 3200
|
||||
#define SBP_READ_RSSI_EVT_PERIOD (1600 * 3) // (160 = 100ms)
|
||||
|
||||
// Parameter update delay
|
||||
#define SBP_PARAM_UPDATE_DELAY 6400
|
||||
#define SBP_PARAM_UPDATE_DELAY (1600 * 4)
|
||||
|
||||
// PHY update delay
|
||||
#define SBP_PHY_UPDATE_DELAY 2400
|
||||
#define SBP_PHY_UPDATE_DELAY (1600 * 2)
|
||||
|
||||
// What is the advertising interval when device is discoverable (units of 625us, 80=50ms)
|
||||
#define DEFAULT_ADVERTISING_INTERVAL (160 * 1)
|
||||
|
@ -62,7 +62,7 @@
|
|||
#define DEFAULT_DISCOVERABLE_MODE GAP_ADTYPE_FLAGS_GENERAL
|
||||
|
||||
// Minimum connection interval (units of 1.25ms, 6=7.5ms)
|
||||
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL (80 * 5)
|
||||
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL (80 * 5) // (80 = 100ms)
|
||||
|
||||
// Maximum connection interval (units of 1.25ms, 100=125ms)
|
||||
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL (80 * 10)
|
||||
|
|
|
@ -10,28 +10,32 @@
|
|||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/* 头文件包含 */
|
||||
#include "CONFIG.h"
|
||||
#include "HAL.h"
|
||||
#include "gattprofile.h"
|
||||
#include "peripheral.h"
|
||||
|
||||
#include "bsp_flash.h"
|
||||
#include "bsp_adc.h"
|
||||
|
||||
#include "bsp_key.h"
|
||||
|
||||
#include "bsp_beep_led_emv.h"
|
||||
|
||||
#include "bsp_i2c.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "bsp_uart.h"
|
||||
|
||||
#include "bsp_i2c.h"
|
||||
|
||||
#include "bsp_iwdg.h"
|
||||
#include "bsp_flash.h"
|
||||
|
||||
|
||||
#undef LOG_ENABLE
|
||||
#define LOG_ENABLE 1
|
||||
|
||||
#undef LOG_TAG
|
||||
#define LOG_TAG "main"
|
||||
|
||||
|
||||
__attribute__((aligned(4))) uint32_t MEM_BUF[BLE_MEMHEAP_SIZE / 4];
|
||||
|
||||
|
@ -71,8 +75,10 @@ __attribute__((noinline)) void Main_Circulation()
|
|||
while (1)
|
||||
{
|
||||
TMOS_SystemProcess();
|
||||
KEY_ProcessLoop();
|
||||
BSP_UART1_TxLoop();
|
||||
if (GPIOB_ReadPortPin(GPIO_Pin_15) == 0)
|
||||
#if 0
|
||||
if (GPIOB_ReadPortPin(GPIO_Pin_7) == 0)
|
||||
{
|
||||
// 12V_EN
|
||||
BOOST_EN;
|
||||
|
@ -113,7 +119,6 @@ __attribute__((noinline)) void Main_Circulation()
|
|||
DelayMs(1000);
|
||||
logDebug("LED_ALL_OFF_DEINIT\n");
|
||||
|
||||
|
||||
logDebug("Delay 6s\n");
|
||||
|
||||
// EMV_CHARGE
|
||||
|
@ -136,9 +141,24 @@ __attribute__((noinline)) void Main_Circulation()
|
|||
EMV_CHARGE_OFF_DEINIT;
|
||||
EMV_OFF_DEINIT;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// https://www.cnblogs.com/gscw/p/18530905
|
||||
// 在连接间隔和广播间隔到来时,会进入该回调,可以在回调函数加上其他执行逻辑代码,如喂狗等。
|
||||
void BLE_AdvertiseEventCB(uint32_t timeUs)
|
||||
{
|
||||
// FEED_IWDG();
|
||||
logDebug("BLE_AdvertiseEventCB");
|
||||
}
|
||||
|
||||
void BLE_ConnectEventCB(uint32_t timeUs)
|
||||
{
|
||||
// FEED_IWDG();
|
||||
logDebug("BLE_ConnectEventCB");
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* @fn main
|
||||
*
|
||||
|
@ -166,7 +186,6 @@ int main(void)
|
|||
|
||||
// 改成1500000波特率了
|
||||
BSP_UART1_Init(1500000);
|
||||
// logDebug("Start @ChipID=%02X\n", R8_CHIP_ID);
|
||||
logDebug("Start @ChipID=%02X\n", R8_CHIP_ID);
|
||||
logError("中文测试 %2.2f", 123.456);
|
||||
|
||||
|
@ -186,12 +205,16 @@ int main(void)
|
|||
logDebug("%s\n", VER_LIB);
|
||||
uint8_t MacAddr[6];
|
||||
GetMACAddress(MacAddr);
|
||||
// 手机APP显示是倒序的[5-0],不是[0-5]
|
||||
logDebug("MacAddr: %02X:%02X:%02X:%02X:%02X:%02X", MacAddr[0], MacAddr[1], MacAddr[2], MacAddr[3], MacAddr[4], MacAddr[5]);
|
||||
|
||||
HAL_Init();
|
||||
GAPRole_PeripheralInit();
|
||||
Peripheral_Init();
|
||||
|
||||
// 在连接间隔和广播间隔到来时,会进入回调中喂狗
|
||||
// LL_AdvertiseEventRegister(BLE_AdvertiseEventCB);
|
||||
// LL_ConnectEventRegister(BLE_ConnectEventCB);
|
||||
|
||||
BSP_FLASH_Init();
|
||||
|
||||
|
@ -200,6 +223,8 @@ int main(void)
|
|||
|
||||
BSP_KEY_Init(app_task_handler);
|
||||
|
||||
// IWDG_Init(1500);
|
||||
|
||||
Main_Circulation();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue