Skip to content

Commit 6b7f94c

Browse files
author
John Cook
committed
Updated SdCard to version 2
1 parent 27fdab9 commit 6b7f94c

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

SIO2Arduino.ino

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void changeDirectory(int ix);
4646
DriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format);
4747
DriveControl driveControl(getFileList, mountFileIndex, changeDirectory);
4848
SIOChannel sioChannel(PIN_ATARI_CMD, &SIO_UART, &driveAccess, &driveControl);
49-
Sd2Card card;
49+
SdFat32 card;
5050
SdFile currDir;
5151
SdFile file; // TODO: make this unnecessary
5252
DiskDrive drive1;
@@ -63,10 +63,17 @@ LiquidCrystal lcd(PIN_LCD_RD,PIN_LCD_ENABLE,PIN_LCD_DB4,PIN_LCD_DB5,PIN_LCD_DB6,
6363
#endif
6464

6565
void setup() {
66-
#ifdef DEBUG
67-
// set up logging serial port
68-
LOGGING_UART.begin(115200);
69-
#endif
66+
#ifdef DEBUG
67+
// set up logging serial port
68+
LOGGING_UART.begin(115200);
69+
while (!LOGGING_UART) {
70+
yield();
71+
}
72+
LOG_MSG_CR(F("Debug logging enabled"));
73+
#ifdef ARDUINO_UNO
74+
LOG_MSG_CR(F("WARNING: using debug logging with Uno, which only has 1 UART - SIO will conflict"));
75+
#endif
76+
#endif
7077

7178
// initialize serial port to Atari
7279
SIO_UART.begin(19200);
@@ -190,18 +197,18 @@ boolean format(int deviceId, int density) {
190197
}
191198

192199
void changeDisk(int deviceId) {
193-
dir_t dir;
200+
DirFat_t dir;
194201
char name[13];
195202
boolean imageChanged = false;
196203

197204
while (!imageChanged) {
198205
// get next dir entry
199-
int8_t result = currDir.readDir((dir_t*)&dir);
206+
int8_t result = currDir.readDir((DirFat_t*)&dir);
200207

201208
// if we got back a 0, rewind the directory and get the first dir entry
202209
if (!result) {
203210
currDir.rewind();
204-
result = currDir.readDir((dir_t*)&dir);
211+
result = currDir.readDir((DirFat_t*)&dir);
205212
}
206213

207214
// if we have a valid file response code, open it
@@ -253,20 +260,20 @@ void createFilename(char* filename, char* name) {
253260
* entries = a pointer to the a FileEntry array to hold the returned data
254261
*/
255262
int getFileList(int startIndex, int count, FileEntry *entries) {
256-
dir_t dir;
263+
DirFat_t dir;
257264
int currentEntry = 0;
258265

259266
currDir.rewind();
260267

261268
int ix = 0;
262269
while (ix < count) {
263-
if (currDir.readDir((dir_t*)&dir) < 1) {
270+
if (currDir.readDir((DirFat_t*)&dir) < 1) {
264271
break;
265272
}
266-
if (isValidFilename((char*)&dir.name) || (DIR_IS_SUBDIR(&dir) && dir.name[0] != '.')) {
273+
if (isValidFilename((char*)&dir.name) || (isSubdir(&dir) && dir.name[0] != '.')) {
267274
if (currentEntry >= startIndex) {
268275
memcpy(entries[ix].name, dir.name, 11);
269-
if (DIR_IS_SUBDIR(&dir)) {
276+
if (isSubdir(&dir)) {
270277
entries[ix].isDirectory = true;
271278
} else {
272279
entries[ix].isDirectory = false;

config.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#ifndef CONFIG_H
2424
#define CONFIG_H
2525

26-
#define USE_SD_VOLUME
2726
/**
2827
* These are SIO2Arduino feature definitions.
2928
*/

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
SIO2Arduino is an open-source implementation of the Atari SIO device protocol that runs on Arduino hardware. Arduino hardware is open-source and can be assembled by hand or purchased preassembled.
22

33
Note: You will need the SdFat library (https://github.com/greiman/SdFat) in your Arduino libraries directory in order to compile.
4+
This has been tested using SdFat version 2.1.2.
45

56
For more information on SIO2Arduino, see the website at:
67
http://www.whizzosoftware.com/sio2arduino

0 commit comments

Comments
 (0)