Getting Started With EZ-
BLE™ PRoC™ Module
www.cypress.com
Document No.: 001-96841 Rev. **
40
Figure 51. Bluetooth Low Energy IAS Event Handler Firmware
M a i n L o o p a n d L o w P o w e r O p e r a t i o n
The main loop firmware in your design must periodically service the BLE
stack processing event and configure the BLESS
block and the EZ-BLE PRoC Module system into the Low Power mode between connection intervals.
Figure 52
and
Figure 53
show the main loop flowchart and firmware.
#define
NO_ALERT (0u)
#define
MILD_ALERT (1u)
#define
HIGH_ALERT (2u)
#define
BLINK_TIMEOUT (100u)
#define
LED_NO_ALERT (200u)
#define
LED_MILD_ALERT (100u)
#define
LED_HIGH_ALERT (0u)
uint8
alertLevel;
void
IasEventHandler(
uint32
event,
void
* eventParam)
{
/* Alert Level Characteristic write event */
if
(event == CYBLE_EVT_IASS_WRITE_CHAR_CMD)
{
/* Data structure that is returned as eventParam */
CYBLE_IAS_CHAR_VALUE_T *charValue =
(CYBLE_IAS_CHAR_VALUE_T *)eventParam;
/* Extract Alert Level value from the data structure */
alertLevel = *((charValue->value->val));
}
}