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.

[参考译文] CC2564MODA:如何使用 TM4C129xnczad MCU 在 CC2564MODA 中实现蓝牙广播示例代码

Guru**** 664280 points
Other Parts Discussed in Thread: TM4C129XNCZAD, CC2564MODA
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1183094/cc2564moda-how-to-implement-sample-code-for-bluetooth-advertise-in-cc2564moda-using-tm4c129xnczad-mcu

器件型号:CC2564MODA
主题中讨论的其他器件:TM4C129XNCZAD

您好!

我在 TM4C129XNCZAD MCU 和 CC2564MODA 上工作、我想通过 TM4C29 MCU 广播此蓝牙。 您能不能向我推荐一些示例代码。  

谢谢  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    此主题已分配、但由于假期、请等待一些延迟。

    此致、
    AB

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好 Jansi、

    选择停止或开始广播时、以下代码可在我们的演示中找到(仅 BLE 演示、因为广播是 BLE、可发现性是蓝牙经典)。 我会将其用作您的项目的参考。

       /* 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;
    }

    此致、

    Rogelio