Skip to content

Compiler warning: "'us_timestamp_t mbed::TimerBase::read_high_resolution_us() const' is deprecated" #164

Open
@rmlearney

Description

@rmlearney

Compilation of the library for boards with an Mbed OS-based core generates multiple compiler warnings about the use of deprecated Mbed OS functions:

libraries/ArduinoBLE/src/utility/HCICordioTransport.cpp: In function 'void bleLoop()':
libraries/ArduinoBLE/src/utility/HCICordioTransport.cpp:123:68: warning: 'us_timestamp_t mbed::TimerBase::read_high_resolution_us() const' is deprecated: Use the Chrono-based elapsed_time method.  If integer microseconds are needed, you can use `elapsed_time().count()` [since mbed-os-6.0.0] [-Wdeprecated-declarations]
         last_update_us += (uint64_t) timer.read_high_resolution_us();
                                                                    ^
In file included from /Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/mbed/mbed.h:81:0,
                 from /Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/mbed.h:14,
                 from /Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/Arduino.h:42,
                 from /Users/xxxx/Documents/Arduino/libraries/ArduinoBLE/src/utility/HCICordioTransport.cpp:22:
/Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/mbed/drivers/Timer.h:104:20: note: declared here
     us_timestamp_t read_high_resolution_us() const;
                    ^~~~~~~~~~~~~~~~~~~~~~~
/Users/xxxx/Documents/Arduino/libraries/ArduinoBLE/src/utility/HCICordioTransport.cpp:145:72: warning: 'us_timestamp_t mbed::TimerBase::read_high_resolution_us() const' is deprecated: Use the Chrono-based elapsed_time method.  If integer microseconds are needed, you can use `elapsed_time().count()` [since mbed-os-6.0.0] [-Wdeprecated-declarations]
         uint64_t time_spent = (uint64_t) timer.read_high_resolution_us();
                                                                        ^
In file included from /Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/mbed/mbed.h:81:0,
                 from /Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/mbed.h:14,
                 from /Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/Arduino.h:42,
                 from /Users/xxxx/Documents/Arduino/libraries/ArduinoBLE/src/utility/HCICordioTransport.cpp:22:
/Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/mbed/drivers/Timer.h:104:20: note: declared here
     us_timestamp_t read_high_resolution_us() const;
                    ^~~~~~~~~~~~~~~~~~~~~~~
/Users/xxxx/Documents/Arduino/libraries/ArduinoBLE/src/utility/HCICordioTransport.cpp:156:55: warning: '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]
               rtos::ThisThread::sleep_for(wait_time_ms);
                                                       ^
In file included from /Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/mbed/rtos/rtos.h:30:0,
                 from /Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/mbed/mbed.h:23,
                 from /Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/mbed.h:14,
                 from /Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/Arduino.h:42,
                 from /Users/xxxx/Documents/Arduino/libraries/ArduinoBLE/src/utility/HCICordioTransport.cpp:22:
/Users/xxxx/Library/Arduino15/packages/arduino/hardware/mbed/1.3.2/cores/arduino/mbed/rtos/ThisThread.h:216:6: note: declared here
 void sleep_for(uint32_t millisec);
      ^~~~~~~~~

These come from code such as:

last_update_us += (uint64_t) timer.read_high_resolution_us();

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions