![Cypress EZ-BT WICED CYBT-343026-01 Скачать руководство пользователя страница 26](http://html1.mh-extra.com/html/cypress/ez-bt-wiced-cybt-343026-01/ez-bt-wiced-cybt-343026-01_getting-started_2705923026.webp)
Getting Started with EZ-BT WICED Modules
Document Number: 002-23400 Rev. **
26
7 . 4 . 1
S y s t e m I n i t i a l i z a t i o n
When the EZ-BT WICED Module starts up, it enters the
APPLICATION_START()
function. The
BTM_ENABLED_EVT
is
the first stack-generated event after power ON or reset; it indicates that Bluetooth stack initialization is complete. The
initialization functions
application_init
and
hello_sensor_applicaiton_init
functions are executed in the
BTM_ENABLED_EVT
event. These initialization functions call appropriate APIs to initialize the Service Discovery Protocol
(SDP) database for Bluetooth BR/EDR, initialize the GATT database for BLE, set the advertisement data, set the inquiry
response data and register appropriate callbacks, initialize the timers, and configure the button and LED based on the
application requirements.
shows the flowchart for system initialization.
Figure 17. System Initialization Flowchart
Reset
ROM Stack Init
Register Event and
Interrupt Handlers
Start Advertising
S
y
s
te
m
I
n
it
ia
li
z
a
ti
o
n
Internal Stack
Processing Loop
Before looking at the application initialization routines, look at
wiced_bt_cfg.c
. The configuration structure in this file
allows simple control over advertisement and scan parameters for BLE and inquiry/page scan interval for Bluetooth
BR/EDR, and some of the profile-specific behavior. In many cases, the SDK provides APIs that allow you to trigger
behavior with custom settings rather than the values that are set here. However, you can often use these configuration
values as-is and avoid further complexity in your code.
The following Bluetooth configuration parameters can be modified based on application requirements by modifying
values in
wiced_bt_cfg.c
shown in
▪
Advertisement and scan settings for BLE
▪
Choice of advertisement channels to be used for BLE
▪
Scan and page interval settings for Bluetooth BR/EDR
▪
Bluetooth Device name
▪
MTU size, etc.
The
“spp_custom” example described in this guide does not require any modifications to this structure except
BT_LOCAL_NAME. You can choose to retain the default name as well; for the spp sample application,
it is “spp”.
Code 14. wiced_bt_cfg: Project Configuration Structure
/* Null-Terminated Local Device Name */
uint8_t
BT_LOCAL_NAME[] = {
's'
,
'p'
,
'p'
,
' '
,
't'
,
'e'
,
's'
,
't'
,
'\0'
};
const
uint16_t
BT_LOCAL_NAME_CAPACITY =
sizeof
(BT_LOCAL_NAME);
const
wiced_bt_cfg_settings_t
wiced_bt_cfg_settings =
{
(
uint8_t
*)BT_LOCAL_NAME,
/**< Local device name (NULL terminated) */
{0x00, 0x00, 0x00},
/**< Local device class */
BTM_SEC_IN_AUTHENTICATE
|
BTM_SEC_OUT_AUTHENTICATE
|
BTM_SEC_ENCRYPT
,
/**< Security requirements mask
(BTM_SEC_NONE, or combination of BTM_SEC_IN_AUTHENTICATE, BTM_SEC_OUT_AUTHENTICATE, BTM_SEC_ENCRYPT */
3,
/* BR/EDR Scan Configuration */
{