Skip to content

Commit 1e86b9c

Browse files
FozzTexxChris Osborn
authored andcommitted
Mostly small changes to get SIO2Arduino working on a Teensy 2.0 with
the Teensy SD Adapter. The only thing really missing on the Teensy was the serialEvent callback so I had to put a check for available data in the loop() function to make it run the callback. I also change the pin assignments to work on the Teensy.
1 parent dd3967c commit 1e86b9c

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

SIO2Arduino.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ void loop() {
130130
mountFilename(0, "AUTORUN.ATR");
131131
}
132132
#endif
133+
134+
#ifdef ARDUINO_TEENSY
135+
if (SIO_UART.available())
136+
SIO_CALLBACK();
137+
#endif
133138
}
134139

135140
void SIO_CALLBACK() {
@@ -341,4 +346,4 @@ boolean mountFilename(int deviceId, char *name) {
341346
}
342347

343348
return false;
344-
}
349+
}

config.h

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,18 @@
3030
// These are the Arduino devices that can be used. I'm sure others would work,
3131
// but these are the only ones I have to test with. Only one of these should
3232
// be uncommented.
33-
#define ARDUINO_UNO // Arduino Uno board
33+
//#define ARDUINO_UNO // Arduino Uno board
3434
//#define ARDUINO_MEGA // Arduino Mega 2560/ADK board
35+
#define ARDUINO_TEENSY // PJRC Teensy 2.0
3536

3637
// Uncomment this line if you are using an LCD display
3738
//#define LCD_DISPLAY
3839

3940
// Uncomment this line if you are using a hardware button for image selection
40-
#define SELECTOR_BUTTON
41+
//#define SELECTOR_BUTTON
4142

4243
// Uncomment this line if you want a reset button (automatically mounts /AUTORUN.ATR)
43-
//#define RESET_BUTTON
44+
#define RESET_BUTTON
4445

4546
// uncomment if using an Ethernet shield for SD capabilities
4647
//#define ETHERNET_SHIELD
@@ -62,7 +63,12 @@
6263
* These are the Arduino pin definitions.
6364
*/
6465

66+
#if defined(ARDUINO_MEGA) || defined(ARDUINO_UNO)
6567
#define PIN_ATARI_CMD 2 // the Atari SIO command line - usually the purple wire on the SIO cable
68+
#endif
69+
#ifdef ARDUINO_TEENSY
70+
#define PIN_ATARI_CMD 4 // the Atari SIO command line - usually the purple wire on the SIO cable
71+
#endif
6672

6773
// for now, you can't change these pin definitions
6874
#ifdef ETHERNET_SHIELD
@@ -73,20 +79,27 @@
7379
#define PIN_SD_DI 51 // the SD breakout board's DI pin
7480
#define PIN_SD_DO 50 // the SD breakout board's DO pin
7581
#define PIN_SD_CLK 52 // the SD breakout board's CLK pin
76-
#else
82+
#endif
83+
#ifdef ARDUINO_UNO
7784
#define PIN_SD_CS 10 // the SD breakout board's CS (chip select) pin
7885
#define PIN_SD_DI 11 // the SD breakout board's DI pin
7986
#define PIN_SD_DO 12 // the SD breakout board's DO pin
8087
#define PIN_SD_CLK 13 // the SD breakout board's CLK pin
8188
#endif
89+
#ifdef ARDUINO_TEENSY
90+
#define PIN_SD_CS 0 // the SD breakout board's CS (chip select) pin
91+
#define PIN_SD_DI 1 // the SD breakout board's DI pin
92+
#define PIN_SD_DO 2 // the SD breakout board's DO pin
93+
#define PIN_SD_CLK 3 // the SD breakout board's CLK pin
94+
#endif
8295
#endif
8396

8497
#ifdef SELECTOR_BUTTON
8598
#define PIN_SELECTOR 3 // the selector button pin
8699
#endif
87100

88101
#ifdef RESET_BUTTON
89-
#define PIN_RESET 3 // the reset button pin
102+
#define PIN_RESET 5 // the reset button pin
90103
#endif
91104

92105
#ifdef LCD_DISPLAY
@@ -108,7 +121,7 @@
108121
#endif
109122

110123
// the hardware UART to use for SIO bus communication
111-
#ifdef ARDUINO_MEGA
124+
#if defined(ARDUINO_MEGA) || defined(ARDUINO_TEENSY)
112125
#define SIO_UART Serial1
113126
#define SIO_CALLBACK serialEvent1
114127
#else
@@ -128,4 +141,4 @@
128141
#define LOG_MSG_CR(...)
129142
#endif
130143

131-
#endif
144+
#endif

0 commit comments

Comments
 (0)