TaskManagerIO
Loading...
Searching...
No Matches
MockTaskManager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 https://www.thecoderscorner.com (Dave Cherry)..
3 * This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
4 */
5
6#ifndef MOCKED_TASK_MANAGER_H
7#define MOCKED_TASK_MANAGER_H
8
14
15#include "TaskManager.h"
16
22class SimulatedTaskManager : public TaskManager {
23private:
24 uint32_t yieldTimes[10]{};
25 uint8_t numOfYields{};
26public:
27 SimulatedTaskManager() {
28 reset();
29 }
30
31 void reset() {
32 numOfYields = 0;
34 }
35
36 void yieldForMicros(uint32_t micros) override {
37 if(numOfYields >= 10) return;
38 yieldTimes[numOfYields++] = micros;
39 }
40
41 int getNumberOfYieldCalls() {return numOfYields;}
42 uint32_t getYieldTime(int i) {return yieldTimes[i];}
43 int getMaxTaskNo() {return taskBlocks[numberOfBlocks - 1]->lastSlot();}
44 InterruptFn getInterruptFunction() {return interruptCallback;}
45};
46
47#endif // MOCKED_TASK_MANAGER_H
void(* InterruptFn)(pintype_t pin)
Definition TaskManagerIO.h:50
uint32_t micros()
void yieldForMicros(uint32_t micros) override
Definition MockTaskManager.h:36
void reset()
Definition TaskManagerIO.h:340
TaskManager()
Definition TaskManagerIO.cpp:70