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 #14 background imageLoading...
Page #14 background image
TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1
Page 14 of 36
Copyright © 2011-2015 Texas Instruments, Inc
The application is implemented in the file cyclingSensor.c.
5.2.1 Initialization
Initialization of the application occurs in two phases: first, the CyclingSensor_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 CSC service 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 CyclingSensor_ProcessEvent function.
During this phase, the GAPRole_StartDevice function is called to set up the GAP functions of the
application. Then GAPBOND_Mgr_Register is called to register with the bond manager.
5.2.2 Event Processing
The application has two main event processing functions, CyclingSensor_ProcessEvent and
sensor_ProcessOSALMsg.
Function CyclingSensor_ProcessEvent handles events as follows:
SYS_EVENT_MSG: Service the OSAL queue and process OSAL messages.
START_DEVICE_EVT: Start the device, as described in the previous section.
CSC_PERIODIC_EVT: Send periodic CSC measurements.
CSC_CONN_PARAM_UPDATE_EVT: send parameter update until successful
CSC_NEGLET_TIMEOUT_EVT: see section 5.2.8
CSC_RESET_EVT: reset device as described above
Function cycling_ProcessOSALMsg handles OSAL messages as follows:
KEY_CHANGE message: Call function sensor_HandleKeys to handle key presses.
5.2.3 Callbacks
The application callback functions are as follows:
SensorGAPStateCB: This is the GAP event callback. It processes GAP events for
startup and link connect/disconnect.
SensorCB: This is the CSC service callback. It handles enabling or disabling periodic
CSC measurements when notifications of the CSC measurements are enabled or
disabled. Additionally, it informs the application when the peer device has updated a
sensor location or changed the cumulative distance traveled.
5.2.4 Sending Notifications
The application sends notifications of the CSC measurements when configured to do so by the
peer device. When the peer device configures the CSC measurements for notification the
application will receive a CSC service callback. The application starts a timer to begin periodic
simulated CSC measurements for a bicycle. When the timer expires the application calls
sensorMeasNotify to build and send a measurement using the CSC service API.
5.2.5 Confirming Indications
When the peer device writes to the sensors control point characteristic the peer device will
receive an indication in response. When the indication is received by the peer device, the device
must send an ATT_HandleValueConfirmation back to the server.
5.2.6 Reading from the Sensor
The CSC service has 2 readable characteristics: Features and Sensor Location. Sending a read
request to the Features characteristic triggers a response packet containing a byte array of the
feature capabilities of the sensor which are as follows:
Wheel revolutions
Crank revolutions

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