adafruit / Adafruit_nRF52_Arduino

Adafruit code for the Nordic nRF52 BLE SoC on Arduino
Other
606 stars 492 forks source link

bluefruit.h will not compile - error with hid_gamepad_report_t #716

Closed vader7071 closed 2 years ago

vader7071 commented 2 years ago

Operating System

Windows 10

IDE version

Both 1.8.15 and 2.0.0-rc2

Board

nRF52832

BSP version

github latest as of 02/04/2022

Sketch

2022-02-04_FettPool_BLE_Helmet.txt

What happened ?

When I try to compile the above sketch, or any default example sketch included in the library, the compiler errors and states the below error log (BLE HID Gamepad not declared). If I comment out the #include line and shut down the BLE portion of the sketch, the sketch compiles fine.

How to reproduce ?

Just try to compile.

Debug Log

In file included from d:\Documents\Arduino\libraries\Bluefruit52Lib\src/bluefruit.h:68:0, from C:\Users\admn\AppData\Local\Temp\.arduinoIDE-unsaved202215-20620-w1omn1.b534o\bleuart\bleuart.ino:14: d:\Documents\Arduino\libraries\Bluefruit52Lib\src/services/BLEHidGamepad.h:54:17: error: 'hid_gamepad_report_t' has not been declared bool report(hid_gamepad_report_t const* report); ^~~~~~~~~~~~~~~~~~~~ d:\Documents\Arduino\libraries\Bluefruit52Lib\src/services/BLEHidGamepad.h:60:36: error: 'hid_gamepad_report_t' has not been declared bool report(uint16_t conn_hdl, hid_gamepad_report_t const* report); ^~~~~~~~~~~~~~~~~~~~ Compilation error: exit status 1}

Screenshots

No response

hathach commented 2 years ago

for readability an reproducible:

  1. please attached the ino sketch instead of pasting the code here.
  2. Debug log should be in code/block
  3. Also make sure you tried with one of the stock example e.g blehid to see if that compiles as well.
vader7071 commented 2 years ago

1) I will go back and edit and paste the actual file, I apologize. 2) I will try and fix the debug log 3) Please see under "What happened" where it states:

 When I try to compile the above sketch, _**or any default example sketch included in the library**_...

I have tried compiling multiple example sketches in the peripheral, client, and dual roles sub categories, and all result in the same compile error concerning "hid_gamepad_result_t".

hathach commented 2 years ago

you have nothing to apologize for, it is a typical and quite intuitive to just paste the code. If git doesn't allow to upload .ino file, just rename it to .txt to upload

hathach commented 2 years ago

did you install the bsp using git clone. Make sure you also clone its submodule as well (tinyusb)

git submodule update --init
vader7071 commented 2 years ago

Before, I have just been downloading the zip file and extracting all of the files, then copying the libraries folder into my "arduino" folder to update.

I just downloaded Git and ran the git clone to update the libraries.

Before Git, "bluefruit.h" was located in "D:\Documents\Arduino\Libraries\Bluefruit52Lib\src"

After Git, "bluefruit.h" is located in "D:\Documents\Arduino\libraries\Adafruit_nRF52_Arduino\libraries\Bluefruit52Lib\src" But to ensure the IDE got the correct libraries, I copied the Git version over into the libraries folder, so when the IDE went searching, it would find the most up to date in either the libraries root folder or in the Adafruit_nRF52_Arduino\libraries folder.

The submodule command did not work via Git [fatal: not a git repository (or any of the parent directories): .git] but I did go and clone the TinyUSB repository as well.

Still, after all of that, I get the same result.

In file included from D:\Documents\Arduino\libraries\Adafruit_nRF52_Arduino\libraries\Bluefruit52Lib\src\bluefruit.h:68:0, from D:\Documents\Arduino\2022-02-04_FettPool_BLE_Helmet\2022-02-04_FettPool_BLE_Helmet.ino:25: D:\Documents\Arduino\libraries\Adafruit_nRF52_Arduino\libraries\Bluefruit52Lib\src\services/BLEHidGamepad.h:54:17: error: 'hid_gamepad_report_t' has not been declared bool report(hid_gamepad_report_t const* report); ^~~~~~~~~~~~~~~~~~~~ D:\Documents\Arduino\libraries\Adafruit_nRF52_Arduino\libraries\Bluefruit52Lib\src\services/BLEHidGamepad.h:60:36: error: 'hid_gamepad_report_t' has not been declared bool report(uint16_t conn_hdl, hid_gamepad_report_t const* report); ^~~~~~~~~~~~~~~~~~~~ Compilation error: exit status 1}

hathach commented 2 years ago

download the zip file is not enough, since this repo include the tinyusb and nrfCrypto as submodule. You need to git clone this repo and its submodule following the readme exact instructions at https://github.com/adafruit/Adafruit_nRF52_Arduino#optional-core-development-adafruit-nrf52-bsp-via-git