Skip to content

Commit

Permalink
Move FloppyDrives variables to FloppyDrives namespace to avoid confli…
Browse files Browse the repository at this point in the history
…cts.
  • Loading branch information
Sammy1Am committed May 22, 2018
1 parent 21e3c6b commit 6e96287
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Arduino/Moppy/src/MoppyInstruments/FloppyDrives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ const byte LAST_DRIVE = 8; // This sketch can handle only up to 9 drives (the m
NOTE: Index zero of this array controls the "resetAll" function, and should be the
same as the largest value in this array
*/
unsigned int MAX_POSITION[] = {158,158,158,158,158,158,158,158,158,158};
unsigned int FloppyDrives::MAX_POSITION[] = {158,158,158,158,158,158,158,158,158,158};

//Array to track the current position of each floppy head.
unsigned int currentPosition[] = {0,0,0,0,0,0,0,0,0,0};
unsigned int FloppyDrives::currentPosition[] = {0,0,0,0,0,0,0,0,0,0};

/*Array to keep track of state of each pin. Even indexes track the control-pins for toggle purposes. Odd indexes
track direction-pins. LOW = forward, HIGH=reverse
*/
int currentState[] = {0,0,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW};
int FloppyDrives::currentState[] = {0,0,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW};

// Current period assigned to each drive. 0 = off. Each period is two-ticks (as defined by
// TIMER_RESOLUTION in MoppyInstrument.h) long.
unsigned int currentPeriod[] = {0,0,0,0,0,0,0,0,0,0};
unsigned int FloppyDrives::currentPeriod[] = {0,0,0,0,0,0,0,0,0,0};

// Tracks the current tick-count for each drive (see FloppyDrives::tick() below)
unsigned int currentTick[] = {0,0,0,0,0,0,0,0,0,0};
unsigned int FloppyDrives::currentTick[] = {0,0,0,0,0,0,0,0,0,0};

// The period originally set by incoming messages (prior to any modifications from pitch-bending)
unsigned int originalPeriod[] = {0,0,0,0,0,0,0,0,0,0};
unsigned int FloppyDrives::originalPeriod[] = {0,0,0,0,0,0,0,0,0,0};

void FloppyDrives::setup() {

Expand Down
7 changes: 7 additions & 0 deletions Arduino/Moppy/src/MoppyInstruments/FloppyDrives.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ class FloppyDrives {
static void systemMessage(uint8_t command, uint8_t payload[]);
static void deviceMessage(uint8_t subAddress, uint8_t command, uint8_t payload[]);
protected:
static unsigned int MAX_POSITION[];
static unsigned int currentPosition[];
static int currentState[];
static unsigned int currentPeriod[];
static unsigned int currentTick[];
static unsigned int originalPeriod[];

static void resetAll();
static void togglePin(byte driveNum, byte pin, byte direction_pin);
static void haltAllDrives();
Expand Down

0 comments on commit 6e96287

Please sign in to comment.