ble_status = ble_mgr_events_callback_handler(REGISTER_CALL_BACK,\
BLE_GAP_EVENT_TYPE,&app_gap_handle);
if (ble_status != true)
printf("\n##Error when Registering ATBTLC1000 callbacks");
}
/* timer callback function */
static void timer_callback_fn(void)
{
/* Add timer callback functionality here */
}
void button_cb(void)
{
/* Add button callback functionality here */
}
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);
/* Register ATBTLC1000 Callbacks */
register_btlc1000_callbacks();
/* Initialize Device Info service in GATT */
printf("\n*** Assignment 3.2: Start Device Info Service");
dis_init_service(&dis_service_handler);
/* Define the primary service in the GATT server database */
if((dis_primary_service_define(&dis_service_handler)) != AT_BLE_SUCCESS)
{
printf("Device Information Service definition failed");
}
/* Start Advertising process */
start_advertisement();
while(true)
{
ble_event_task();
}
}
ATBTLC1000
Appendix A: Software Solution - Pre-Defined Svc
©
2017 Microchip Technology Inc.
Training Manual
DS00002599A-page 48