English
Language : 

AN91267 Datasheet, PDF (30/62 Pages) Ramtron International Corporation – Getting Started with PSoC
Getting Started with PSoC® 4 BLE
Code 3. BLE IAS Event Handler Firmware
void IasEventHandler(uint32 event, void *eventParam)
{
/* Alert Level Characteristic write event */
if(event == CYBLE_EVT_IASS_WRITE_CHAR_CMD)
{
/* Read the updated Alert Level value from the GATT database */
CyBle_IassGetCharacteristicValue(CYBLE_IAS_ALERT_LEVEL,
sizeof(alertLevel), &alertLevel);
}
}
Main Loop and Low-Power Implementation
The main loop firmware in your design must periodically service the BLE stack-processing event, update the blue alert LED
state per the IAS Alert Level Characteristic value and configure the BLESS block and the PSoC 4 BLE system into low-power
mode between consecutive BLE advertisement and connection intervals. The main loop flow chart and the firmware are shown
in Figure 41 and Code 4.
Figure 41. Firmware Main Loop Flow Chart
Process BLE events
No Alert
No
Mild Alert
No
High Alert
Yes Turn OFF the LED
Yes Blink the LED
No
Yes Turn ON the LED
No
BLE Idle?
Yes
- Enter BLESS Deep-Sleep
- Enter PSoC 4 BLE Sleep
or DeepSleep mode
BLESS Interrupt
- PSoC 4 BLE Auto Wakeup
- BLESS Auto Wakeup
www.cypress.com
Document No. 001-91267 Rev. *D
30