English
Language : 

AN91267 Datasheet, PDF (26/62 Pages) Ramtron International Corporation – Getting Started with PSoC
Getting Started with PSoC® 4 BLE
Part 2: Write the Firmware
Four main firmware blocks are required for designing BLE standard Profile applications using PSoC Creator:
 System initialization
 BLE stack event handler
 BLE service-specific event handler
 Main loop and low-power implementation
The following sections discuss these blocks with respect to the design that you configured in Part 1: Configure the Design.
System Initialization
When the PSoC 4 BLE device is reset, the firmware first performs the system initialization, which includes enabling global
interrupts and enabling other Components used in the design. After the system is initialized, the firmware initializes the BLE
Component, which internally initializes the complete BLE subsystem.
As a part of the BLE Component initialization, you must pass the event-handler function, which will be called by the BLE stack
to notify pending events. The BLE stack event handler shown in Code 2 is registered as a part of the BLE initialization. If the
BLE Component initializes successfully, the firmware registers another event handler for the IAS-specific events and switches
control to the main loop. Figure 38 and Code 1 show the flow chart and the firmware source code for system initialization.
Figure 38. System Initialization Flow Chart
Reset
System Initialization
BLE Component start
and Register Stack
Event Handler
BLE Start
Success?
No
Yes
Register IAS Event
Handler
Error Handling
Main Processing
Loop
www.cypress.com
Document No. 001-91267 Rev. *D
26