Skip to content

Conversation

geky
Copy link
Contributor

@geky geky commented Nov 7, 2016

The non-irq timer functionality provided by the RtosTimer is now duplicated by the EventQueue.

Added this blurb to the head of RtosTimer.h to help migration:

The RtosTimer has been superseded by the EventQueue. The RtosTimer and EventQueue duplicate the functionality of timing events outside of interrupt context, however the EventQueue has additional features to handle deferring other events to multiple contexts.

For an example, the following code shows a simple use of the RtosTimer:

DigitalOut led(LED1);
void blink() {
    led = !led;
}

RtosTimer timer(&blink);
int main() {
    timer.start(1000); // call blink every 1s
    wait_ms(5000);
    timer.stop(); // stop after 5s
}

This is the above example rewritten to use the EventQueue:

DigitalOut led(LED1);
void blink() {
    led = !led;
}

EventQueue queue(4*EVENTS_EVENT_SIZE);
int main() {
   int blink_id = queue.call_every(1000, &blink); // call blink every 1s
   queue.dispatch(5000);
   queue.cancel(blink_id); // stop after 5s
}

cc @sg-, @0xc0170, @c1728p9

The non-irq timer functionality provided by the RtosTimer is now
duplicated by the EventQueue. See RtosTimer.h for more info.
@c1728p9
Copy link
Contributor

c1728p9 commented Nov 7, 2016

Looks good to me

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 8, 2016

/morph test

@mbed-bot
Copy link

mbed-bot commented Nov 8, 2016

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1026

All builds and test passed!

@bridadan
Copy link
Contributor

bridadan commented Nov 8, 2016

Yay, lovely lovely deprecation notices showing up in the CI 😄

08:10:34 [Warning] main.cpp@29,60: 'rtos::RtosTimer::RtosTimer(void (*)(const void*), os_timer_type, void*)' is deprecated (declared at /home/jenkins/mbed_jenkins/workspace/bm_wrap/977/.build/tests/K64F/GCC_ARM/rtos/RtosTimer.h:90): The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details [since mbed-os-5.2] [-Wdeprecated-declarations]
08:10:34 [Warning] main.cpp@30,60: 'rtos::RtosTimer::RtosTimer(void (*)(const void*), os_timer_type, void*)' is deprecated (declared at /home/jenkins/mbed_jenkins/workspace/bm_wrap/977/.build/tests/K64F/GCC_ARM/rtos/RtosTimer.h:90): The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details [since mbed-os-5.2] [-Wdeprecated-declarations]
08:10:34 [Warning] main.cpp@31,60: 'rtos::RtosTimer::RtosTimer(void (*)(const void*), os_timer_type, void*)' is deprecated (declared at /home/jenkins/mbed_jenkins/workspace/bm_wrap/977/.build/tests/K64F/GCC_ARM/rtos/RtosTimer.h:90): The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details [since mbed-os-5.2] [-Wdeprecated-declarations]
08:10:34 [Warning] main.cpp@32,60: 'rtos::RtosTimer::RtosTimer(void (*)(const void*), os_timer_type, void*)' is deprecated (declared at /home/jenkins/mbed_jenkins/workspace/bm_wrap/977/.build/tests/K64F/GCC_ARM/rtos/RtosTimer.h:90): The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details [since mbed-os-5.2] [-Wdeprecated-declarations]

@adbridge adbridge merged commit b10cf7f into ARMmbed:master Nov 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants