English
Language : 

AN91162 Datasheet, PDF (24/43 Pages) Ramtron International Corporation – Creating a BLE Custom Profile
Figure 34. Add a Source/Header File
Creating a BLE Custom Profile
Project Files
The associated project has the following files:
1. main.c/.h: These files contain the main function that acts as the entry point for the system. It initializes the system,
including BLE, and regularly calls the function to process BLE events.
2. BLEProcess.c/.h: These files contain the definitions of the functions for handling BLE event callbacks and updating
the RGB LED characteristic value in the GATT database.
3. led.c/.h: These files contain the definitions of the function that handles the Component for displaying RGB LED colors
and intensity.
Configure the Firmware
This project’s firmware handles the following processes:
 Initializes the Components and enable interrupts.
 Processes the BLE events that are generated by the BLE stack, such as BLE start, connection request, and write
command.
 Displays the color on the RGB LED when a new color data is received from the GATT client.
This project uses the following BLE APIs:
API
CyBle_Start(CYBLE_CALLBACK_T)
CyBle_ProcessEvents(void)
CyBle_GappStartAdvertisement(uint8)
CyBle_GetState(void)
CyBle_GattsWriteRsp(CYBLE_CONN_HANDLE_T)
CyBle_GattsWriteAttributeValue(
CYBLE_GATT_HANDLE_VALUE_PAIR_T *,
uint16, CYBLE_CONN_HANDLE_T *, uint8)
Description
Starts the BLE Component and registers a function as the event handler for events
coming from the BLE stack. The argument to this function is the name of the event-
handler function.
Processes the BLE events between the BLE stack and the application. This should
be continuously called in the main function. This function has no argument.
Starts BLE Peripheral advertising with the interval set in the BLE Component (as
listed in Table 3). The argument defines if the advertisement is fast, slow, or custom.
Determines the existing state of the BLE stack, such as disconnected, connected,
and advertising. This function has no argument.
Sends a write response back to the GATT client device whenever the GATT client
device sends a write request. This function has the connection handle as the
argument.
Updates the data value of an attribute (such as a characteristic) so that the value is
available for read by the GATT client device. This function has four arguments to
receive the updated data, offset, connection handle, and flags related to the data to
be communicated.
Macro Definitions
Each header file contains macros for constants used in the code. Macros from each file are shown below:
www.cypress.com
Document No. 001-91162 Rev. *A
24