#include <Adafruit_Floppy.h>
|
| Adafruit_MFM_Floppy (Adafruit_Floppy *floppy, adafruit_floppy_disk_t format=AUTODETECT) |
| Instantiate an MFM-formatted floppy. More...
|
|
bool | begin (void) |
| Initialize and spin up the floppy drive. More...
|
|
void | end (void) |
| Spin down and deselect the motor and drive.
|
|
uint32_t | size (void) const |
| Quick calculator for expected max capacity. More...
|
|
int32_t | readTrack (int track, bool head) |
| Read one track's worth of data and MFM decode it. More...
|
|
uint8_t | sectors_per_track (void) const |
| The expected number of sectors per track in this format. More...
|
|
uint8_t | tracks_per_side (void) const |
| The expected number of tracks per side in this format. More...
|
|
bool | dirty () const |
| Check if there is data to be written to the current track. More...
|
|
void | removed () |
| Call when the media has been removed. More...
|
|
bool | inserted (adafruit_floppy_disk_t format) |
| Call when media has been inserted. More...
|
|
virtual bool | isBusy () |
| Check if device busy. More...
|
|
virtual uint32_t | sectorCount () |
| Max capacity in sector block. More...
|
|
virtual bool | syncDevice () |
| Sync written blocks NOT IMPLEMENTED YET. More...
|
|
virtual bool | readSector (uint32_t block, uint8_t *dst) |
| Read a 512 byte block of data, may used cached data. More...
|
|
virtual bool | readSectors (uint32_t block, uint8_t *dst, size_t ns) |
| Read multiple 512 byte block of data, may used cached data. More...
|
|
virtual bool | writeSector (uint32_t block, const uint8_t *src) |
| Write a 512 byte block of data NOT IMPLEMENTED YET. More...
|
|
virtual bool | writeSectors (uint32_t block, const uint8_t *src, size_t ns) |
| Write multiple 512 byte blocks of data NOT IMPLEMENTED YET. More...
|
|
|
uint8_t | track_data [MFM_IBMPC1440K_SECTORS_PER_TRACK *MFM_BYTES_PER_SECTOR] |
|
uint8_t | track_validity [MFM_IBMPC1440K_SECTORS_PER_TRACK] |
|
This class adds support for the BaseBlockDriver interface to an MFM encoded floppy disk. This allows it to be used with SdFat's FatFileSystem class. or for a mass storage device
◆ Adafruit_MFM_Floppy()
Adafruit_MFM_Floppy::Adafruit_MFM_Floppy |
( |
Adafruit_Floppy * |
floppy, |
|
|
adafruit_floppy_disk_t |
format = AUTODETECT |
|
) |
| |
Instantiate an MFM-formatted floppy.
- Parameters
-
floppy | An Adafruit_Floppy object that has the pins defined |
format | What kind of format we will be parsing out - we DO NOT autodetect! |
◆ begin()
bool Adafruit_MFM_Floppy::begin |
( |
void |
| ) |
|
Initialize and spin up the floppy drive.
- Returns
- True if we were able to spin up and detect an index track
◆ size()
uint32_t Adafruit_MFM_Floppy::size |
( |
void |
| ) |
const |
Quick calculator for expected max capacity.
- Returns
- Size of the drive in bytes
◆ readTrack()
int32_t Adafruit_MFM_Floppy::readTrack |
( |
int |
logical_track, |
|
|
bool |
head |
|
) |
| |
Read one track's worth of data and MFM decode it.
- Parameters
-
logical_track | the logical track number, 0 to whatever is the max tracks for the given format during instantiation (e.g. 40 for DD, 80 for HD) |
head | which side to read, false for side 1, true for side 2 |
- Returns
- Number of sectors captured, or -1 if we couldn't seek
◆ sectors_per_track()
uint8_t Adafruit_MFM_Floppy::sectors_per_track |
( |
void |
| ) |
const |
|
inline |
The expected number of sectors per track in this format.
!
- Returns
- The number of sectors per track
◆ tracks_per_side()
uint8_t Adafruit_MFM_Floppy::tracks_per_side |
( |
void |
| ) |
const |
|
inline |
The expected number of tracks per side in this format.
!
- Returns
- The number of tracks per side
◆ dirty()
bool Adafruit_MFM_Floppy::dirty |
( |
| ) |
const |
|
inline |
Check if there is data to be written to the current track.
!
- Returns
- True if data needs to be written out
◆ removed()
void Adafruit_MFM_Floppy::removed |
( |
| ) |
|
Call when the media has been removed.
!
◆ inserted()
bool Adafruit_MFM_Floppy::inserted |
( |
adafruit_floppy_disk_t |
format | ) |
|
Call when media has been inserted.
!
- Parameters
-
format | The hard coded format or AUTODETECT to try several common formats |
- Returns
- True if media is hard coded or if the media was detected by autodetect
◆ isBusy()
bool Adafruit_MFM_Floppy::isBusy |
( |
| ) |
|
|
virtual |
Check if device busy.
- Returns
- true if busy
◆ sectorCount()
uint32_t Adafruit_MFM_Floppy::sectorCount |
( |
| ) |
|
|
virtual |
Max capacity in sector block.
- Returns
- Size of the drive in sector (512 bytes)
◆ syncDevice()
bool Adafruit_MFM_Floppy::syncDevice |
( |
| ) |
|
|
virtual |
Sync written blocks NOT IMPLEMENTED YET.
- Returns
- True on success, false if failed or unimplemented
◆ readSector()
bool Adafruit_MFM_Floppy::readSector |
( |
uint32_t |
block, |
|
|
uint8_t * |
dst |
|
) |
| |
|
virtual |
Read a 512 byte block of data, may used cached data.
- Parameters
-
block | Block number, will be split into head and track based on expected formatting |
dst | Destination buffer |
- Returns
- True on success
◆ readSectors()
bool Adafruit_MFM_Floppy::readSectors |
( |
uint32_t |
block, |
|
|
uint8_t * |
dst, |
|
|
size_t |
nb |
|
) |
| |
|
virtual |
Read multiple 512 byte block of data, may used cached data.
- Parameters
-
block | Starting block number, will be split into head and track based on expected formatting |
dst | Destination buffer |
nb | Number of blocks to read |
- Returns
- True on success
◆ writeSector()
bool Adafruit_MFM_Floppy::writeSector |
( |
uint32_t |
block, |
|
|
const uint8_t * |
src |
|
) |
| |
|
virtual |
Write a 512 byte block of data NOT IMPLEMENTED YET.
- Parameters
-
block | Block number, will be split into head and track based on expected formatting |
src | Source buffer |
- Returns
- True on success, false if failed or unimplemented
◆ writeSectors()
bool Adafruit_MFM_Floppy::writeSectors |
( |
uint32_t |
block, |
|
|
const uint8_t * |
src, |
|
|
size_t |
nb |
|
) |
| |
|
virtual |
Write multiple 512 byte blocks of data NOT IMPLEMENTED YET.
- Parameters
-
block | Starting lock number, will be split into head and track based on expected formatting |
src | Source buffer |
nb | Number of consecutive blocks to write |
- Returns
- True on success, false if failed or unimplemented
◆ track_data
uint8_t Adafruit_MFM_Floppy::track_data[MFM_IBMPC1440K_SECTORS_PER_TRACK *MFM_BYTES_PER_SECTOR] |
! The raw byte decoded data from the last track read
◆ track_validity
uint8_t Adafruit_MFM_Floppy::track_validity[MFM_IBMPC1440K_SECTORS_PER_TRACK] |
! Which tracks from the last track-read were valid MFM/CRC!
The documentation for this class was generated from the following files: