Skip to content

Improve logic for RTOS wait_us in the sub-millisecond case #7393

@LaurentLouf

Description

@LaurentLouf

Description

Simple question that may lead to an enhancement. In RTOS mode, the wait_us function executes a division there https://github.com/ARMmbed/mbed-os/blob/master/platform/mbed_wait_api_rtos.cpp#L40 , executed in all cases, so even for sub-millisecond delays. This is only an integer division so it's not that bad, but considering the sub-millisecond case, wouldn't it preferable to avoid any costly operation, and just test if ( us < 1000 ) for that case, leaving the more complicated logic for the longer waits ? I haven't the equipment to test if it enhances the situation or not, but feel like it could for very small values (<10µs for example).

Issue request type

[ ] Question
[X] Enhancement
[ ] Bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions