1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-08-20 13:29:27 +00:00

Started fleshing this out a bit. Hopefully.

This commit is contained in:
Thomas Harte 2016-07-15 08:28:34 -04:00
parent 0aa90b943b
commit 165dbd9651
2 changed files with 26 additions and 3 deletions

View File

@ -7,3 +7,14 @@
// //
#include "DiskDrive.hpp" #include "DiskDrive.hpp"
using namespace Storage;
DiskDrive::DiskDrive(unsigned int clock_rate, unsigned int revolutions_per_minute) :
_clock_rate(clock_rate),
_revolutions_per_minute(revolutions_per_minute) {}
void DiskDrive::set_expected_bit_length(Time bit_length)
{
_bit_length = bit_length;
}

View File

@ -10,12 +10,15 @@
#define DiskDrive_hpp #define DiskDrive_hpp
#include "Disk.hpp" #include "Disk.hpp"
#include "DigitalPhaseLockedLoop.hpp"
namespace Storage { namespace Storage {
class DiskDrive { class DiskDrive: public DigitalPhaseLockedLoop::Delegate {
public: public:
DiskDrive(unsigned int clock_rate); DiskDrive(unsigned int clock_rate, unsigned int revolutions_per_minute);
void set_expected_bit_length(Time bit_length);
void set_disk(std::shared_ptr<Disk> disk); void set_disk(std::shared_ptr<Disk> disk);
bool has_disk(); bool has_disk();
@ -26,8 +29,17 @@ class DiskDrive {
void step(int direction); void step(int direction);
void set_motor_on(bool motor_on); void set_motor_on(bool motor_on);
// to satisfy DigitalPhaseLockedLoop::Delegate
void digital_phase_locked_loop_output_bit(int value);
protected: protected:
virtual void process_input_event(Track::Event event) = 0; virtual void process_input_bit(int value, unsigned int cycles_since_index_hole) = 0;
virtual void process_index_hole() = 0;
private:
Time _bit_length;
unsigned int _clock_rate;
unsigned int _revolutions_per_minute;
}; };
} }