User Manual
Getting Started With EZ-
www.cypress.com Document No.: 001-96841 Rev. ** 35
Write the Application Code
The main.c file in the workspace has a template for the main program function. The following main firmware blocks are
required for designing any BLE standard profile applications using PSoC Creator:
System initialization
Bluetooth Low Energy stack event handler
Bluetooth Low Energy service-specific event handler
Main loop and low power implementation
This section discusses details of these blocks with respect to the design configured in the previous section.
S ys te m I n i ti a li za t i on
When the EZ-BLE PRoC Module is reset or wakes up from the hibernate mode, the firmware needs to perform initialization,
which includes platform initialization, enabling global interrupts, and initializing/starting the BLE Component. Figure 46 shows
the flowchart for system initialization.
As a part of the BLE Component initialization, you must pass the event handler function that will be called to receive events
from the BLE stack. The BLE stack event handler shown in Figure 49 is registered as part of the BLE initialization. If the BLE
Component initializes successfully, the firmware registers the event handler that will be called to receive IAS events and
switches control to the main loop thread.
Figure 47 shows the firmware source code for system initialization.
Figure 46. System Initialization Flowchart
Reset
Platform Initialization
- BLE Init
- Register Stack Event
Handler
BLE-Init
Success?
Register IAS Event
Handler
Y
Error HandlingN
System Initialization
Main Processing
Thread
