SWRU271I October 2010 – January 2020 CC2540 , CC2540T , CC2541 , CC2541-Q1 , CC2640R2F
OSAL messages can come from various layers of the Bluetooth Low Energy stack. For example, these messages can be from key presses sent by the HAL. The application has code specific to the Keyfob reference hardware in the CC2540/41DK-MINI development kit. This code is surrounded by the preprocessor directive #if defined (CC2540_MINIDK) and gets compiled when using the CC2540/41DK-MINI Keyfob configuration. This code adds the TI-proprietary simple keys service to the GATT server and handles key presses through the simple keys profile.
Each time you press or release a key on the keyfob, HAL sends an OSAL message to the application. As Section 3.5 describes, this action causes a SYS_EVENT_MSG event to occur. This event is handled in the application by the function simpleBLEperipheral_ProcessOSALMsg(). In the current SimpleBLEPeripheral application, the KEY_CHANGE message is the only recognized OSAL message type. You can define additional message types. The KEY_CHANGE message event processing calls the calls the simpleBLEPeripheral_HandleKeys() function, which checks the state of the keys.