暂存,广播扫不到

This commit is contained in:
stark1898y 2024-12-15 14:30:06 +08:00
parent c932d616cd
commit 6ec37f1274
10 changed files with 226 additions and 62 deletions

View File

@ -14,7 +14,7 @@
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="${cross_rm} -rf" description="" id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074" name="obj" parent="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release" postbuildStep=" ${cross_prefix}${cross_objcopy}${cross_suffix} -O ihex &quot;${ProjName}.elf&quot; &quot;${ProjName}.hex&quot; &amp;&amp; ${cross_prefix}${cross_objcopy}${cross_suffix} -O binary &quot;${ProjName}.elf&quot; &quot;${ProjName}.bin&quot;">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="${cross_rm} -rf" description="" id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074" name="obj" parent="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release" postbuildStep="">
<folderInfo id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074." name="/" resourcePath="">
<toolChain id="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release.231146001" name="RISC-V Cross GCC" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release">
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash.1311852988" name="Create flash image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash" useByScannerDiscovery="false" value="true" valueType="boolean"/>
@ -127,7 +127,7 @@
</tool>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver.1292785366" name="GNU RISC-V Cross Archiver" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash.1801165667" name="GNU RISC-V Cross Create Flash Image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash">
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice.777102436" name="Output file format (-O)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice" useByScannerDiscovery="false" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice.ihexAndbinary" valueType="enumerated"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice.777102436" name="Output file format (-O)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice" useByScannerDiscovery="false" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice.ihex" valueType="enumerated"/>
</tool>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting.1356766765" name="GNU RISC-V Cross Create Listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting">
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source.2052761852" name="Display source (--source|-S)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source" useByScannerDiscovery="false" value="true" valueType="boolean"/>
@ -176,5 +176,5 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="refreshScope"/>
</cproject>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<projectDescription>
<name>BLE_TYQ_CH592F</name>
<comment></comment>
<comment/>
<projects>
</projects>
<buildSpec>
@ -26,7 +26,7 @@
<filteredResources>
<filter>
<id>1602468250279</id>
<name></name>
<name/>
<type>22</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>

View File

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-675874543788235318" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1299894306125289391" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@ -1,7 +1,9 @@
eclipse.preferences.version=1
encoding//APP/peripheral.c=UTF-8
encoding//APP/peripheral_main.c=UTF-8
encoding//BSP/inc/bsp_iwdg.h=UTF-8
encoding//BSP/inc/bsp_valve.h=UTF-8
encoding//BSP/src/bsp_iwdg.c=UTF-8
encoding//BSP/src/bsp_key.c=UTF-8
encoding//BSP/src/bsp_valve.c=UTF-8
encoding//common/letter-shell/extensions/log/log.h=UTF-8

View File

@ -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)
@ -102,23 +102,7 @@ static uint8_t scanRspData[] = {
// complete name
0x12, // length of this data
GAP_ADTYPE_LOCAL_NAME_COMPLETE,
'S',
'i',
'm',
'p',
'l',
'e',
' ',
'P',
'e',
'r',
'i',
'p',
'h',
'e',
'r',
'a',
'l',
's', 'i', 'm', 'p', 'l', 'e', ' ', 'P', 'e', 'r', 'i', 'p', 'h', 'e', 'r', 'a', 'l',
// connection interval range
0x05, // length of this data
GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE,
@ -300,6 +284,7 @@ void Peripheral_Init()
GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &initial_advertising_enable);
GAPRole_SetParameter(GAPROLE_SCAN_RSP_DATA, sizeof(scanRspData), scanRspData);
GAPRole_SetParameter(GAPROLE_ADVERT_DATA, sizeof(advertData), advertData);
GAPRole_SetParameter(GAPROLE_MIN_CONN_INTERVAL, sizeof(uint16_t), &desired_min_interval);
GAPRole_SetParameter(GAPROLE_MAX_CONN_INTERVAL, sizeof(uint16_t), &desired_max_interval);
}
@ -558,7 +543,7 @@ static void Peripheral_LinkEstablished(gapRoleEvent_t *pEvent)
if(peripheralConnList.connHandle != GAP_CONNHANDLE_INIT)
{
GAPRole_TerminateLink(pEvent->linkCmpl.connectionHandle);
logDebug("Connection max...\n");
logDebug("Connection max...");
}
else
{
@ -604,13 +589,18 @@ static void Peripheral_LinkTerminated(gapRoleEvent_t *pEvent)
// Restart advertising
{
// 三个广播通道全部打开
// uint8_t init_adv_channel_map = GAP_ADVCHAN_ALL ;
// GAPRole_SetParameter( GAPROLE_ADV_CHANNEL_MAP, sizeof( uint8_t ), &init_adv_channel_map);
// 开启广播
uint8_t advertising_enable = TRUE;
GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &advertising_enable);
}
}
else
{
logDebug("ERR..\n");
logError("ERR..");
}
}
@ -655,7 +645,7 @@ static void peripheralParamUpdateCB(uint16_t connHandle, uint16_t connInterval,
}
else
{
logDebug("ERR..\n");
logError("ERR..");
}
}
@ -673,7 +663,7 @@ static void peripheralStateNotificationCB(gapRole_States_t newState, gapRoleEven
switch(newState & GAPROLE_STATE_ADV_MASK)
{
case GAPROLE_STARTED:
logDebug("Initialized..\n");
logDebug("Initialized..");
break;
case GAPROLE_ADVERTISING:
@ -681,11 +671,11 @@ static void peripheralStateNotificationCB(gapRole_States_t newState, gapRoleEven
{
Peripheral_LinkTerminated(pEvent);
logDebug("Disconnected.. Reason:%x\n", pEvent->linkTerminate.reason);
logDebug("Advertising..\n");
logDebug("Advertising..");
}
else if(pEvent->gap.opcode == GAP_MAKE_DISCOVERABLE_DONE_EVENT)
{
logDebug("Advertising..\n");
logDebug("Advertising..");
}
break;
@ -693,21 +683,21 @@ static void peripheralStateNotificationCB(gapRole_States_t newState, gapRoleEven
if(pEvent->gap.opcode == GAP_LINK_ESTABLISHED_EVENT)
{
Peripheral_LinkEstablished(pEvent);
logDebug("Connected..\n");
logDebug("Connected..");
}
break;
case GAPROLE_CONNECTED_ADV:
if(pEvent->gap.opcode == GAP_MAKE_DISCOVERABLE_DONE_EVENT)
{
logDebug("Connected Advertising..\n");
logDebug("Connected Advertising..");
}
break;
case GAPROLE_WAITING:
if(pEvent->gap.opcode == GAP_END_DISCOVERABLE_DONE_EVENT)
{
logDebug("Waiting for advertising..\n");
logDebug("Waiting for advertising..");
}
else if(pEvent->gap.opcode == GAP_LINK_TERMINATED_EVENT)
{
@ -718,11 +708,11 @@ static void peripheralStateNotificationCB(gapRole_States_t newState, gapRoleEven
{
if(pEvent->gap.hdr.status != SUCCESS)
{
logDebug("Waiting for advertising..\n");
logDebug("Waiting for advertising..");
}
else
{
logDebug("Error..\n");
logDebug("Error..");
}
}
else
@ -732,7 +722,7 @@ static void peripheralStateNotificationCB(gapRole_States_t newState, gapRoleEven
break;
case GAPROLE_ERROR:
logDebug("Error..\n");
logDebug("Error..");
break;
default:
@ -865,6 +855,7 @@ static void peripheralChar4Notify(uint8_t *pValue, uint16_t len)
*/
static void simpleProfileChangeCB(uint8_t paramID, uint8_t *pValue, uint16_t len)
{
// tmos_event_hdr_t *test_message;
TsRawFrameData RawData;
switch(paramID)
{
@ -872,14 +863,17 @@ static void simpleProfileChangeCB(uint8_t paramID, uint8_t *pValue, uint16_t len
{
uint8_t newValue[SIMPLEPROFILE_CHAR1_LEN];
tmos_memcpy(newValue, pValue, len);
logDebug("profile ChangeCB CHAR1.. Start\n");
logDebug("profile ChangeCB CHAR1.. Start");
for (uint8_t i = 0; i < len; i++)
{
logDebug("%02x ", newValue[i]);
BSP_UART1_TxLoop();
}
logDebug("\n profile ChangeCB CHAR1.. End\n");
logDebug("\n profile ChangeCB CHAR1.. End");
// test_message =(tmos_event_hdr_t*) tmos_msg_allocate(sizeof(tmos_event_hdr_t));
BSP_UART1_TxLoop();
break;
}
@ -944,5 +938,14 @@ static void simpleProfileChangeCB(uint8_t paramID, uint8_t *pValue, uint16_t len
}
}
/*********************************************************************
*********************************************************************/
// TODO:应用加入广播数据更新部分状态数据
// 动态更新广播数据
// taskID 请求更改广播任务的 ID
// adTypeTRUE 更改广播数据FALSE 更改扫描回复数据
// datalen数据长度
// *pAdvertData数据指针
void Peripheral_UpdateAdvertData(uint8_t adType, uint8_t dataLen, uint8_t *pAdvertData)
{
GAP_UpdateAdvertisingData(Peripheral_TaskID, adType, dataLen, pAdvertData);
}

View File

@ -28,6 +28,8 @@
#include "bsp_i2c.h"
#include "bsp_iwdg.h"
#undef LOG_ENABLE
#define LOG_ENABLE 1
@ -146,20 +148,21 @@ void Main_Circulation()
}
}
/*********************************************************************
* @fn BLE_AdvertiseEventCB
*
* @brief Callback from advertise over
*
* @param None
*
* @return none
*/
// 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
*
@ -172,6 +175,7 @@ int main(void)
#if (defined(DCDC_ENABLE)) && (DCDC_ENABLE == TRUE)
PWR_DCDCCfg(ENABLE);
#endif
// 设置主频为60MHz
SetSysClock(CLK_SOURCE_PLL_60MHz);
#if (defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
@ -189,6 +193,7 @@ int main(void)
// logDebug("Start @ChipID=%02X\n", R8_CHIP_ID);
logDebug("Start @ChipID=%02X\n", R8_CHIP_ID);
logError("中文测试 %2.2f", 123.456);
ShowRestartReason();
#endif
DelayMs(1000 * 3);
@ -208,8 +213,9 @@ int main(void)
HAL_Init();
GAPRole_PeripheralInit();
Peripheral_Init();
LL_AdvertiseEventRegister(BLE_AdvertiseEventCB);
// 在连接间隔和广播间隔到来时,会进入回调中喂狗
// LL_AdvertiseEventRegister(BLE_AdvertiseEventCB);
// LL_ConnectEventRegister(BLE_ConnectEventCB);
DelayMs(100);
GXHTC3C_Init();
@ -221,6 +227,8 @@ int main(void)
// BSP_KEY_Init();
BSP_KEY_Init(app_task_handler);
// IWDG_Init(1500);
Main_Circulation();
}

View File

@ -2,7 +2,7 @@
* @Author : stark1898y 1658608470@qq.com
* @Date : 2024-12-14 10:51:01
* @LastEditors : stark1898y 1658608470@qq.com
* @LastEditTime : 2024-12-14 10:51:10
* @LastEditTime : 2024-12-15 11:16:24
* @FilePath : \BLE_TYQ_CH592F\BSP\inc\bsp_iwdg.h
* @Description :
*
@ -21,8 +21,14 @@
#define RB_WR_PROTECT 0x40000000 // RO, write protect
#define RB_IWDG_EN 0x80000000 // RO, watch-dog enable
#define ch59x_iwdg_feed() (R32_IWDG_KR = 0xaaaa)
void IWDG_Init(uint16_t ms);
// 需要定时调用喂狗
// 在看门狗键寄存器 (R32_IWDG_KR) 中,软件要以一定的间隔写入 0xAAAA重装载计数值这就是喂狗的操作。
// 否则,当计数器为 0 时,看门狗会产生复位。
#define FEED_IWDG() {R32_IWDG_KR=0xAAAA;}
void ShowRestartReason(void);
#endif // !__BSP_IWDG_H__

View File

@ -2,7 +2,7 @@
* @Author : stark1898y 1658608470@qq.com
* @Date : 2024-12-12 15:55:38
* @LastEditors : stark1898y 1658608470@qq.com
* @LastEditTime : 2024-12-14 18:08:58
* @LastEditTime : 2024-12-15 10:40:07
* @FilePath : \BLE_TYQ_CH592F\BSP\inc\bsp_valve.h
* @Description :
*
@ -13,6 +13,15 @@
#include "CONFIG.h"
#define VAVLE_RX_DATA_EVT (0x0001 << 0)
#define VAVLE_TX_DATA_EVT (0x0001 << 1)
#define VAVLE_CLOSE_START_EVT (0x0001 << 2) // 关阀,开始充电
#define VAVLE_CLOSE_END_EVT (0x0001 << 2) // 关阀,开始充电
#define CHARGE_TIME_MS 1000
#define FRAME_HEADER 0xAA
#define FRAME_TAIL 0x55

View File

@ -3,6 +3,9 @@
#include "bsp_uart.h"
#include "log.h"
// https://www.cnblogs.com/debugdabiaoge/p/17580033.html
// https://www.cnblogs.com/risc5-ble/p/17853714.html
#undef LOG_ENABLE
#define LOG_ENABLE 1
@ -11,13 +14,86 @@
// 32k rc
// div 0:4 | 1:8 | 2:16 | 3:32 |
// 4:64 | 5:128 | 6:256 | 7:512 |
// 4:64 | 5:128 | 6:256 | 7:512(32K分频512时钟62.5Hz) |
// reload max 4095
void ch59x_iwdg_init(uint8_t div, uint16_t reload)
// 独立看门狗IWDG由专用的内部低速时钟LSI驱动能够在低功耗模式下正常工作。
void IWDG_Init(uint16_t ms)
{
uint16_t div = 512;
float tick_ms = 1000 / (32000 / 512);
uint16_t reload = (ms / tick_ms) + 1;
// 解除IWDG保护
R32_IWDG_KR = 0x5555;
R32_IWDG_CFG = (RB_PR & (div << 12)) | (RB_STOP_EN) | (reload & RB_RLR);
R32_IWDG_KR = 0xcccc; // enable
// 开启IWDG保护
R32_IWDG_KR = 0xCCCC;
logDebug("R32_IWDG_CFG = %X", R32_IWDG_CFG);
}
// #define RB_RESET_FLAG 0x07 // RO: recent reset flag
// #define RST_FLAG_SW 0x00
// #define RST_FLAG_RPOR 0x01
// #define RST_FLAG_WTR 0x02
// #define RST_FLAG_MR 0x03
// //#define RST_FLAG_GPWSM 0x04 // RO, power on reset flag during sleep/shutdown: 0=no power on reset during sleep/shutdown, 1=power on reset occurred during sleep/shutdown
// #define RST_FLAG_GPWSM 0x05
// // RB_RESET_FLAG: recent reset flag
// // 000 - SR, software reset, by RB_SOFTWARE_RESET=1 @RB_WDOG_RST_EN=0
// // 001 - RPOR, real power on reset
// // 010 - WTR, watch-dog timer-out reset
// // 011 - MR, external manual reset by RST pin input low
// // 101 - GRWSM, global reset by waking under shutdown mode
// 1?? - LRW, power on reset occurred during sleep
// 打印复位状态寄存器,显示复位原因
// 最近一次复位状态:
// 000软件复位 SRRB_WDOG_RST_EN=0时软件复位可产生此状态否则可复位但不产生此状态
// 001上电复位 RPOR
// 010看门狗超时复位 WTR
// 011外部手动复位 MR
// 101从下电模式唤醒时的复位 GRWSM
// 100/110/111唤醒复位 LRW且此前的上一次复位分别是 SR/WTR/MR。
void ShowRestartReason(void)
{
uint8_t reason = R8_RESET_STATUS&0x07;
logDebug("R8_RESET_STATUS = %02x", reason);
switch (reason)
{
case RST_FLAG_SW:
logDebug("RST_FLAG_SW");
break;
case RST_FLAG_RPOR:
logDebug("RST_FLAG_RPOR");
break;
case RST_FLAG_WTR:
logDebug("RST_FLAG_WTR");
break;
case RST_FLAG_MR:
logDebug("RST_FLAG_MR");
break;
case RST_FLAG_GPWSM:
logDebug("RST_FLAG_GPWSM");
break;
case 0x04:
logDebug("LRW, last SR");
break;
case 0x06:
logDebug("LRW, last WTR");
break;
case 0x07:
logDebug("LRW, last MR");
default:
break;
}
}

View File

@ -23,6 +23,8 @@
#undef LOG_TAG
#define LOG_TAG "BSP_VALVE"
//存储 当前task id 的全局变量
tmosTaskID vavle_task_id = INVALID_TASK_ID;
/**
@ -250,8 +252,66 @@ void BSP_CloseValve(void)
DelayMs(100);
}
static void VAVLE_Task_ProcessTmosMsg(tmos_event_hdr_t *pMsg)
{
switch (pMsg->event)
{
default:
logDebug("pMsg->event %04x", pMsg->event);
break;
}
}
//task的event处理回调函数,需要在注册task时候,传进去
static uint16_t VAVLE_Task_ProcessEvent( uint8_t task_id, uint16_t events )
{
if (events & SYS_EVENT_MSG)
{
uint8_t *pMsg;
if ((pMsg = tmos_msg_receive(vavle_task_id)) != NULL)
{
VAVLE_Task_ProcessTmosMsg((tmos_event_hdr_t *)pMsg);
// Release the TMOS message
tmos_msg_deallocate(pMsg);
}
// return unprocessed events
return (events ^ SYS_EVENT_MSG);
}
if (events & VAVLE_RX_DATA_EVT)
{
logDebug("VAVLE_RX_DATA_EVT");
return (events ^ VAVLE_RX_DATA_EVT);
}
if (events & VAVLE_TX_DATA_EVT)
{
logDebug("VAVLE_TX_DATA_EVT");
return (events ^ VAVLE_TX_DATA_EVT);
}
if (events & VAVLE_CLOSE_START_EVT)
{
logDebug("VAVLE_CLOSE_START_EVT");
//开始一个定时event,1s后产生,当前语句只会产生一次event
//可以在event产生后去开启event,可以是别的task的,也可以是当前task的event
tmos_start_task(vavle_task_id, VAVLE_CLOSE_END_EVT, MS1_TO_SYSTEM_TIME(CHARGE_TIME_MS));
return (events ^ VAVLE_CLOSE_START_EVT);
}
// Discard unknown events
return 0;
}
void BSP_VAVLE_Init(void)
{
vavle_task_id = TMOS_ProcessEventRegister(VAVLE_Task_ProcessEvent);
// //立即开始一个event
// tmos_set_event(vavle_task_id, VAVLE_RX_DATA_EVT);
logInfo("BSP_Valve_Init");
}