mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-19 23:32:28 +00:00
Extends Drive to report is_writing and so that writing works as the first action.
This commit is contained in:
parent
2c39229b13
commit
5b05a9bc61
@ -311,6 +311,15 @@ void Drive::invalidate_track() {
|
||||
// MARK: - Writing
|
||||
|
||||
void Drive::begin_writing(Time bit_length, bool clamp_to_index_hole) {
|
||||
// Do nothing if already writing.
|
||||
if(!is_reading_) return;
|
||||
|
||||
// Get a copy of the track if that hasn't happened yet.
|
||||
if(!track_) {
|
||||
setup_track();
|
||||
}
|
||||
|
||||
// Store the relevant parameters, and kick off writing.
|
||||
is_reading_ = false;
|
||||
clamp_writing_to_index_hole_ = clamp_to_index_hole;
|
||||
|
||||
@ -350,6 +359,10 @@ void Drive::end_writing() {
|
||||
}
|
||||
}
|
||||
|
||||
bool Drive::is_writing() {
|
||||
return !is_reading_;
|
||||
}
|
||||
|
||||
void Drive::set_activity_observer(Activity::Observer *observer, const std::string &name, bool add_motor_led) {
|
||||
observer_ = observer;
|
||||
announce_motor_led_ = add_motor_led;
|
||||
|
@ -100,6 +100,12 @@ class Drive: public ClockingHint::Source, public TimedEventLoop {
|
||||
*/
|
||||
void end_writing();
|
||||
|
||||
/*!
|
||||
@returns @c true if the drive has received a call to begin_writing but not yet a call to
|
||||
end_writing; @c false otherwise.
|
||||
*/
|
||||
bool is_writing();
|
||||
|
||||
/*!
|
||||
Advances the drive by @c number_of_cycles cycles.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user