1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Adds tape motor LED.

This commit is contained in:
Thomas Harte 2021-03-12 23:09:51 -05:00
parent 54e2eb0948
commit d368dae94a
3 changed files with 19 additions and 0 deletions

View File

@ -1167,6 +1167,7 @@ template <bool has_fdc> class ConcreteMachine:
// MARK: - Activity Source // MARK: - Activity Source
void set_activity_observer([[maybe_unused]] Activity::Observer *observer) final { void set_activity_observer([[maybe_unused]] Activity::Observer *observer) final {
if constexpr (has_fdc) fdc_.set_activity_observer(observer); if constexpr (has_fdc) fdc_.set_activity_observer(observer);
tape_player_.set_activity_observer(observer);
} }
// MARK: - Configuration options. // MARK: - Configuration options.

View File

@ -135,6 +135,18 @@ void BinaryTapePlayer::set_motor_control(bool enabled) {
if(motor_is_running_ != enabled) { if(motor_is_running_ != enabled) {
motor_is_running_ = enabled; motor_is_running_ = enabled;
update_clocking_observer(); update_clocking_observer();
if(observer_) {
observer_->set_led_status("Tape motor", enabled);
}
}
}
void BinaryTapePlayer::set_activity_observer(Activity::Observer *observer) {
observer_ = observer;
if(observer) {
observer->register_led("Tape motor");
observer_->set_led_status("Tape motor", motor_is_running_);
} }
} }

View File

@ -16,6 +16,8 @@
#include "../TimedEventLoop.hpp" #include "../TimedEventLoop.hpp"
#include "../../Activity/Source.hpp"
namespace Storage { namespace Storage {
namespace Tape { namespace Tape {
@ -151,11 +153,15 @@ class BinaryTapePlayer : public TapePlayer {
ClockingHint::Preference preferred_clocking() const final; ClockingHint::Preference preferred_clocking() const final;
void set_activity_observer(Activity::Observer *observer);
protected: protected:
Delegate *delegate_ = nullptr; Delegate *delegate_ = nullptr;
void process_input_pulse(const Storage::Tape::Tape::Pulse &pulse) final; void process_input_pulse(const Storage::Tape::Tape::Pulse &pulse) final;
bool input_level_ = false; bool input_level_ = false;
bool motor_is_running_ = false; bool motor_is_running_ = false;
Activity::Observer *observer_ = nullptr;
}; };
} }