ADD gear event driven
This commit is contained in:
@@ -67,7 +67,10 @@ class BikeSystem {
|
||||
// private methods
|
||||
void init();
|
||||
void onReset();
|
||||
void gearTask();
|
||||
void onGearUp();
|
||||
void onGearDown();
|
||||
void gearUpTask();
|
||||
void gearDownTask();
|
||||
void speedDistanceTask();
|
||||
void temperatureTask();
|
||||
void resetTask();
|
||||
@@ -75,13 +78,23 @@ class BikeSystem {
|
||||
void displayTask2();
|
||||
void cpuTask();
|
||||
|
||||
uint8_t getCurrentGear();
|
||||
uint8_t getCurrentGearSize();
|
||||
void setCurrentGear(uint8_t gear);
|
||||
|
||||
// timer instance used for loggint task time and used by ResetDevice
|
||||
std::chrono::microseconds _resetTime = std::chrono::microseconds::zero();
|
||||
std::chrono::microseconds _resetTime = std::chrono::microseconds::zero();
|
||||
std::chrono::microseconds _onGearUpTime = std::chrono::microseconds::zero();
|
||||
std::chrono::microseconds _onGearDownTime = std::chrono::microseconds::zero();
|
||||
|
||||
Timer _timer;
|
||||
// data member that represents the device for manipulating the gear
|
||||
GearDevice _gearDevice;
|
||||
//////////////////////////////////////////////////////////////
|
||||
// shared resources between the main thread and the isr thread
|
||||
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;
|
||||
@@ -107,9 +120,12 @@ class BikeSystem {
|
||||
EventQueue _isrEventQueue;
|
||||
EventQueue _eventQueue;
|
||||
|
||||
// mutex for shared resource
|
||||
Mutex mutexGearSize;
|
||||
Mutex mutexGear;
|
||||
|
||||
// Tread for isr events
|
||||
Thread _isrEventThread;
|
||||
Thread _mainEventThread;
|
||||
|
||||
void dispatch_isr_events();
|
||||
void dispatch_events();
|
||||
|
||||
Reference in New Issue
Block a user