-
Notifications
You must be signed in to change notification settings - Fork 17.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f9aefb
commit 097b82f
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "Task.h" | ||
#include <AP_HAL/AP_HAL.h> | ||
|
||
extern const AP_HAL::HAL &hal; | ||
|
||
namespace Linux { | ||
|
||
bool Task::_run() | ||
{ | ||
while (true) { | ||
const uint32_t delay_us = task.update(); | ||
hal.scheduler->delay_microseconds(delay_us); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "Thread.h" | ||
|
||
#include <AP_HAL/Scheduler.h> | ||
|
||
namespace Linux { | ||
class Task : public Thread { | ||
public: | ||
|
||
Task(AP_HAL::Scheduler::Task &new_task) : | ||
Thread(nullptr), // this passed-in task_t not called | ||
task{new_task} | ||
{ } | ||
|
||
protected: | ||
|
||
bool _run() override; | ||
|
||
private: | ||
AP_HAL::Scheduler::Task &task; | ||
|
||
}; | ||
} |