EasyManua.ls Logo

TELINK SEMICONDUCTOR TLSR8232 - Link Layer State Machine Combined Application; Link Layer State Machine Initialization

Default Icon
211 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1 49 Ver.1.0.0
“Power Management” in Figure 3-6 is not a state of LL, but a functional module which
indicates SDK only implements low power processing for Advertising and Connection
Slave Role. If Idle state needs low power, user can invoke related APIs in the APP layer.
For the other states, SDK does not manage low power, while user cannot implement low
power in the APP layer.
Based on the five states above, corresponding state machine names are defined in
stack/ble/ll/ll.h”. The state name “ConnSlaveRoleis BLS_LINK_STATE_CONN”.
//ble link layer state
#define BLS_LINK_STATE_IDLE 0
#define BLS_LINK_STATE_ADV BIT(0)
#define BLS_LINK_STATE_SCAN BIT(1)
#define BLS_LINK_STATE_INIT BIT(2)
#define BLS_LINK_STATE_CONN BIT(3)
Link Layer state machine switch is automatically implemented in BLE stack bottom layer.
Therefore, users cannot modify state in APP layer, but can obtain current state by
invoking the API below. The return value will be one of the five states.
u8 blc_ll_getCurrentState(void);
3.2.3 Link Layer State Machine Combined Application
3.2.3.1 Link Layer State Machine Initialization
Telink BLE SDK Link Layer fully supports all states, however, it’s flexible in design. Each
state can be assembled as a module; be default there’s only the basic Idle module, and
user needs to add modules and establish state machine combination for his application.
For example, for BLE Slave application, users need to add Advertising module and
ConnSlaveRole, while the remaining Scanning/Initiating modules are not included so as
to save code size and ramcode. The code of unused states won’t be compiled.
The API adding to the basic Idle module is as follows. This API is necessary, since all
BLE applications need initialization.
void blc_ll_initBasicMCU (u8 *public_adr);
Initialization APIs of modules corresponding to the other states (Advertising, Initiating,
Slave Role) are as follows.
void blc_ll_initAdvertising_module(u8 *public_adr);
void blc_ll_initSlaveRole_module(void);
The actual parameter “public_adr” is the pointer of BLE public mac address.
Users can flexibly establish Link Layer state machine combination by using the APIs
above. The following shows some common combination methods and corresponding
application scenes.

Table of Contents