Adafruit Library
|
A helper class for chattin with Apple 2 floppy drives. More...
#include <Adafruit_Floppy.h>
Public Types | |
enum | StepMode { STEP_MODE_WHOLE, STEP_MODE_HALF, STEP_MODE_QUARTER } |
Constants for use with the step_mode method. | |
Public Member Functions | |
Adafruit_Apple2Floppy (int8_t indexpin, int8_t selectpin, int8_t phase1pin, int8_t phase2pin, int8_t phase3pin, int8_t phase4pin, int8_t wrdatapin, int8_t wrgatepin, int8_t protectpin, int8_t rddatapin) | |
Create a hardware interface to a floppy drive. More... | |
void | end () override |
Disables floppy communication, allowing pins to be used for general input and output. | |
void | soft_reset (void) override |
Initializes the GPIO pins but do not start the motor or anything. | |
void | select (bool selected) override |
Whether to select this drive. More... | |
bool | spin_motor (bool motor_on) override |
Wait for index pulse. More... | |
bool | goto_track (int track) override |
Seek to the desired track, requires the motor to be spun up! More... | |
bool | side (int head) override |
Which head/side to read from. More... | |
int | track (void) override |
The current track location, based on internal caching. More... | |
bool | set_density (bool high_density) override |
Set the density for flux reading and writing. More... | |
bool | get_write_protect () override |
Check the write protect status of the floppy. More... | |
bool | get_track0_sense () override |
Check whether the track0 sensor is active. More... | |
bool | get_ready_sense () override |
Check whether the ready output is active. More... | |
int | quartertrack () |
Get the drive position in quarter tracks. More... | |
bool | goto_quartertrack (int) |
Seek to the desired quarter track, requires the motor to be spun up! More... | |
void | step_mode (StepMode mode) |
Set the positioning mode. More... | |
int | get_side () override |
Current head in use, based on internal caching. More... | |
Public Member Functions inherited from Adafruit_FloppyBase | |
bool | begin (void) |
Initializes the GPIO pins but do not start the motor or anything. More... | |
size_t | decode_track_mfm (uint8_t *sectors, size_t n_sectors, uint8_t *sector_validity, const uint8_t *pulses, size_t n_pulses, float nominal_bit_time_us, bool clear_validity=false, uint8_t *logical_track=nullptr) |
Decode one track of previously captured MFM data. More... | |
size_t | encode_track_mfm (const uint8_t *sectors, size_t n_sectors, uint8_t *pulses, size_t max_pulses, float nominal_bit_time_us, uint8_t logical_track) |
Encode one track of previously captured MFM data. More... | |
size_t | capture_track (volatile uint8_t *pulses, size_t max_pulses, int32_t *falling_index_offset, bool store_greaseweazle=false, uint32_t capture_ms=0, uint32_t index_wait_ms=250) __attribute__((optimize("O3"))) |
Capture one track's worth of flux transitions, between two falling index pulses. More... | |
bool | write_track (uint8_t *pulses, size_t n_pulses, bool store_greaseweazle=false, bool use_index=true) __attribute__((optimize("O3"))) |
Write one track of flux pulse data, starting at the index pulse. More... | |
void | print_pulse_bins (uint8_t *pulses, size_t n_pulses, uint8_t max_bins=64, bool is_gw_format=false, uint32_t min_bin_size=100) |
Pretty print a simple histogram of flux transitions. More... | |
void | print_pulses (uint8_t *pulses, size_t n_pulses, bool is_gw_format=false) |
Pretty print the counts in a list of flux transitions. More... | |
uint32_t | getSampleFrequency (void) |
Get the sample rate that we read and emit pulses at, platform and implementation-dependant. More... | |
Additional Inherited Members | |
Public Attributes inherited from Adafruit_FloppyBase | |
int8_t | led_pin = -1 |
Debug LED output for tracing. | |
uint16_t | select_delay_us = 10 |
delay after drive select (usecs) | |
uint16_t | step_delay_us = 10000 |
delay between head steps (usecs) | |
uint16_t | settle_delay_ms = 15 |
settle delay after seek (msecs) | |
uint16_t | motor_delay_ms = 1000 |
delay after motor on (msecs) | |
uint16_t | watchdog_delay_ms |
quiescent time until drives reset (msecs) More... | |
uint8_t | bus_type = BUSTYPE_IBMPC |
what kind of floppy drive we're using | |
Stream * | debug_serial = nullptr |
optional debug stream for serial output | |
Protected Member Functions inherited from Adafruit_FloppyBase | |
Adafruit_FloppyBase (int indexpin, int wrdatapin, int wrgatepin, int rddatapin, bool is_apple2=false) | |
Create a hardware interface to a floppy drive. More... | |
bool | read_index () |
Poll the status of the index pulse. More... | |
A helper class for chattin with Apple 2 floppy drives.
Adafruit_Apple2Floppy::Adafruit_Apple2Floppy | ( | int8_t | indexpin, |
int8_t | selectpin, | ||
int8_t | phase1pin, | ||
int8_t | phase2pin, | ||
int8_t | phase3pin, | ||
int8_t | phase4pin, | ||
int8_t | wrdatapin, | ||
int8_t | wrgatepin, | ||
int8_t | protectpin, | ||
int8_t | rddatapin | ||
) |
Create a hardware interface to a floppy drive.
indexpin | A pin connected to the floppy Index Sensor output |
selectpin | A pin connected to the floppy Drive Select input |
phase1pin | A pin connected to the floppy "phase 1" output |
phase2pin | A pin connected to the floppy "phase 2" output |
phase3pin | A pin connected to the floppy "phase 3" output |
phase4pin | A pin connected to the floppy "phase 4" output |
wrdatapin | A pin connected to the floppy Write Data input |
wrgatepin | A pin connected to the floppy Write Gate input |
protectpin | A pin connected to the floppy Write Protect Sensor output |
rddatapin | A pin connected to the floppy Read Data output |
|
overridevirtual |
Whether to select this drive.
selected | True to select/enable |
Implements Adafruit_FloppyBase.
|
overridevirtual |
Wait for index pulse.
motor_on | True to wait for index pulse, false to do nothing |
Implements Adafruit_FloppyBase.
|
overridevirtual |
Seek to the desired track, requires the motor to be spun up!
track_num | The track to step to |
Implements Adafruit_FloppyBase.
|
overridevirtual |
Which head/side to read from.
head | Head must be 0 |
Implements Adafruit_FloppyBase.
|
overridevirtual |
The current track location, based on internal caching.
Implements Adafruit_FloppyBase.
|
overridevirtual |
Set the density for flux reading and writing.
high_density | true to select high density, false to select low density. |
Implements Adafruit_FloppyBase.
|
overridevirtual |
Check the write protect status of the floppy.
If_protectpin is -1 (not available), then we always report that the disk is write protected.
Implements Adafruit_FloppyBase.
|
overridevirtual |
Check whether the track0 sensor is active.
Implements Adafruit_FloppyBase.
|
inlineoverridevirtual |
Check whether the ready output is active.
Implements Adafruit_FloppyBase.
int Adafruit_Apple2Floppy::quartertrack | ( | ) |
Get the drive position in quarter tracks.
bool Adafruit_Apple2Floppy::goto_quartertrack | ( | int | quartertrack | ) |
Seek to the desired quarter track, requires the motor to be spun up!
quartertrack | The position to step to |
void Adafruit_Apple2Floppy::step_mode | ( | StepMode | step_mode | ) |
Set the positioning mode.
step_mode | The new positioning mode |
|
inlineoverridevirtual |