EasyManuals Logo
Home>Texas Instruments>Microcontrollers>CC2540DK-MINI

Texas Instruments CC2540DK-MINI Application Guide

Texas Instruments CC2540DK-MINI
36 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #27 background imageLoading...
Page #27 background image
TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1
Page 27 of 36
Copyright © 2011-2015 Texas Instruments, Inc
A value of “00” indicates that neither key is pressed. A value of 01” indicates that the left key is
pressed. A value of “02” indicates that the right key is pressed. A value of “03” indicates that both
keys are pressed.
12.1.5 Proximity
One of the services of the proximity profile is the link loss service, which allows the proximity
reporter to begin an alert in the event the connection drops.
The link loss alert can be set by writing a value to <PROXIMITY_ALERT_LEVEL_UUID>.
The default alert value setting is “00”, which indicates “no alert.” To turn on the alert, write a 1-
byte value of “01” (low alert) or “02” (high alert). By default, the link does not timeout until 20
seconds have gone by without receiving a packet. This “Supervision Timeout” value can be
changed in the “Connection Services” tab; however the timeout value must be set before the
connection is established. After completing the write, move the keyfob device far enough away
from the USB Dongle until the link drops. Alternatively, you can disconnect the USB Dongle from
the PC, effectively dropping the connection. Once the timeout on the keyfob expires, the alarm
will be triggered. If a low alet was set, the keyfob will make a low pitched beep. If a high alert was
set, the keyfob will make a high pitched beep and the LED will blink. In either case, the keyfob will
beep ten times and then stop. Alternatively to stop the beeping, either a new connection can be
formed with the keyfob, or the button can be pressed.
12.2 Software Description
The application is implemented in the file keyFobDemo.c.
12.2.1 Initialization
The initialization of the application occurs in two phases: first, the KeyFobApp_Init function is
called by the OSAL. This function configures parameters in the peripheral profile, GAP, and GAP
bond manager. It also sets up the KeyFobDemo example services along with standard GATT and
GAP services in the attribute server. Then it sets an OSAL START_DEVICE_EVT event. This
triggers the second phase of the initialization, which can be found within the
KeyFobApp_ProcessEvent function. During this phase, the GAPRole_StartDevice function is
called to set up the GAP functions of the application. Then GAPBondMgr_Register is called to
register with the bond manager.
12.2.2 Event Processing
The application has two main event processing functions, KeyFobApp_ProcessEvent and
KeyFobApp_ProcessOSALMsg.
Function KeyFobApp_ProcessEvent handles events as follows:
SYS_EVENT_MSG: Service the OSAL queue and process OSAL messages.
KFD_START_DEVICE_EVT: Start the device, as described in the previous section.
KFD_ACCEL_READ_EVT: Read accelerometer and set timer for periodic reads.
KFD_BATTERY_CHECK_EVT: Read battery level and set timer for periodic reads.
KFD_TOGGLE_BUZZER_EVT: Toggle buzzer on proximity state.
Function KeyFobApp_ProcessOSALMsg handles OSAL messages as follows:
KEY_CHANGE: Handle key presses.
12.2.3 Callbacks
The application callback functions are as follows:
PeripheralStateNotificationCB: This is the GAP event callback. It processes GAP
events for startup and link connect/disconnect.
ProximityAttrCB: Receive info on link loss and setup from proximity service.
AccelEnablerChangeCB: Handle enabling of accelerometer.

Table of Contents

Other manuals for Texas Instruments CC2540DK-MINI

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments CC2540DK-MINI and is the answer not in the manual?

Texas Instruments CC2540DK-MINI Specifications

General IconGeneral
BrandTexas Instruments
ModelCC2540DK-MINI
CategoryMicrocontrollers
LanguageEnglish

Related product manuals