提交最新 RTC功能验证成功

This commit is contained in:
helloyifa 2025-05-30 09:13:42 +08:00
parent f0a8f13cd6
commit e06c240191
4 changed files with 1064 additions and 1025 deletions

View File

@ -185,6 +185,9 @@ RTC_DEV_PLATFORM_DATA_BEGIN(rtc_data)
.default_alarm = &def_alarm,
/* .cbfun = NULL, //闹钟中断的回调函数,用户自行定义 */
.cbfun = alarm_isr_user_cbfun,
//helloyifa
.clk_sel = CLK_SEL_LRC,
.trim_t = 1, //软关机情况下1min唤醒一次trim lrc
RTC_DEV_PLATFORM_DATA_END()
#endif

View File

@ -301,6 +301,7 @@ u8 alarm_en(u8 index, u8 en)
//设备事件响应demo
static void alarm_event_handler(struct sys_event *e)
{
printf("**** alarm_event_handler****\n");
u8 index;
u8 err;
if ((u32)e->arg == DEVICE_EVENT_FROM_ALM) {
@ -335,6 +336,7 @@ void alarm_send_event(u8 index)
void alm_wakeup_isr(void)
{
printf("**** alm_wakeup_isr****\n");
if (alarm_pnd_flag) {
alarm_send_event(alarm_mask.alarm_active_index);
} else {

View File

@ -429,14 +429,12 @@ static uint8_t reversal(uint8_t data)
ff_temp_data[5] = (ntc) & 0xFF;
ff_temp_data[6] = battery & 0xFF;
//先查明当前连接的conn_handle
u16 connection_handle = ble_comm_dev_get_handle(0, GATT_ROLE_SERVER);
if(connection_handle != 0)//
{
printf("ble connected !! connection_handle: %04x\n", connection_handle);
return ;
}else{
//printf("connection_handle: %04x\n", connection_handle);
@ -661,7 +659,22 @@ void timer_sleep_callback(void)
{
//关机开启闹钟
printf(">>>>>>>>>>>>>>>>> timer_sleep_callback ...\n");
rtc_alarm_set_timer(10);
//先查明当前连接的conn_handle 如果是蓝牙连接状态 不休眠
u16 connection_handle = ble_comm_dev_get_handle(0, GATT_ROLE_SERVER);
if(connection_handle != 0)//
{
printf("ble connected !! connection_handle: %04x\n", connection_handle);
return ;
}else{
//printf("connection_handle: %04x\n", connection_handle);
}
if( charge_state == 1){
printf("charging !! do not sleep\n");
return ;
}
rtc_alarm_set_timer(5);
temperature_set_soft_poweroff();
}

View File

@ -0,0 +1,21 @@
iT12 腋温计通讯协议
1.搜索蓝牙iT12_XXXX 并连接设备 ( 使用时建议申请ble 通讯的MTU 为254 否则会数据分包;)
2.iT12的通讯Service UUID为 0xAE30的
3.监听UUID为 0xAE02 的Characteristic 可以实时监听回传数据
4.指令通过UUID为 0xAE01 的Characteristic发送
5.指令CMD
5.1 获取温度 :AT+TEMP=?
回复AT+TEMP=255,265,365 (255表示环境温度, 265表示物体温度 , 365表示体温)
5.2 获取电池电量百分百 :AT+BATP=?
回复AT+BATP=80 (88表示电量为80%)
5.3 获取电池电压 :AT+BATT=?
回复AT+BATT=333 (333 表示3.33V)
5.4 获取固件版本 :AT+VER=?
回复AT+VER=1.0.1 (版本号 1.0.1)