ADD mail box for gear device

This commit is contained in:
fastium
2025-01-03 20:22:23 +01:00
parent 62fd302d84
commit 4fb09c690c
4 changed files with 99 additions and 76 deletions

View File

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