ADD mail box for pedal device
This commit is contained in:
@@ -33,22 +33,30 @@ namespace multi_tasking {
|
||||
|
||||
class PedalDevice {
|
||||
public:
|
||||
PedalDevice(Callback<void()> cbOnLeft,
|
||||
Callback<void()> cbOnRight); // NOLINT(runtime/references)
|
||||
explicit PedalDevice(Mail<uint32_t, 16>* mailBox); // NOLINT(runtime/references)
|
||||
|
||||
// make the class non copyable
|
||||
PedalDevice(PedalDevice&) = delete;
|
||||
PedalDevice& operator=(PedalDevice&) = delete;
|
||||
|
||||
// method called for updating the bike system
|
||||
std::chrono::milliseconds getCurrentRotationTime();
|
||||
static std::chrono::milliseconds getCurrentRotationTime(uint32_t step);
|
||||
|
||||
private:
|
||||
// private methods
|
||||
void onLeft();
|
||||
void onRight();
|
||||
void increaseRotationSpeed();
|
||||
void decreaseRotationSpeed();
|
||||
|
||||
void sendMail(uint32_t data);
|
||||
// data members
|
||||
volatile uint32_t _currentStep = static_cast<uint32_t>(
|
||||
(bike_computer::kInitialPedalRotationTime - bike_computer::kMinPedalRotationTime)
|
||||
.count() /
|
||||
bike_computer::kDeltaPedalRotationTime.count());
|
||||
|
||||
Mail<uint32_t, 16>* _mailBox;
|
||||
};
|
||||
|
||||
} // namespace multi_tasking
|
||||
|
||||
Reference in New Issue
Block a user