Adafruit Library
|
A helper class for chattin with PC & Shugart floppy drives. More...
#include <Adafruit_Floppy.h>
Public Member Functions | |
Adafruit_Floppy (int8_t densitypin, int8_t indexpin, int8_t selectpin, int8_t motorpin, int8_t directionpin, int8_t steppin, int8_t wrdatapin, int8_t wrgatepin, int8_t track0pin, int8_t protectpin, int8_t rddatapin, int8_t sidepin, int8_t readypin) | |
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 |
Set back the object and pins to initial state. | |
void | select (bool selected) override |
Whether to select this drive. More... | |
bool | spin_motor (bool motor_on) override |
Turn on or off the floppy motor, if on we wait till we get an 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... | |
int | get_side (void) override |
Current head in use, based on internal caching. More... | |
void | step (bool dir, uint8_t times) |
Step the track motor. More... | |
bool | set_density (bool high_density) override |
Set the density for flux reading and writing. More... | |
bool | get_write_protect () override |
Check whether the floppy in the drive is write protected. 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... | |
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 PC & Shugart floppy drives.
Adafruit_Floppy::Adafruit_Floppy | ( | int8_t | densitypin, |
int8_t | indexpin, | ||
int8_t | selectpin, | ||
int8_t | motorpin, | ||
int8_t | directionpin, | ||
int8_t | steppin, | ||
int8_t | wrdatapin, | ||
int8_t | wrgatepin, | ||
int8_t | track0pin, | ||
int8_t | protectpin, | ||
int8_t | rddatapin, | ||
int8_t | sidepin, | ||
int8_t | readypin | ||
) |
Create a hardware interface to a floppy drive.
densitypin | A pin connected to the floppy Density Select input |
indexpin | A pin connected to the floppy Index Sensor output |
selectpin | A pin connected to the floppy Drive Select input |
motorpin | A pin connected to the floppy Motor Enable input |
directionpin | A pin connected to the floppy Stepper Direction input |
steppin | A pin connected to the floppy Stepper input |
wrdatapin | A pin connected to the floppy Write Data input |
wrgatepin | A pin connected to the floppy Write Gate input |
track0pin | A pin connected to the floppy Track 00 Sensor output |
protectpin | A pin connected to the floppy Write Protect Sensor output |
rddatapin | A pin connected to the floppy Read Data output |
sidepin | A pin connected to the floppy Side Select input |
readypin | A pin connected to the floppy Ready/Disk Change output |
|
overridevirtual |
Whether to select this drive.
selected | True to select/enable |
Implements Adafruit_FloppyBase.
|
overridevirtual |
Turn on or off the floppy motor, if on we wait till we get an index pulse!
motor_on | True to turn on motor, False to turn it off |
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 0 or 1 |
Implements Adafruit_FloppyBase.
|
overridevirtual |
The current track location, based on internal caching.
Implements Adafruit_FloppyBase.
|
overridevirtual |
void Adafruit_Floppy::step | ( | bool | dir, |
uint8_t | times | ||
) |
Step the track motor.
dir | STEP_OUT or STEP_IN depending on desired direction |
times | How many steps to take |
|
overridevirtual |
Set the density for flux reading and writing.
high_density | false for low density, true for high density |
Implements Adafruit_FloppyBase.
|
overridevirtual |
Check whether the floppy in the drive is write protected.
Implements Adafruit_FloppyBase.
|
overridevirtual |
Check whether the track0 sensor is active.
Implements Adafruit_FloppyBase.
|
overridevirtual |
Check whether the ready output is active.
Implements Adafruit_FloppyBase.