Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task] - Test watchdogs #17

Closed
ladislas opened this issue Feb 14, 2020 · 1 comment
Closed

[Task] - Test watchdogs #17

ladislas opened this issue Feb 14, 2020 · 1 comment
Assignees
Labels
01 - type: task Something to do

Comments

@ladislas
Copy link
Member

ladislas commented Feb 14, 2020

@ladislas ladislas added the 01 - type: task Something to do label Feb 14, 2020
@ladislas ladislas self-assigned this Feb 14, 2020
@ladislas ladislas changed the title Test watchdogs [Task] - Test watchdogs Aug 28, 2020
LekaOS - Tasks, Bugs & PRs automation moved this from Backlog to Done Oct 2, 2020
@YannLocatelli
Copy link
Member

YannLocatelli commented Oct 2, 2020

Quick example of watchdog using Ticker based on mbed api example

#include "mbed.h"

Ticker kicker;

void watchdogKick()
{
    Watchdog::get_instance().kick();
}

int main()
{
    printf("\n\nDemonstration of watchdog in case of error (happens in 10s).\n");

    const uint32_t TIMEOUT_MS = 5000;
    Watchdog &watchdog = Watchdog::get_instance();
    watchdog.start(TIMEOUT_MS);

    kicker.attach_us(watchdogKick, 1000);
    
    ThisThread::sleep_for(10s);
    error("This is a reason why watchdog exists. Restarting in 5000ms...\n");
    
    return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
01 - type: task Something to do
Projects
No open projects
Development

No branches or pull requests

2 participants