波特率拉高到2.5Mbps
This commit is contained in:
parent
90cfd7155c
commit
ff9c225b0d
|
@ -18,6 +18,7 @@
|
||||||
"bsp_flash.h": "c",
|
"bsp_flash.h": "c",
|
||||||
"bsp_valve.h": "c",
|
"bsp_valve.h": "c",
|
||||||
"log.h": "c",
|
"log.h": "c",
|
||||||
"hal.h": "c"
|
"hal.h": "c",
|
||||||
|
"bsp_iwdg.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*
|
||||||
|
* @Author : stark1898y 1658608470@qq.com
|
||||||
|
* @Date : 2024-12-30 10:11:28
|
||||||
|
* @LastEditors : stark1898y 1658608470@qq.com
|
||||||
|
* @LastEditTime : 2025-02-22 17:23:28
|
||||||
|
* @FilePath : \BLE_TYQ_CH584M\APP\include\peripheral.h
|
||||||
|
* @Description :
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 by yzy, All Rights Reserved.
|
||||||
|
*/
|
||||||
/********************************** (C) COPYRIGHT *******************************
|
/********************************** (C) COPYRIGHT *******************************
|
||||||
* File Name : peripheral.h
|
* File Name : peripheral.h
|
||||||
* Author : WCH
|
* Author : WCH
|
||||||
|
|
|
@ -41,11 +41,9 @@ __attribute__((aligned(4))) uint32_t MEM_BUF[BLE_MEMHEAP_SIZE / 4];
|
||||||
|
|
||||||
static uint8_t key_press_cnt = 0;
|
static uint8_t key_press_cnt = 0;
|
||||||
|
|
||||||
#if 0
|
|
||||||
void app_task_handler(TeAppEvtType app_evt_type)
|
void app_task_handler(TeAppEvtType app_evt_type)
|
||||||
{
|
{
|
||||||
BSP_BlockSleep();
|
BSP_BlockSleep();
|
||||||
// BSP_BlockSleep();
|
|
||||||
BSP_RequestBoost();
|
BSP_RequestBoost();
|
||||||
|
|
||||||
switch (app_evt_type)
|
switch (app_evt_type)
|
||||||
|
@ -120,88 +118,6 @@ void app_task_handler(TeAppEvtType app_evt_type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
void app_task_handler(TeAppEvtType app_evt_type)
|
|
||||||
{
|
|
||||||
BSP_BlockSleep();
|
|
||||||
// BSP_BlockSleep();
|
|
||||||
BSP_RequestBoost();
|
|
||||||
|
|
||||||
switch(app_evt_type)
|
|
||||||
{
|
|
||||||
case kKeyShort:
|
|
||||||
logDebug("button short press");
|
|
||||||
key_press_cnt++;
|
|
||||||
logDebug("key_press_cnt = %d", key_press_cnt);
|
|
||||||
if (key_press_cnt == 1)
|
|
||||||
{
|
|
||||||
logDebug("LED显示状态");
|
|
||||||
// tmos_set_event(led_task_id, LED_SHOW_START_EVT);
|
|
||||||
BSP_BlockSleep();
|
|
||||||
BSP_RequestBoost();
|
|
||||||
DelayMs(1);
|
|
||||||
ShowLed();
|
|
||||||
// tmos_stop_task(led_task_id, LED_SHOW_ONCE_EVT);
|
|
||||||
// tmos_start_task(led_task_id, LED_SHOW_ONCE_EVT, 1000);
|
|
||||||
}
|
|
||||||
else if (key_press_cnt == 2)
|
|
||||||
{
|
|
||||||
if (gValveData.switch_status == kClosed)
|
|
||||||
{
|
|
||||||
logDebug("kClosed-->kOpened");
|
|
||||||
// tmos_set_event(led_task_id, LED_SHOW_START_EVT);
|
|
||||||
gValveData.switch_status = kOpened;
|
|
||||||
BSP_BlockSleep();
|
|
||||||
BSP_RequestBoost();
|
|
||||||
DelayMs(1);
|
|
||||||
ShowLed();
|
|
||||||
// tmos_stop_task(led_task_id, LED_SHOW_ONCE_EVT);
|
|
||||||
// tmos_start_task(led_task_id, LED_SHOW_ONCE_EVT, 1000);
|
|
||||||
}
|
|
||||||
else if (gValveData.switch_status != kClosed)
|
|
||||||
{
|
|
||||||
logDebug("kOpened-->kClosed");
|
|
||||||
gValveData.switch_status = kClosed;
|
|
||||||
tmos_set_event(vavle_task_id, VAVLE_CLOSE_START_EVT);
|
|
||||||
|
|
||||||
// tmos_set_event(led_task_id, LED_SHOW_START_EVT);
|
|
||||||
BSP_BlockSleep();
|
|
||||||
BSP_RequestBoost();
|
|
||||||
DelayMs(1);
|
|
||||||
ShowLed();
|
|
||||||
// tmos_stop_task(led_task_id, LED_SHOW_ONCE_EVT);
|
|
||||||
// tmos_start_task(led_task_id, LED_SHOW_ONCE_EVT, 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kKeyLong:
|
|
||||||
logDebug("button long press");
|
|
||||||
|
|
||||||
break;
|
|
||||||
case kKeyRelease:
|
|
||||||
// BSP_KEY_EnterLowpower();
|
|
||||||
// DelayMs(10);
|
|
||||||
key_press_cnt = 0;
|
|
||||||
// BSP_RequestSleep();
|
|
||||||
// tmos_set_event(led_task_id, LED_SHOW_END_EVT);
|
|
||||||
|
|
||||||
LED_ALL_OFF_DEINIT;
|
|
||||||
BEEP_OFF_DEINIT;
|
|
||||||
|
|
||||||
BSP_NoNeedBoost();
|
|
||||||
BSP_RequestSleep();
|
|
||||||
|
|
||||||
logDebug("gpio relase;BSP_RequestSleep");
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* @fn Main_Circulation
|
* @fn Main_Circulation
|
||||||
|
@ -218,17 +134,6 @@ __attribute__((noinline)) void Main_Circulation()
|
||||||
TMOS_SystemProcess();
|
TMOS_SystemProcess();
|
||||||
KEY_ProcessLoop();
|
KEY_ProcessLoop();
|
||||||
BSP_UART1_TxLoop();
|
BSP_UART1_TxLoop();
|
||||||
// if (GPIOB_ReadPortPin(KEY_B_PIN) == 0)
|
|
||||||
// {
|
|
||||||
// DelayMs(20);
|
|
||||||
// if (GPIOB_ReadPortPin(KEY_B_PIN) == 0)
|
|
||||||
// {
|
|
||||||
// logDebug("KEY_B_PIN short press");
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,13 +141,13 @@ __attribute__((noinline)) void Main_Circulation()
|
||||||
// 在连接间隔和广播间隔到来时,会进入该回调,可以在回调函数加上其他执行逻辑代码,如喂狗等。
|
// 在连接间隔和广播间隔到来时,会进入该回调,可以在回调函数加上其他执行逻辑代码,如喂狗等。
|
||||||
void BLE_AdvertiseEventCB(uint32_t timeUs)
|
void BLE_AdvertiseEventCB(uint32_t timeUs)
|
||||||
{
|
{
|
||||||
// FEED_IWDG();
|
FEED_IWDG();
|
||||||
logDebug("BLE_AdvertiseEventCB");
|
logDebug("BLE_AdvertiseEventCB");
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLE_ConnectEventCB(uint32_t timeUs)
|
void BLE_ConnectEventCB(uint32_t timeUs)
|
||||||
{
|
{
|
||||||
// FEED_IWDG();
|
FEED_IWDG();
|
||||||
logDebug("BLE_ConnectEventCB");
|
logDebug("BLE_ConnectEventCB");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,23 +172,16 @@ int main(void)
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// 改成 1500000 波特率了
|
// 改成 1500000 波特率了
|
||||||
BSP_UART1_Init(460800);
|
BSP_UART1_Init(2500000);
|
||||||
logDebug("Start @ChipID=%02X\n", R8_CHIP_ID);
|
|
||||||
logError("中文测试 %2.2f", 123.456);
|
|
||||||
#endif
|
#endif
|
||||||
|
DelayMs(1000 * 3);
|
||||||
|
|
||||||
CH58x_BLEInit();
|
CH58x_BLEInit();
|
||||||
|
HAL_Init();
|
||||||
|
GAPRole_PeripheralInit();
|
||||||
|
Peripheral_Init();
|
||||||
|
|
||||||
LED_R_ON;
|
logDebug("GetSysClock = %d Hz", GetSysClock());
|
||||||
DelayMs(500);
|
|
||||||
|
|
||||||
BSP_BEEP_LED_EMV_Init();
|
|
||||||
|
|
||||||
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]);
|
|
||||||
|
|
||||||
// extern void Peripheral_SetMacName(void);
|
// extern void Peripheral_SetMacName(void);
|
||||||
// Peripheral_SetMacName();
|
// Peripheral_SetMacName();
|
||||||
|
@ -294,21 +192,28 @@ int main(void)
|
||||||
|
|
||||||
BSP_FLASH_Init();
|
BSP_FLASH_Init();
|
||||||
|
|
||||||
DelayMs(100);
|
BSP_BEEP_LED_EMV_Init();
|
||||||
|
|
||||||
|
|
||||||
|
logDebug("Start @ChipID=%02X\n", R8_CHIP_ID);
|
||||||
|
logError("中文测试 %2.2f", 123.456);
|
||||||
|
|
||||||
|
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]);
|
||||||
|
// log打印编译时间和编译日期
|
||||||
|
logDebug("Compile Time: %s %s", __DATE__, __TIME__);
|
||||||
|
|
||||||
GXHTC3C_Init();
|
GXHTC3C_Init();
|
||||||
|
|
||||||
BSP_KEY_Init(app_task_handler);
|
BSP_KEY_Init(app_task_handler);
|
||||||
|
|
||||||
// IWDG_Init(1500);
|
|
||||||
DelayMs(1000 * 3);
|
|
||||||
|
|
||||||
BSP_ADC_Init();
|
BSP_ADC_Init();
|
||||||
|
|
||||||
BSP_VAVLE_Init();
|
BSP_VAVLE_Init();
|
||||||
|
|
||||||
HAL_Init();
|
|
||||||
GAPRole_PeripheralInit();
|
|
||||||
Peripheral_Init();
|
|
||||||
|
|
||||||
BSP_BlockSleep();
|
BSP_BlockSleep();
|
||||||
BSP_RequestBoost();
|
BSP_RequestBoost();
|
||||||
|
@ -321,6 +226,9 @@ int main(void)
|
||||||
LED_ALL_OFF_DEINIT;
|
LED_ALL_OFF_DEINIT;
|
||||||
BEEP_OFF_DEINIT;
|
BEEP_OFF_DEINIT;
|
||||||
|
|
||||||
|
// logDebug("IWDG_Init 0");
|
||||||
|
// IWDG_Init(1500);
|
||||||
|
|
||||||
BSP_NoNeedBoost();
|
BSP_NoNeedBoost();
|
||||||
BSP_RequestSleep();
|
BSP_RequestSleep();
|
||||||
|
|
||||||
|
@ -328,6 +236,10 @@ int main(void)
|
||||||
// LL_AdvertiseEventRegister(BLE_AdvertiseEventCB);
|
// LL_AdvertiseEventRegister(BLE_AdvertiseEventCB);
|
||||||
// LL_ConnectEventRegister(BLE_ConnectEventCB);
|
// LL_ConnectEventRegister(BLE_ConnectEventCB);
|
||||||
|
|
||||||
|
|
||||||
|
// FEED_IWDG();
|
||||||
|
// logDebug("IWDG_Init 1");
|
||||||
|
|
||||||
Main_Circulation();
|
Main_Circulation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
* @Author : stark1898y 1658608470@qq.com
|
* @Author : stark1898y 1658608470@qq.com
|
||||||
* @Date : 2024-12-15 16:13:41
|
* @Date : 2024-12-15 16:13:41
|
||||||
* @LastEditors : stark1898y 1658608470@qq.com
|
* @LastEditors : stark1898y 1658608470@qq.com
|
||||||
* @LastEditTime : 2024-12-15 16:13:42
|
* @LastEditTime : 2025-02-22 17:28:20
|
||||||
* @FilePath : \BLE_TYQ_CH584M - 副本\BSP\src\bsp_iwdg.c
|
* @FilePath : \BLE_TYQ_CH584M\BSP\src\bsp_iwdg.c
|
||||||
* @Description :
|
* @Description :
|
||||||
*
|
*
|
||||||
* Copyright (c) 2024 by yzy, All Rights Reserved.
|
* Copyright (c) 2024 by yzy, All Rights Reserved.
|
||||||
|
|
|
@ -3,7 +3,7 @@ ENTRY( _start )
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 448K
|
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 448K
|
||||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
|
|
Loading…
Reference in New Issue