tcoppex / mbed-ble-hid

:raising_hand: Implement Human Interface Device over Bluetooth Low Energy on a Mbed stack (Arduino nano 33 BLE).
MIT License
50 stars 16 forks source link

Compilation errors using Platformio's IDE (Visual Studio Code) #13

Open afpineda opened 2 years ago

afpineda commented 2 years ago

Hi. Just to note: I tried to compile an empty project (just libraries) in VisualStudio Code and PlatformIO's IDE plugin. Previously, I downloaded and installed mbed-ble-hid using the builtin library manager. Then I came into some compilation errors and warnings at Mbed_BLE_HID.cpp.

The issue

PlatformIO's library manager seems to download an outdated version.

The workarround

I downloaded a fresh copy from this repository (master branch) to overwrite PlatformIO's files. Now, there are no compilation errors, but warnings:

[{
    "resource": "/d:/Documentos/dev/PlatformIO/PruebasChungas/Test1/.pio/libdeps/nano33ble/Mbed BLE HID/src/Mbed_BLE_HID.cpp",
    "owner": "cpp",
    "severity": 4,
    "message": "'int mbed::TimerBase::read_ms() const' is deprecated: Use the Chrono-based elapsed_time method.  If integer milliseconds are needed, you can use `duration_cast<milliseconds>(elapsed_time()).count()` [since mbed-os-6.0.0] [-Wdeprecated-declarations]",
    "startLineNumber": 51,
    "startColumn": 47,
    "endLineNumber": 51,
    "endColumn": 47
},{
    "resource": "/d:/Documentos/dev/PlatformIO/PruebasChungas/Test1/.pio/libdeps/nano33ble/Mbed BLE HID/src/Mbed_BLE_HID.cpp",
    "owner": "cpp",
    "severity": 4,
    "message": "'int events::EventQueue::call_every(int, F) [with F = void (*)()]' is deprecated: Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`. [since mbed-os-6.0.0] [-Wdeprecated-declarations]",
    "startLineNumber": 71,
    "startColumn": 36,
    "endLineNumber": 71,
    "endColumn": 36
},{
    "resource": "/d:/Documentos/dev/PlatformIO/PruebasChungas/Test1/.pio/libdeps/nano33ble/Mbed BLE HID/src/Mbed_BLE_HID.cpp",
    "owner": "cpp",
    "severity": 4,
    "message": "'void rtos::ThisThread::sleep_for(uint32_t)' is deprecated: Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`. [since mbed-os-6.0.0] [-Wdeprecated-declarations]",
    "startLineNumber": 78,
    "startColumn": 44,
    "endLineNumber": 78,
    "endColumn": 44
},{
    "resource": "/d:/Documentos/dev/PlatformIO/PruebasChungas/Test1/.pio/libdeps/nano33ble/Mbed BLE HID/src/Mbed_BLE_HID.cpp",
    "owner": "cpp",
    "severity": 4,
    "message": "'ble::BLE::InstanceID_t ble::BLE::getInstanceID() const' is deprecated: BLE singleton supports one instance. You may create multipleinstances by using the constructor. [since mbed-os-6.3.0] [-Wdeprecated-declarations]",
    "startLineNumber": 98,
    "startColumn": 25,
    "endLineNumber": 98,
    "endColumn": 25
},{
    "resource": "/d:/Documentos/dev/PlatformIO/PruebasChungas/Test1/.pio/libdeps/nano33ble/Mbed BLE HID/src/Mbed_BLE_HID.cpp",
    "owner": "cpp",
    "severity": 4,
    "message": "unused variable 'sm' [-Wunused-variable]",
    "startLineNumber": 203,
    "startColumn": 9,
    "endLineNumber": 203,
    "endColumn": 9
},{
    "resource": "/d:/Documentos/dev/PlatformIO/PruebasChungas/Test1/.pio/libdeps/nano33ble/Mbed BLE HID/src/Mbed_BLE_HID.cpp",
    "owner": "cpp",
    "severity": 4,
    "message": "unused variable 'handle' [-Wunused-variable]",
    "startLineNumber": 204,
    "startColumn": 8,
    "endLineNumber": 204,
    "endColumn": 8
}]
tcoppex commented 2 years ago

Hi @afpineda and thanks for your feedback,

Yes this project expects Mbed OS v5.x which I believe is the one used by the current Arduino IDE. While I also prefer PlatformIO I try to keep compatibility with Arduino as a priority.

I did not catch this issue on Sublime-Text and Deviot but your fix can become handy for others, thank you !

Edit : While I think about it I do have updated master a few days ago for an issue I'm working on but this should not have fixed any compilation errors. I certainly should have branch though.