ADD gear event driven

This commit is contained in:
fastium
2024-12-31 13:47:36 +01:00
parent 34a57162ba
commit f64b8bdd9a
4 changed files with 107 additions and 53 deletions

View File

@@ -26,29 +26,20 @@
#pragma once
#include "constants.hpp"
#include "mbed.h"
namespace multi_tasking {
class GearDevice {
public:
GearDevice(); // NOLINT(runtime/references)
GearDevice(Callback<void()> cbOnUp,
Callback<void()> cbOnDown); // NOLINT(runtime/references)
// make the class non copyable
GearDevice(GearDevice&) = delete;
GearDevice& operator=(GearDevice&) = delete;
// method called for updating the bike system
uint8_t getCurrentGear();
uint8_t getCurrentGearSize() const;
void onUp();
void onDown();
private:
// data members
volatile uint8_t _currentGear = bike_computer::kMinGear;
};
} // namespace multi_tasking