'M','y','_','S','E','N','S' // AD2 = “My_SENS”
};
Note:
1.
The name of the device is to be changed (AD2 field).
2.
According to the new name, AD2 length must be adapted to new AD2 content.
4.
Add the following
start_advertisement
function in
startup_template.c
prototype for the
function
void start_advertisement (void)
; also this can be added to avoid warnings.
void start_advertisement (void){
printf("\n*** Assignment 2.1: Start Advertisement");
/*Set advertisement data*/
ble_status = at_ble_adv_data_set(adv_data,sizeof(adv_data),NULL,
0
);
/*Start Advertisement*/
ble_status = at_ble_adv_start(AT_BLE_ADV_TYPE_UNDIRECTED,\
AT_BLE_ADV_GEN_DISCOVERABLE,
NULL
,AT_BLE_ADV_FP_ANY,1600,655,0);
if(ble_status != AT_BLE_SUCCESS)
printf
("\n*** Failed to start advertisement");
}
5.
Start the advertisement process by adding the following highlighted code to the application main
routine.
int main(void)
{
#if SAMG55 || SAM4S
/* Initialize the SAM system. */
sysclk_init();
board_init();
#elif SAM0
system_init();
#endif
/* Initialize serial console */
serial_console_init();
/* Hardware timer */
hw_timer_init();
/* button initialization */
button_init();
hw_timer_register_callback(timer_callback_fn);
DBG_LOG("Initializing BLE Application");
/* initialize the BLE chip and Set the Device Address */
ble_device_init(NULL);
/* Start Advertising process */
start_advertisement();
/* Register Primary/Included service in case of GATT Server */
while(true)
{
/* Write application task */
}
}
6.
Click "
" to save the project <Ctrl+S>.
7.
Click "
" button to compile the project <F7>.
8.
Verify that no build error appears in Atmel Studio output window.
Figure 3-7. Atmel Studio Output Window
ATBTLC1000
Establishing Connection with Central Device
©
2017 Microchip Technology Inc.
Training Manual
DS00002599A-page 24