TuyaOS
类型定义 | 枚举 | 函数
tkl_nbiot_psm.h 文件参考

Common process - adapter the nbiot psm api 更多...

#include "tuya_cloud_types.h"
#include "tkl_nbiot_comm.h"
tkl_nbiot_psm.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

类型定义

typedef UCHAR_T TKL_LOCK_HANDLE
 
typedef VOID_T(* TKL_NB_PSM_NOTIFY_CB_T) (TKL_NB_PSM_SLP_TYPE_E sleep_type)
 prototype of the PSM notify call back 更多...
 
typedef VOID_T(* TKL_NB_SLP_TIMER_CB_T) (PVOID_T user_data)
 prototype of the sleep timer call back 更多...
 
typedef VOID_T(* TKL_NB_WAKEUP_CB) (PVOID_T user_data)
 prototype of the ext trigger call back 更多...
 

枚举

enum  TKL_NB_POWER_ON_RESULT_E {
  TKL_NB_FIRST_BOOT_UP = 0 , TKL_NB_DEEP_SLEEP = 1 , TKL_NB_DEEPER_SLEEP = 2 , TKL_NB_SYS_RESET = 3 ,
  TKL_NB_WDT_HW_RESET = 4 , TKL_NB_WDT_SW_RESET = 5 , TKL_NB_FORCED_SHUT_DOWN = 6 , TKL_NB_FORCED_RESET = 7 ,
  TKL_NB_POWER_ON_INVALID = 0xFF , TKL_NB_POWER_ON_RESULT_MAX
}
 
enum  TKL_NB_PSM_SLP_TYPE_E {
  TKL_PSM_SLEEP_NONE = 0 , TKL_PSM_LIGHT_SLEEP = 1 , TKL_PSM_DEEP_SLEEP = 2 , TKL_PSM_DEEPER_SLEEP = 3 ,
  TKL_PSM_SLEEP_MAX = 4
}
 
enum  TKL_NB_WAKEUP_SOURCE_E { TKL_WAKEUP_FROM_NONE , TKL_WAKEUP_FROM_POR , TKL_WAKEUP_FROM_RTC , TKL_WAKEUP_FROM_KEY }
 

函数

OPERATE_RET tkl_nbiot_psm_acquire_sleeplock (UCHAR_T handle)
 Acquire the sleeplock, keep awake 更多...
 
OPERATE_RET tkl_nbiot_psm_create_sleeplock (CONST PCHAR_T lock_name, UCHAR_T *handle)
 Create a psm manager lock 更多...
 
VOID tkl_nbiot_psm_force_sleep (VOID)
 Force enter psm mode 更多...
 
OPERATE_RET tkl_nbiot_psm_get_poweron_result (TKL_NB_POWER_ON_RESULT_E *result)
 Get the power on reason 更多...
 
OPERATE_RET tkl_nbiot_psm_get_wakeup_source (TKL_NB_WAKEUP_SOURCE_E *src)
 Get the wake up reason 更多...
 
OPERATE_RET tkl_nbiot_psm_plat_config (VOID)
 Set config about the paltform 更多...
 
OPERATE_RET tkl_nbiot_psm_release_sleeplock (UCHAR_T handle)
 Release the sleeplock, allow psm 更多...
 
OPERATE_RET tkl_nbiot_psm_rtc_timer_create (UINT_T time_period_sec, BOOL_T is_periodic, TKL_NB_SLP_TIMER_CB_T cb)
 Create rtc timer 更多...
 
OPERATE_RET tkl_nbiot_psm_rtc_timer_delete (VOID)
 Del rtc timer 更多...
 
OPERATE_RET tkl_nbiot_psm_rtc_timer_start (VOID)
 Start a rtc timer 更多...
 
OPERATE_RET tkl_nbiot_psm_rtc_timer_stop (VOID)
 Stop rtc timer 更多...
 
OPERATE_RET tkl_nbiot_psm_sleep_notify_reg (TKL_NB_PSM_NOTIFY_CB_T cb)
 Regist the PSM sleep notify cb 更多...
 
BOOL_T tkl_nbiot_psm_usb_is_active (VOID)
 Check the usb is active 更多...
 
OPERATE_RET tkl_nbiot_psm_wakeup_pin_cfg (INT_T pin_num, TKL_NB_WAKEUP_CB wakeup_cb)
 Specify a pin for wakeup trigger 更多...
 

详细描述

Common process - adapter the nbiot psm api

版本
0.1
日期
2021-09-09

类型定义说明

◆ TKL_NB_PSM_NOTIFY_CB_T

typedef VOID_T(* TKL_NB_PSM_NOTIFY_CB_T) (TKL_NB_PSM_SLP_TYPE_E sleep_type)

prototype of the PSM notify call back

参数
sleep_typeTKL_NB_PSM_SLP_TYPE_E

◆ TKL_NB_SLP_TIMER_CB_T

typedef VOID_T(* TKL_NB_SLP_TIMER_CB_T) (PVOID_T user_data)

prototype of the sleep timer call back

参数
user_datadata for user input

◆ TKL_NB_WAKEUP_CB

typedef VOID_T(* TKL_NB_WAKEUP_CB) (PVOID_T user_data)

prototype of the ext trigger call back

参数
user_datadata for user input

函数说明

◆ tkl_nbiot_psm_acquire_sleeplock()

OPERATE_RET tkl_nbiot_psm_acquire_sleeplock ( UCHAR_T  handle)

Acquire the sleeplock, keep awake

参数
handlesleeplock handle
返回
OPERATE_RET OPRT_OK: success others: fail

◆ tkl_nbiot_psm_create_sleeplock()

OPERATE_RET tkl_nbiot_psm_create_sleeplock ( CONST PCHAR_T  lock_name,
UCHAR_T *  handle 
)

Create a psm manager lock

参数
lock_namename of the lock
handlesleeplock handle
返回
OPERATE_RET OPRT_OK: success others: fail

◆ tkl_nbiot_psm_force_sleep()

VOID tkl_nbiot_psm_force_sleep ( VOID  )

Force enter psm mode

返回
VOID

◆ tkl_nbiot_psm_get_poweron_result()

OPERATE_RET tkl_nbiot_psm_get_poweron_result ( TKL_NB_POWER_ON_RESULT_E *  result)

Get the power on reason

参数
resultpowerson reason
返回
OPERATE_RET OPRT_OK: success others: fail

◆ tkl_nbiot_psm_get_wakeup_source()

OPERATE_RET tkl_nbiot_psm_get_wakeup_source ( TKL_NB_WAKEUP_SOURCE_E *  src)

Get the wake up reason

参数
srcwakeup reason reason
返回
OPERATE_RET OPRT_OK: success others: fail

◆ tkl_nbiot_psm_plat_config()

OPERATE_RET tkl_nbiot_psm_plat_config ( VOID  )

Set config about the paltform

返回
OPERATE_RET OPRT_OK: success others: fail

◆ tkl_nbiot_psm_release_sleeplock()

OPERATE_RET tkl_nbiot_psm_release_sleeplock ( UCHAR_T  handle)

Release the sleeplock, allow psm

参数
handlesleeplock handle
返回
OPERATE_RET OPRT_OK: success others: fail

◆ tkl_nbiot_psm_rtc_timer_create()

OPERATE_RET tkl_nbiot_psm_rtc_timer_create ( UINT_T  time_period_sec,
BOOL_T  is_periodic,
TKL_NB_SLP_TIMER_CB_T  cb 
)

Create rtc timer

参数
time_period_sectime period of the timer
is_periodicif the timer is perodic
cbtimer callback
返回
OPERATE_RET OPRT_OK: success others: failed

◆ tkl_nbiot_psm_rtc_timer_delete()

OPERATE_RET tkl_nbiot_psm_rtc_timer_delete ( VOID  )

Del rtc timer

参数
null
返回
OPERATE_RET OPRT_OK: success others: failed

◆ tkl_nbiot_psm_rtc_timer_start()

OPERATE_RET tkl_nbiot_psm_rtc_timer_start ( VOID  )

Start a rtc timer

参数
null
返回
OPERATE_RET OPRT_OK: success others: failed

◆ tkl_nbiot_psm_rtc_timer_stop()

OPERATE_RET tkl_nbiot_psm_rtc_timer_stop ( VOID  )

Stop rtc timer

参数
null
返回
OPERATE_RET OPRT_OK: success others: failed

◆ tkl_nbiot_psm_sleep_notify_reg()

OPERATE_RET tkl_nbiot_psm_sleep_notify_reg ( TKL_NB_PSM_NOTIFY_CB_T  cb)

Regist the PSM sleep notify cb

参数
cbnotify callback function
返回
OPERATE_RET OPRT_OK: success others: fail

◆ tkl_nbiot_psm_usb_is_active()

BOOL_T tkl_nbiot_psm_usb_is_active ( VOID  )

Check the usb is active

返回
BOOL_T true: active false: not active

◆ tkl_nbiot_psm_wakeup_pin_cfg()

OPERATE_RET tkl_nbiot_psm_wakeup_pin_cfg ( INT_T  pin_num,
TKL_NB_WAKEUP_CB  wakeup_cb 
)

Specify a pin for wakeup trigger

参数
pin_numTKL_GPIO_NAME_E
wakeup_cbcall back funtion
返回
OPERATE_RET OPRT_OK: success others: failed