EasyManuals Logo
Home>Texas Instruments>Microcontrollers>CC2541

Texas Instruments CC2541 Application Guide

Texas Instruments CC2541
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 #21 background imageLoading...
Page #21 background image
TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1
Page 21 of 36
Copyright © 2011-2015 Texas Instruments, Inc
When not connected, the keyfob's right button is used to toggle advertising on and off. When in a
connection, the keyfob's left button sends a glucose measurement and glucose context.
8.1.2 Basic Operation
Power up the device and press the right button to enable advertising. From a glucose collector
peer device, initiate a device discovery and connection procedure to discover and connect to the
glucose sensor. The peer device should discover the glucose service and configure it to enable
notifications of the glucose measurement. It may also enable notifications of the glucose
measurement context.
Once glucose measurement notifications have been enabled a simulated measurement can be
sent by pressing the left button. If the peer device has also enabled notifications of the glucose
measurement context then this will be sent following the glucose measurement.
The peer device may also write commands to the record access control point to retrieve or erase
stored glucose measurement records. The sensor has four hardcoded simulated records.
If the peer device initiates pairing then the devices will pair. Only "just works" pairing is supported
by the application (pairing without a passcode).
8.2 Software Description
The application is implemented in the file glucose.c.
8.2.1 Initialization
The initialization of the application occurs in two phases: first, the Glucose_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 glucose 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 Glucose_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.
8.2.2 Event Processing
The application has two main event processing functions, Glucose_ProcessEvent and
Glucose_ProcessOSALMsg.
Function Glucose_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.
Function Glucose_ProcessOSALMsg handles OSAL messages as follows:
KEY_CHANGE messages: Call function Glucose_HandleKeys to handle
keypresses.
CTL_PNT_MSG: Call function glucoseProcessCtlPntMsg to process record
access control point messages.
8.2.3 Callbacks
The application callback functions are as follows:
glucoseGapStateCB: This is the GAP event callback. It processes GAP events
for startup and link connect/disconnect.
glucosePairStateCB: This is the GAP pairing state callback. It is used to store
the bonding state of pairing.

Table of Contents

Other manuals for Texas Instruments CC2541

Questions and Answers:

Question and Answer IconNeed help?

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

Texas Instruments CC2541 Specifications

General IconGeneral
BrandTexas Instruments
ModelCC2541
CategoryMicrocontrollers
LanguageEnglish

Related product manuals