Other Parts Discussed in Thread: TM4C129XNCZAD,
Hi,
I am working on TM4C129XNCZAD MCU and CC2564MODA, I want to advertise this Bluetooth through TM4C29 MCU. Can you please suggest me some sample code.
Thanks
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I am working on TM4C129XNCZAD MCU and CC2564MODA, I want to advertise this Bluetooth through TM4C29 MCU. Can you please suggest me some sample code.
Thanks
Hello Jansi,
The following Code is found in our demos (Only the BLE demos since Advertising is BLE and Discoverability is Bluetooth Classic) when choosing to stop or start advertising. I would use this as reference for your project.
/* The following function is a utility function that starts an */ /* advertising process. */ static int StartAdvertising(unsigned int BluetoothStackID) { int ret_val; GAP_LE_Advertising_Parameters_t AdvertisingParameters; GAP_LE_Connectability_Parameters_t ConnectabilityParameters; /* First, check that valid Bluetooth Stack ID exists. */ if(BluetoothStackID) { /* Set up the advertising parameters. */ AdvertisingParameters.Advertising_Channel_Map = HCI_LE_ADVERTISING_CHANNEL_MAP_DEFAULT; AdvertisingParameters.Scan_Request_Filter = fpNoFilter; AdvertisingParameters.Connect_Request_Filter = fpNoFilter; AdvertisingParameters.Advertising_Interval_Min = 50; AdvertisingParameters.Advertising_Interval_Max = 100; /* Configure the Connectability Parameters. */ /* * NOTE * Since we do not ever put ourselves to be direct */ /* connectable then we will set the DirectAddress to all */ /* 0s. */ ConnectabilityParameters.Connectability_Mode = lcmConnectable; ConnectabilityParameters.Own_Address_Type = latPublic; ConnectabilityParameters.Direct_Address_Type = latPublic; ASSIGN_BD_ADDR(ConnectabilityParameters.Direct_Address, 0, 0, 0, 0, 0, 0); /* Now enable advertising. */ ret_val = GAP_LE_Advertising_Enable(BluetoothStackID, TRUE, &AdvertisingParameters, &ConnectabilityParameters, GAP_LE_Event_Callback, 0); if(!ret_val) Display(("GAP_LE_Advertising_Enable success.\r\n")); else { if(ret_val == -66) { Display(("GAP_LE_Advertising: Already Enabled.\r\n")); } else { Display(("GAP_LE_Advertising_Enable returned %d.\r\n", ret_val)); } ret_val = FUNCTION_ERROR; } } else { /* No valid Bluetooth Stack ID exists. */ ret_val = INVALID_STACK_ID_ERROR; } return(ret_val); } /* The following function is a utility function that stops an */ /* advertising process. */ static int StopAdvertising(unsigned int BluetoothStackID) { int ret_val; /* Now disable advertising. */ ret_val = GAP_LE_Advertising_Disable(BluetoothStackID); if(!ret_val) Display(("GAP_LE_Advertising_Disabled success.\r\n")); else { if(ret_val == -1) { Display(("GAP_LE_Advertising: Already Disabled.\r\n")); } else { Display(("GAP_LE_Advertising_Disabled returned %d.\r\n", ret_val)); } ret_val = FUNCTION_ERROR; } return ret_val; }
Kind Regards,
Rogelio