refactor tree, add ecad, mcad

This commit is contained in:
2019-08-28 23:23:48 -07:00
parent d5ddd76bef
commit ae837eef12
45 changed files with 4629 additions and 169 deletions

View File

@@ -28,7 +28,7 @@
#include "Drivers/LowPower.h"
#include "Drivers/RtcDriver.h"
namespace Common {
namespace BSP {
namespace Schedule {
template <uint32_t MAX_TASKS>
@@ -100,13 +100,13 @@ private:
void inline cycle()
{
Common::time_t time = 0;
BSP::time_t time = 0;
BSP::SystemTimer::get_time(time);
bool task_died = false;
/* Keep state for when the next task will execute. */
bool execed = false;
Common::time_t next_time = ~0;
BSP::time_t next_time = ~0;
for (size_t i = 0; i < m_task_count; i++) {
TaskEvent &event = m_tasks[i];
@@ -128,13 +128,13 @@ private:
}
if (m_task_count == 0) {
Common::ReturnCode rc = BSP::RtcDriver::set_wakeup_in(Time::seconds(5));
if (rc == Common::ReturnCode::OK) {
BSP::ReturnCode rc = BSP::RtcDriver::set_wakeup_in(Time::seconds(5));
if (rc == BSP::ReturnCode::OK) {
BSP::LowPower::stop();
}
} else if (!execed && (next_time - time > Time::millis(2))) {
Common::ReturnCode rc = BSP::RtcDriver::set_wakeup_in(next_time - time);
if (rc == Common::ReturnCode::OK) {
BSP::ReturnCode rc = BSP::RtcDriver::set_wakeup_in(next_time - time);
if (rc == BSP::ReturnCode::OK) {
BSP::LowPower::stop();
}
}