Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
121
Ver.1.0.0
not need to be called
, thus PM related code and variables won’t be compiled to the
firmeware, and resources can be saved.
void
blc_ll_initPowerManagement_module
(
void
);
4.3.2 Set Low Power Modes via
“bls_pm_setSuspendMask”
The API used to configure PM for Link Layer Advertising state and Conn state in 5316
BLE SDK is:
void
bls_pm_setSuspendMask
(
u8
mask);
u8
bls_pm_getSuspendMask
(
void
);
By using “bls_pm_setSuspendMask”, a bottom-layer variable “SuspendMask” is set to
configure low power mode. Actually the variable in code is “bls_pm.suspend_mask”, and
its default value is “SUSPEND_DISABLE”.
“bls_pm_getSuspendMask” is used to obtain current SuspendMask value, which equals
the value configured by previous invoked “bls_pm_setSuspendMask”. If the variable is
not configured, the value equals the default “SUSPEND_DISABLE”.
Values for SuspendMask include:
////////////////// Power Management ///////////////////////
#define
SUSPEND_DISABLE
0
#define
SUSPEND_ADV
BIT(0)
#define
SUSPEND_CONN
BIT(1)
#define
MCU_STALL
BIT(6)
MCU_STALL is a special mode and it will be introduced later.
Please refer to Link Layer timing sequence (section 3.2.4) and working mechanism of low
power management (section 4.3.4) to help understand the configuration of
“bls_pm_setSuspendMask”.
SuspendMask can be selectable as any one of the values above, or combination value
(“or” operation) of Advertising state and Conn state, as shown below:
bls_pm_setSuspendMask(
SUSPEND_ADV
);
bls_pm_setSuspendMask(
SUSPEND_CONN
);
bls_pm_setSuspendMask(
MCU_STALL
);
bls_pm_setSuspendMask(
SUSPEND_DISABLE
);
bls_pm_setSuspendMask(
SUSPEND_ADV | SUSPEND_CONN
);
4.3.3 bls_pm_setWakeupSource
Users can enable or disable PM in different states by call
ing “bls_pm_setSuspendMask”.
The API below is used to set corresponding wakeup sources.