RF_W13无卡设备
上传云端
This commit is contained in:
228
BLV_RF_W13_V04_20260114/HAL/MCU.c
Normal file
228
BLV_RF_W13_V04_20260114/HAL/MCU.c
Normal file
@@ -0,0 +1,228 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : MCU.c
|
||||
* Author : WCH
|
||||
* Version : V1.2
|
||||
* Date : 2022/01/18
|
||||
* Description : Ӳ<><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BLE<4C><45>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/* ͷ<>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> */
|
||||
#include "HAL.h"
|
||||
|
||||
tmosTaskID halTaskID;
|
||||
uint32_t g_LLE_IRQLibHandlerLocation;
|
||||
|
||||
#if(defined(BLE_SNV)) && (BLE_SNV == TRUE)
|
||||
/*******************************************************************************
|
||||
* @fn Lib_Read_Flash
|
||||
*
|
||||
* @brief Callback function used for BLE lib.
|
||||
*
|
||||
* @param addr - Read start address
|
||||
* @param num - Number of units to read (unit: 4 bytes)
|
||||
* @param pBuf - Buffer to store read data
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
uint32_t Lib_Read_Flash(uint32_t addr, uint32_t num, uint32_t *pBuf)
|
||||
{
|
||||
FLASH_ROM_READ(addr, pBuf, num * 4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn Lib_Write_Flash
|
||||
*
|
||||
* @brief Callback function used for BLE lib.
|
||||
*
|
||||
* @param addr - Write start address
|
||||
* @param num - Number of units to write (unit: 4 bytes)
|
||||
* @param pBuf - Buffer with data to be written
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
uint32_t Lib_Write_Flash(uint32_t addr, uint32_t num, uint32_t *pBuf)
|
||||
{
|
||||
FLASH_ROM_ERASE(addr, num * 4);
|
||||
FLASH_ROM_WRITE(addr, pBuf, num * 4);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn CH57x_BLEInit
|
||||
*
|
||||
* @brief BLE <20><><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void CH57x_BLEInit(void)
|
||||
{
|
||||
uint8_t i;
|
||||
bleConfig_t cfg;
|
||||
if(tmos_memcmp(VER_LIB, VER_FILE, strlen(VER_FILE)) == FALSE)
|
||||
{
|
||||
PRINT("head file error...\n");
|
||||
while(1);
|
||||
}
|
||||
|
||||
//__SysTick_Config(SysTick_LOAD_RELOAD_Msk);// <20><><EFBFBD><EFBFBD>SysTick
|
||||
SysTick_Config(FREQ_SYS/10000);
|
||||
|
||||
sys_safe_access_enable( );
|
||||
R32_MISC_CTRL = (R32_MISC_CTRL&(~(0x3f<<24)))|(0xe<<24);
|
||||
sys_safe_access_disable( );
|
||||
g_LLE_IRQLibHandlerLocation = (uint32_t)LLE_IRQLibHandler;
|
||||
PFIC_SetPriority(BLEL_IRQn, 0xF0);
|
||||
tmos_memset(&cfg, 0, sizeof(bleConfig_t));
|
||||
cfg.MEMAddr = (uint32_t)MEM_BUF;
|
||||
cfg.MEMLen = (uint32_t)BLE_MEMHEAP_SIZE;
|
||||
cfg.BufMaxLen = (uint32_t)BLE_BUFF_MAX_LEN;
|
||||
cfg.BufNumber = (uint32_t)BLE_BUFF_NUM;
|
||||
cfg.TxNumEvent = (uint32_t)BLE_TX_NUM_EVENT;
|
||||
cfg.TxPower = (uint32_t)BLE_TX_POWER;
|
||||
cfg.WindowWidening = 120;
|
||||
#if(defined(BLE_SNV)) && (BLE_SNV == TRUE)
|
||||
if((BLE_SNV_ADDR + BLE_SNV_BLOCK * BLE_SNV_NUM) > (0x40000))
|
||||
{
|
||||
PRINT("SNV config error...\n");
|
||||
while(1);
|
||||
}
|
||||
cfg.SNVAddr = (uint32_t)BLE_SNV_ADDR;
|
||||
cfg.SNVBlock = (uint32_t)BLE_SNV_BLOCK;
|
||||
cfg.SNVNum = (uint32_t)BLE_SNV_NUM;
|
||||
cfg.readFlashCB = Lib_Read_Flash;
|
||||
cfg.writeFlashCB = Lib_Write_Flash;
|
||||
#endif
|
||||
cfg.srandCB = SYS_GetSysTickCnt;
|
||||
#if(defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
|
||||
cfg.idleCB = CH57x_LowPower; // <20><><EFBFBD><EFBFBD>˯<EFBFBD><CBAF>
|
||||
#endif
|
||||
#if(defined(BLE_MAC)) && (BLE_MAC == TRUE)
|
||||
for(i = 0; i < 6; i++)
|
||||
{
|
||||
cfg.MacAddr[i] = MacAddr[5 - i];
|
||||
}
|
||||
#else
|
||||
{
|
||||
uint8_t MacAddr[6];
|
||||
GetMACAddress(MacAddr);
|
||||
for(i = 0; i < 6; i++)
|
||||
{
|
||||
cfg.MacAddr[i] = MacAddr[i]; // ʹ<><CAB9>оƬmac<61><63>ַ
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(!cfg.MEMAddr || cfg.MEMLen < 3 * 1024)
|
||||
{
|
||||
while(1);
|
||||
}
|
||||
// BLE_Lib ռ<><D5BC><EFBFBD><EFBFBD>VTF Interrupt 2<>ź<EFBFBD>3<EFBFBD><33>
|
||||
i = BLE_LibInit(&cfg);
|
||||
if(i)
|
||||
{
|
||||
PRINT("LIB init error code: %x ...\n", i);
|
||||
while(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HAL_ProcessEvent
|
||||
*
|
||||
* @brief Ӳ<><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*
|
||||
* @param task_id - The TMOS assigned task ID.
|
||||
* @param events - events to process. This is a bit map and can
|
||||
* contain more than one event.
|
||||
*
|
||||
* @return events.
|
||||
*/
|
||||
tmosEvents HAL_ProcessEvent(tmosTaskID task_id, tmosEvents events)
|
||||
{
|
||||
uint8_t *msgPtr;
|
||||
|
||||
if(events & SYS_EVENT_MSG)
|
||||
{ // <20><><EFBFBD><EFBFBD>HAL<41><4C><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>tmos_msg_receive<76><65>ȡ<EFBFBD><C8A1>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
|
||||
msgPtr = tmos_msg_receive(task_id);
|
||||
if(msgPtr)
|
||||
{
|
||||
/* De-allocate */
|
||||
tmos_msg_deallocate(msgPtr);
|
||||
}
|
||||
return events ^ SYS_EVENT_MSG;
|
||||
}
|
||||
if(events & LED_BLINK_EVENT)
|
||||
{
|
||||
#if(defined HAL_LED) && (HAL_LED == TRUE)
|
||||
HalLedUpdate();
|
||||
#endif // HAL_LED
|
||||
return events ^ LED_BLINK_EVENT;
|
||||
}
|
||||
if(events & HAL_KEY_EVENT)
|
||||
{
|
||||
#if(defined HAL_KEY) && (HAL_KEY == TRUE)
|
||||
HAL_KeyPoll(); /* Check for keys */
|
||||
tmos_start_task(halTaskID, HAL_KEY_EVENT, MS1_TO_SYSTEM_TIME(100));
|
||||
return events ^ HAL_KEY_EVENT;
|
||||
#endif
|
||||
}
|
||||
if(events & HAL_REG_INIT_EVENT)
|
||||
{
|
||||
#if(defined BLE_CALIBRATION_ENABLE) && (BLE_CALIBRATION_ENABLE == TRUE) // У<D0A3><D7BC><EFBFBD><EFBFBD><F1A3ACB5><EFBFBD>У<D0A3><D7BC>ʱС<CAB1><D0A1>10ms
|
||||
uint8_t state;
|
||||
bleClockConfig_t conf;
|
||||
|
||||
BLE_RegInit(); // УRF<52><46><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>RF<52><46><EFBFBD>ı<EFBFBD>RF<52><46><EFBFBD>ؼĴ<D8BC><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>RF<52>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>У<D0A3><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
lsiFrq = RTC_InitClock( Count_1024 );
|
||||
conf = BLE_ClockConfig(lsiFrq);
|
||||
state = TMOS_TimerSet(&conf);
|
||||
LSIWakeup_MaxTime = GET_WakeUpLSIMaxTime();
|
||||
tmos_start_task(halTaskID, HAL_REG_INIT_EVENT, MS1_TO_SYSTEM_TIME(BLE_CALIBRATION_PERIOD));
|
||||
return events ^ HAL_REG_INIT_EVENT;
|
||||
#endif
|
||||
}
|
||||
if(events & HAL_TEST_EVENT)
|
||||
{
|
||||
PRINT("* \n");
|
||||
tmos_start_task(halTaskID, HAL_TEST_EVENT, MS1_TO_SYSTEM_TIME(1000));
|
||||
return events ^ HAL_TEST_EVENT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HAL_Init
|
||||
*
|
||||
* @brief Ӳ<><D3B2><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void HAL_Init()
|
||||
{
|
||||
halTaskID = TMOS_ProcessEventRegister(HAL_ProcessEvent);
|
||||
HAL_TimeInit();
|
||||
#if(defined HAL_SLEEP) && (HAL_SLEEP == TRUE)
|
||||
HAL_SleepInit();
|
||||
#endif
|
||||
#if(defined HAL_LED) && (HAL_LED == TRUE)
|
||||
HAL_LedInit();
|
||||
#endif
|
||||
#if(defined HAL_KEY) && (HAL_KEY == TRUE)
|
||||
HAL_KeyInit();
|
||||
#endif
|
||||
#if(defined BLE_CALIBRATION_ENABLE) && (BLE_CALIBRATION_ENABLE == TRUE)
|
||||
tmos_start_task(halTaskID, HAL_REG_INIT_EVENT, 800); // <20><><EFBFBD><EFBFBD>У<D0A3><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>500ms<6D><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<D0A3><D7BC>ʱС<CAB1><D0A1>10ms
|
||||
#endif
|
||||
// tmos_start_task( halTaskID, HAL_TEST_EVENT, 1600 ); // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
/******************************** endfile @ mcu ******************************/
|
||||
132
BLV_RF_W13_V04_20260114/HAL/RTC.c
Normal file
132
BLV_RF_W13_V04_20260114/HAL/RTC.c
Normal file
@@ -0,0 +1,132 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : RTC.c
|
||||
* Author : WCH
|
||||
* Version : V1.2
|
||||
* Date : 2022/01/18
|
||||
* Description : RTC<54><43><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/* ͷ<>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> */
|
||||
#include "HAL.h"
|
||||
|
||||
/*********************************************************************
|
||||
* CONSTANTS
|
||||
*/
|
||||
|
||||
/***************************************************
|
||||
* Global variables
|
||||
*/
|
||||
volatile uint32_t RTCTigFlag;
|
||||
|
||||
#define US_TO_TICK(us) (uint32_t)((us)/(1000000/(CAB_LSIFQ)))
|
||||
#define SLEEP_WAIT_HSE_TIME US_TO_TICK(2400)
|
||||
#define RTC_MAX_COUNT 0xA8C00000
|
||||
uint32_t lsiFrq;
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn RTC_SetTignTime
|
||||
*
|
||||
* @brief <20><><EFBFBD><EFBFBD>RTC<54><43><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
*
|
||||
* @param time - <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void RTC_SetTignTime(uint32_t time)
|
||||
{
|
||||
sys_safe_access_enable();
|
||||
R32_RTC_TRIG = time;
|
||||
sys_safe_access_disable();
|
||||
RTCTigFlag = 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn RTC_IRQHandler
|
||||
*
|
||||
* @brief RTC<54>жϴ<D0B6><CFB4><EFBFBD>
|
||||
*
|
||||
* @param None.
|
||||
*/
|
||||
__INTERRUPT
|
||||
__HIGH_CODE
|
||||
void RTC_IRQHandler( void )
|
||||
{
|
||||
R8_RTC_FLAG_CTRL =(RB_RTC_TMR_CLR|RB_RTC_TRIG_CLR);
|
||||
RTCTigFlag = 1;
|
||||
}
|
||||
|
||||
__HIGH_CODE
|
||||
static uint32_t SYS_GetClockValue(void)
|
||||
{
|
||||
uint32_t volatile rtc_count;
|
||||
do{
|
||||
rtc_count = R32_RTC_CNT_LSI;
|
||||
}while( rtc_count != R32_RTC_CNT_LSI);
|
||||
return rtc_count;
|
||||
}
|
||||
|
||||
__HIGH_CODE
|
||||
static void SYS_SetPendingIRQ(void)
|
||||
{
|
||||
PFIC_SetPendingIRQ( RTC_IRQn );
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn BLE_ClockConfig
|
||||
*
|
||||
* @brief BLE_ClockConfig
|
||||
*
|
||||
* @param conf.
|
||||
*/
|
||||
bleClockConfig_t BLE_ClockConfig(uint32_t lsifreq)
|
||||
{
|
||||
bleClockConfig_t conf;
|
||||
|
||||
conf.ClockAccuracy = 2500;
|
||||
conf.ClockFrequency = lsifreq;
|
||||
conf.ClockMaxCount = RTC_MAX_COUNT;
|
||||
conf.getClockValue = SYS_GetClockValue;
|
||||
conf.SetPendingIRQ = SYS_SetPendingIRQ;
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HAL_Time0Init
|
||||
*
|
||||
* @brief ϵͳ<CFB5><CDB3>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void HAL_TimeInit(void)
|
||||
{
|
||||
bleClockConfig_t conf;
|
||||
|
||||
sys_safe_access_enable();
|
||||
R8_LSI_CONFIG |= RB_CLK_LSI_PON;
|
||||
sys_safe_access_disable();
|
||||
|
||||
lsiFrq = RTC_InitClock( Count_1024 );
|
||||
|
||||
PRINT("lsiFrq = %d\n",lsiFrq);
|
||||
|
||||
RTC_InitTime( 2021,1,28,0,0,0 );
|
||||
|
||||
conf = BLE_ClockConfig(lsiFrq);
|
||||
TMOS_TimerInit( &conf );
|
||||
|
||||
sys_safe_access_enable();
|
||||
__nop();__nop();
|
||||
R8_RTC_MODE_CTRL |= RB_RTC_TRIG_EN; // <20><><EFBFBD><EFBFBD>ģʽ
|
||||
sys_safe_access_disable();
|
||||
PFIC_EnableIRQ(RTC_IRQn);
|
||||
}
|
||||
|
||||
/******************************** endfile @ time ******************************/
|
||||
117
BLV_RF_W13_V04_20260114/HAL/SLEEP.c
Normal file
117
BLV_RF_W13_V04_20260114/HAL/SLEEP.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : SLEEP.c
|
||||
* Author : WCH
|
||||
* Version : V1.2
|
||||
* Date : 2022/01/18
|
||||
* Description : ˯<><CBAF><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/* ͷ<>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> */
|
||||
#include "HAL.h"
|
||||
|
||||
uint16_t LSIWakeup_MaxTime;
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn CH57x_LowPower
|
||||
*
|
||||
* @brief <20><><EFBFBD><EFBFBD>˯<EFBFBD><CBAF>
|
||||
*
|
||||
* @param time - <20><><EFBFBD>ѵ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>㣨RTC<54><43><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>
|
||||
*
|
||||
* @return state.
|
||||
*/
|
||||
uint32_t CH57x_LowPower(uint32_t time)
|
||||
{
|
||||
#if(defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
|
||||
volatile uint32_t i;
|
||||
uint32_t time_tign, time_sleep, time_curr;
|
||||
unsigned long irq_status;
|
||||
|
||||
// <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||||
if (time <= LSIWakeup_MaxTime) {
|
||||
time_tign = time + (RTC_MAX_COUNT - LSIWakeup_MaxTime);
|
||||
} else {
|
||||
time_tign = time - LSIWakeup_MaxTime;
|
||||
}
|
||||
|
||||
SYS_DisableAllIrq(&irq_status);
|
||||
time_curr = RTC_GetCycleLSI();
|
||||
// <20><><EFBFBD><EFBFBD>˯<EFBFBD><CBAF>ʱ<EFBFBD><CAB1>
|
||||
if (time_tign < time_curr) {
|
||||
time_sleep = time_tign + (RTC_MAX_COUNT - time_curr);
|
||||
} else {
|
||||
time_sleep = time_tign - time_curr;
|
||||
}
|
||||
|
||||
// <20><>˯<EFBFBD><CBAF>ʱ<EFBFBD><CAB1>С<EFBFBD><D0A1><EFBFBD><EFBFBD>С˯<D0A1><CBAF>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˯<EFBFBD><CBAF>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC><EFBFBD><EFBFBD>˯<EFBFBD><CBAF>
|
||||
if ((time_sleep < SLEEP_RTC_MIN_TIME) ||
|
||||
(time_sleep > SLEEP_RTC_MAX_TIME)) {
|
||||
SYS_RecoverIrq(irq_status);
|
||||
return 2;
|
||||
}
|
||||
|
||||
RTC_SetTignTime(time_tign);
|
||||
SYS_RecoverIrq(irq_status);
|
||||
#if(DEBUG == Debug_UART0) // ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>Ϣ<EFBFBD><CFA2>Ҫ<EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>
|
||||
while((R8_UART_LSR & RB_LSR_TX_ALL_EMP) == 0)
|
||||
{
|
||||
__nop();
|
||||
}
|
||||
#endif
|
||||
// LOW POWER-sleepģʽ
|
||||
if(!RTCTigFlag)
|
||||
{
|
||||
LowPower_Sleep(RB_PWR_RAM12K | RB_PWR_EXTEND | RB_XT_PRE_EN );
|
||||
HSECFG_Current(HSE_RCur_100); // <20><>Ϊ<EFBFBD><EFBFBD><EEB6A8><EFBFBD><EFBFBD>(<28><EFBFBD><CDB9>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HSEƫ<45>õ<EFBFBD><C3B5><EFBFBD>)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return 3;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn GET_WakeUpLSIMaxTime
|
||||
*
|
||||
* @brief <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
*
|
||||
* @param none
|
||||
*/
|
||||
uint16_t GET_WakeUpLSIMaxTime(void)
|
||||
{
|
||||
uint16_t pre_time;
|
||||
|
||||
pre_time = RTC_TO_US(45)+200;
|
||||
pre_time = pre_time > 1600 ? pre_time:1600;
|
||||
pre_time = US_TO_RTC(pre_time);
|
||||
|
||||
return pre_time;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* @fn HAL_SleepInit
|
||||
*
|
||||
* @brief <20><><EFBFBD><EFBFBD>˯<EFBFBD><EFBFBD><DFBB>ѵķ<D1B5>ʽ - RTC<54><43><EFBFBD>ѣ<EFBFBD><D1A3><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void HAL_SleepInit(void)
|
||||
{
|
||||
#if(defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
|
||||
sys_safe_access_enable();
|
||||
R8_SLP_WAKE_CTRL |= RB_SLP_RTC_WAKE; // RTC<54><43><EFBFBD><EFBFBD>
|
||||
sys_safe_access_disable();
|
||||
sys_safe_access_enable();
|
||||
R8_RTC_MODE_CTRL |= RB_RTC_TRIG_EN; // <20><><EFBFBD><EFBFBD>ģʽ
|
||||
sys_safe_access_disable();
|
||||
PFIC_EnableIRQ(RTC_IRQn);
|
||||
LSIWakeup_MaxTime = GET_WakeUpLSIMaxTime();
|
||||
// PRINT("Pre_time %d\n",LSIWakeup_MaxTime);
|
||||
#endif
|
||||
}
|
||||
142
BLV_RF_W13_V04_20260114/HAL/include/CONFIG.h
Normal file
142
BLV_RF_W13_V04_20260114/HAL/include/CONFIG.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : CONFIG.h
|
||||
* Author : WCH
|
||||
* Version : V1.2
|
||||
* Date : 2022/01/18
|
||||
* Description : <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<DEB8>ǰֵ
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
|
||||
#define CHIP_ID ID_CH572
|
||||
|
||||
#ifdef CH57xBLE_ROM
|
||||
#include "CH57xBLE_ROM.h"
|
||||
#else
|
||||
#include "CH572BLEPeri_LIB.h"
|
||||
#endif
|
||||
|
||||
#include "CH57x_common.h"
|
||||
|
||||
/*********************************************************************
|
||||
<20><>MAC<41><43>
|
||||
BLE_MAC - <20>Ƿ<EFBFBD><C7B7>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Mac<61><63>ַ ( Ĭ<><C4AC>:FALSE - ʹ<><CAB9>оƬMac<61><63>ַ )<29><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>main.c<><EFBFBD>Mac<61><63>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
|
||||
<20><>SLEEP<45><50>
|
||||
HAL_SLEEP - <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>˯<EFBFBD>߹<EFBFBD><DFB9><EFBFBD> ( Ĭ<><C4AC>:FALSE )
|
||||
SLEEP_RTC_MIN_TIME - <20>ǿ<EFBFBD><C7BF><EFBFBD>ģʽ<C4A3><CABD>˯<EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD>Сʱ<D0A1>䣨<EFBFBD><E4A3A8>λ<EFBFBD><CEBB>һ<EFBFBD><D2BB>RTC<54><43><EFBFBD>ڣ<EFBFBD>
|
||||
SLEEP_RTC_MAX_TIME - <20>ǿ<EFBFBD><C7BF><EFBFBD>ģʽ<C4A3><CABD>˯<EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䣨<EFBFBD><E4A3A8>λ<EFBFBD><CEBB>һ<EFBFBD><D2BB>RTC<54><43><EFBFBD>ڣ<EFBFBD>
|
||||
WAKE_UP_RTC_MAX_TIME - <20>ȴ<EFBFBD>32M<32><4D><EFBFBD><EFBFBD><EFBFBD>ȶ<EFBFBD>ʱ<EFBFBD>䣨<EFBFBD><E4A3A8>λ<EFBFBD><CEBB>һ<EFBFBD><D2BB>RTC<54><43><EFBFBD>ڣ<EFBFBD>
|
||||
<20><><EFBFBD>ݲ<EFBFBD>ͬ˯<CDAC><CBAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡֵ<C8A1>ɷ<EFBFBD>Ϊ<EFBFBD><CEAA> ˯<><CBAF>ģʽ/<2F>µ<EFBFBD>ģʽ - 45 (Ĭ<><C4AC>)
|
||||
<20><>ͣģʽ - 45
|
||||
<20><><EFBFBD><EFBFBD>ģʽ - 5
|
||||
<20><>TEMPERATION<4F><4E>
|
||||
TEM_SAMPLE - <20>Ƿ<EFBFBD><C7B7><EFBFBD><F2BFAAB8><EFBFBD><EFBFBD>¶ȱ仯У<D0A3>Ĺ<EFBFBD><C4B9>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>У<D0A3><D7BC>ʱС<CAB1><D0A1>10ms( Ĭ<><C4AC>:TRUE )
|
||||
|
||||
<20><>CALIBRATION<4F><4E>
|
||||
BLE_CALIBRATION_ENABLE - <20>Ƿ<EFBFBD><C7B7><EFBFBD>ʱУ<D0A3>Ĺ<EFBFBD><C4B9>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>У<D0A3><D7BC>ʱС<CAB1><D0A1>10ms( Ĭ<><C4AC>:TRUE )
|
||||
BLE_CALIBRATION_PERIOD - <20><>ʱУ<D0A3><D7BC><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>λms( Ĭ<><C4AC>:120000 )
|
||||
|
||||
<20><>SNV<4E><56>
|
||||
BLE_SNV - <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>SNV<4E><56><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ( Ĭ<><C4AC>:TRUE )
|
||||
BLE_SNV_ADDR - SNV<4E><56>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ʹ<EFBFBD><CAB9>data flash<73><68><EFBFBD><EFBFBD>512<31>ֽ<EFBFBD>( Ĭ<><C4AC>:0x77E00 )
|
||||
BLE_SNV_BLOCK - SNV<4E><56>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С( Ĭ<><C4AC>:256 )
|
||||
BLE_SNV_NUM - SNV<4E><56>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>( Ĭ<><C4AC>:1 )
|
||||
|
||||
<20><>RTC<54><43>
|
||||
CLK_OSC32K - RTCʱ<43><CAB1>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>ⲿ32K( 0 <20>ⲿ(32768Hz)<29><>Ĭ<EFBFBD><C4AC>:1<><31><EFBFBD>ڲ<EFBFBD>(32000Hz)<29><>2<EFBFBD><32><EFBFBD>ڲ<EFBFBD>(32768Hz) )
|
||||
|
||||
<20><>MEMORY<52><59>
|
||||
BLE_MEMHEAP_SIZE - <20><><EFBFBD><EFBFBD>Э<EFBFBD><D0AD>ջʹ<D5BB>õ<EFBFBD>RAM<41><4D>С<EFBFBD><D0A1><EFBFBD><EFBFBD>С<EFBFBD><D0A1>6K ( Ĭ<><C4AC>:(1024*6) )
|
||||
|
||||
<20><>DATA<54><41>
|
||||
BLE_BUFF_MAX_LEN - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>( Ĭ<><C4AC>:27 (ATT_MTU=23)<29><>ȡֵ<C8A1><D6B5>Χ[27~516] )
|
||||
BLE_BUFF_NUM - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD><C4B0><EFBFBD><EFBFBD><EFBFBD>( Ĭ<><C4AC>:5 )
|
||||
BLE_TX_NUM_EVENT - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><D4B7><EFBFBD><EFBFBD>ٸ<EFBFBD><D9B8><EFBFBD><EFBFBD>ݰ<EFBFBD>( Ĭ<><C4AC>:1 )
|
||||
BLE_TX_POWER - <20><><EFBFBD>书<EFBFBD><E4B9A6>( Ĭ<><C4AC>:LL_TX_POWEER_0_DBM (0dBm) )
|
||||
|
||||
<20><>MULTICONN<4E><4E>
|
||||
PERIPHERAL_MAX_CONNECTION - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD><EFBFBD><EFBFBD>ٴӻ<D9B4><D3BB><EFBFBD>ɫ( Ĭ<><C4AC>:1 )
|
||||
CENTRAL_MAX_CONNECTION - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ( Ĭ<><C4AC>:3 )
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
/*********************************************************************
|
||||
* Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
*/
|
||||
#ifndef BLE_MAC
|
||||
#define BLE_MAC FALSE
|
||||
#endif
|
||||
#ifndef HAL_SLEEP
|
||||
#define HAL_SLEEP FALSE
|
||||
#endif
|
||||
#ifndef SLEEP_RTC_MIN_TIME
|
||||
#define SLEEP_RTC_MIN_TIME US_TO_RTC(1000)
|
||||
#endif
|
||||
#ifndef SLEEP_RTC_MAX_TIME
|
||||
#define SLEEP_RTC_MAX_TIME (RTC_MAX_COUNT - 1000 * 1000 * 30)
|
||||
#endif
|
||||
#ifndef WAKE_UP_RTC_MAX_TIME
|
||||
#define WAKE_UP_RTC_MAX_TIME US_TO_RTC(1600)
|
||||
#endif
|
||||
#ifndef HAL_KEY
|
||||
#define HAL_KEY FALSE
|
||||
#endif
|
||||
#ifndef HAL_LED
|
||||
#define HAL_LED FALSE
|
||||
#endif
|
||||
#ifndef TEM_SAMPLE
|
||||
#define TEM_SAMPLE TRUE
|
||||
#endif
|
||||
#ifndef BLE_CALIBRATION_ENABLE
|
||||
#define BLE_CALIBRATION_ENABLE TRUE
|
||||
#endif
|
||||
#ifndef BLE_CALIBRATION_PERIOD
|
||||
#define BLE_CALIBRATION_PERIOD 120000
|
||||
#endif
|
||||
#ifndef BLE_SNV
|
||||
#define BLE_SNV TRUE
|
||||
#endif
|
||||
#ifndef BLE_SNV_ADDR
|
||||
#define BLE_SNV_ADDR 0x3B000
|
||||
#endif
|
||||
#ifndef BLE_SNV_BLOCK
|
||||
#define BLE_SNV_BLOCK 256
|
||||
#endif
|
||||
#ifndef BLE_SNV_NUM
|
||||
#define BLE_SNV_NUM 1
|
||||
#endif
|
||||
#ifndef BLE_MEMHEAP_SIZE
|
||||
#define BLE_MEMHEAP_SIZE (512*7)
|
||||
#endif
|
||||
#ifndef BLE_BUFF_MAX_LEN
|
||||
#define BLE_BUFF_MAX_LEN 128
|
||||
#endif
|
||||
#ifndef BLE_BUFF_NUM
|
||||
#define BLE_BUFF_NUM 3
|
||||
#endif
|
||||
#ifndef BLE_TX_NUM_EVENT
|
||||
#define BLE_TX_NUM_EVENT 1
|
||||
#endif
|
||||
#ifndef BLE_TX_POWER
|
||||
#define BLE_TX_POWER LL_TX_POWEER_0_DBM
|
||||
#endif
|
||||
#ifndef PERIPHERAL_MAX_CONNECTION
|
||||
#define PERIPHERAL_MAX_CONNECTION 1
|
||||
#endif
|
||||
#ifndef CENTRAL_MAX_CONNECTION
|
||||
#define CENTRAL_MAX_CONNECTION 3
|
||||
#endif
|
||||
|
||||
extern uint32_t MEM_BUF[BLE_MEMHEAP_SIZE / 4];
|
||||
extern const uint8_t MacAddr[6];
|
||||
|
||||
#endif
|
||||
|
||||
69
BLV_RF_W13_V04_20260114/HAL/include/HAL.h
Normal file
69
BLV_RF_W13_V04_20260114/HAL/include/HAL.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : HAL.h
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2016/05/05
|
||||
* Description :
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
#ifndef __HAL_H
|
||||
#define __HAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "CONFIG.h"
|
||||
#include "RTC.h"
|
||||
#include "SLEEP.h"
|
||||
//#include "LED.h"
|
||||
//#include "KEY.h"
|
||||
|
||||
/* hal task Event */
|
||||
#define LED_BLINK_EVENT 0x0001
|
||||
#define HAL_KEY_EVENT 0x0002
|
||||
#define HAL_REG_INIT_EVENT 0x2000
|
||||
#define HAL_TEST_EVENT 0x4000
|
||||
|
||||
/*********************************************************************
|
||||
* GLOBAL VARIABLES
|
||||
*/
|
||||
extern tmosTaskID halTaskID;
|
||||
|
||||
/*********************************************************************
|
||||
* GLOBAL FUNCTIONS
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Ӳ<><D3B2><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
*/
|
||||
extern void HAL_Init(void);
|
||||
|
||||
/**
|
||||
* @brief Ӳ<><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*
|
||||
* @param task_id - The TMOS assigned task ID.
|
||||
* @param events - events to process. This is a bit map and can
|
||||
* contain more than one event.
|
||||
*/
|
||||
extern tmosEvents HAL_ProcessEvent(tmosTaskID task_id, tmosEvents events);
|
||||
|
||||
/**
|
||||
* @brief BLE <20><><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
*/
|
||||
extern void CH57x_BLEInit(void);
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
68
BLV_RF_W13_V04_20260114/HAL/include/RTC.h
Normal file
68
BLV_RF_W13_V04_20260114/HAL/include/RTC.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : RTC.h
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2016/04/12
|
||||
* Description :
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
#ifndef __RTC_H
|
||||
#define __RTC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef CLK_OSC32K
|
||||
#if (CLK_OSC32K==1)
|
||||
#define FREQ_RTC 32000
|
||||
#else
|
||||
#define FREQ_RTC 32768
|
||||
#endif
|
||||
#endif /* CLK_OSC32K */
|
||||
|
||||
|
||||
#define CLK_PER_US (1.0 / ((1.0 / Freq_LSI) * 1000 * 1000))
|
||||
#define CLK_PER_MS (CLK_PER_US * 1000)
|
||||
|
||||
#define US_PER_CLK (1.0 / CLK_PER_US)
|
||||
#define MS_PER_CLK (US_PER_CLK / 1000.0)
|
||||
|
||||
#define RTC_TO_US(clk) ((uint32_t)((clk) * US_PER_CLK + 0.5))
|
||||
#define RTC_TO_MS(clk) ((uint32_t)((clk) * MS_PER_CLK + 0.5))
|
||||
|
||||
#define US_TO_RTC(us) ((uint32_t)((us) * CLK_PER_US + 0.5))
|
||||
#define MS_TO_RTC(ms) ((uint32_t)((ms) * CLK_PER_MS + 0.5))
|
||||
|
||||
extern volatile uint32_t RTCTigFlag;
|
||||
extern uint32_t lsiFrq;
|
||||
|
||||
/**
|
||||
* @brief Initialize time Service.
|
||||
*/
|
||||
void HAL_TimeInit(void);
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD>RTC<54><43><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
*
|
||||
* @param time - <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>.
|
||||
*/
|
||||
extern void RTC_SetTignTime(uint32_t time);
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD>BLE<4C><45><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
*
|
||||
* @param lsifreq - LSIƵ<49><C6B5>.
|
||||
*/
|
||||
extern bleClockConfig_t BLE_ClockConfig(uint32_t lsifreq);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
60
BLV_RF_W13_V04_20260114/HAL/include/SLEEP.h
Normal file
60
BLV_RF_W13_V04_20260114/HAL/include/SLEEP.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : SLEEP.h
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2018/11/12
|
||||
* Description :
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
#ifndef __SLEEP_H
|
||||
#define __SLEEP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* GLOBAL VARIABLES
|
||||
*/
|
||||
typedef void (*pfnLowPowerGapProcessCB_t)( void );
|
||||
|
||||
extern uint16_t LSIWakeup_MaxTime;
|
||||
/*********************************************************************
|
||||
* FUNCTIONS
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD>˯<EFBFBD><EFBFBD><DFBB>ѵķ<D1B5>ʽ - RTC<54><43><EFBFBD>ѣ<EFBFBD><D1A3><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
||||
*/
|
||||
extern void HAL_SleepInit(void);
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD>˯<EFBFBD><CBAF>
|
||||
*
|
||||
* @param time - <20><><EFBFBD>ѵ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>㣨RTC<54><43><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>
|
||||
*
|
||||
* @return state.
|
||||
*/
|
||||
extern uint32_t CH57x_LowPower(uint32_t time);
|
||||
|
||||
/**
|
||||
* @brief <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
*
|
||||
* @param none.
|
||||
*/
|
||||
extern uint16_t GET_WakeUpLSIMaxTime(void);
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user