ADD threads dispatcher and drive reset with event
This commit is contained in:
@@ -26,9 +26,10 @@
|
||||
|
||||
// from advembsof
|
||||
#include "EventQueue.h"
|
||||
#include "display_device.hpp"
|
||||
#include "task_logger.hpp"
|
||||
#include "cpu_logger.hpp"
|
||||
#include "display_device.hpp"
|
||||
#include "mbed.h"
|
||||
#include "task_logger.hpp"
|
||||
|
||||
// from common
|
||||
#include "sensor_device.hpp"
|
||||
@@ -75,22 +76,16 @@ class BikeSystem {
|
||||
void displayTask2();
|
||||
void cpuTask();
|
||||
|
||||
// stop flag, used for stopping the super-loop (set in stop())
|
||||
bool _stopFlag = false;
|
||||
|
||||
std::chrono::microseconds _resetTime = std::chrono::microseconds::zero();
|
||||
volatile bool _resetFlag = false;
|
||||
|
||||
// timer instance used for loggint task time and used by ResetDevice
|
||||
Timer _timer;
|
||||
// data member that represents the device for manipulating the gear
|
||||
GearDevice _gearDevice;
|
||||
uint8_t _currentGear = bike_computer::kMinGear;
|
||||
uint8_t _currentGear = bike_computer::kMinGear;
|
||||
uint8_t _currentGearSize = bike_computer::kMinGearSize;
|
||||
// data member that represents the device for manipulating the pedal rotation
|
||||
// speed/time
|
||||
PedalDevice _pedalDevice;
|
||||
float _currentSpeed = 0.0f;
|
||||
float _currentSpeed = 0.0f;
|
||||
float _traveledDistance = 0.0f;
|
||||
// data member that represents the device used for resetting
|
||||
ResetDevice _resetDevice;
|
||||
@@ -109,7 +104,15 @@ class BikeSystem {
|
||||
advembsof::CPULogger _cpuLogger;
|
||||
|
||||
// Event queues
|
||||
EventQueue * _isrEventQueue;
|
||||
EventQueue _isrEventQueue;
|
||||
EventQueue _eventQueue;
|
||||
|
||||
// Tread for isr events
|
||||
Thread _isrEventThread;
|
||||
Thread _mainEventThread;
|
||||
|
||||
void dispatch_isr_events();
|
||||
void dispatch_events();
|
||||
};
|
||||
|
||||
} // namespace static_scheduling
|
||||
} // namespace multi_tasking
|
||||
|
||||
Reference in New Issue
Block a user