Permalink
Browse files

Arduino 1.0 compliant

  • Loading branch information...
1 parent d85a97e commit 6f27d627507440f60b4462f496ad9cdb017d7571 @PaintYourDragon PaintYourDragon committed Dec 3, 2011
Showing with 24 additions and 1 deletion.
  1. +12 −1 SPI_VFD.cpp
  2. +4 −0 SPI_VFD.h
  3. +4 −0 examples/TextDirection/TextDirection.pde
  4. +4 −0 examples/setCursor/setCursor.pde
View
@@ -3,7 +3,11 @@
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
-#include "WProgram.h"
+#if ARDUINO >= 100
+ #include "Arduino.h"
+#else
+ #include "WProgram.h"
+#endif
// When the display powers up, it is configured as follows:
//
@@ -197,7 +201,11 @@ void SPI_VFD::command(uint8_t value) {
*/
}
+#if ARDUINO >= 100
+size_t SPI_VFD::write(uint8_t value) {
+#else
void SPI_VFD::write(uint8_t value) {
+#endif
digitalWrite(_strobe, LOW);
send(VFD_SPIDATA);
send(value);
@@ -208,6 +216,9 @@ void SPI_VFD::write(uint8_t value) {
Serial.print('\t');
Serial.println(value, HEX);
*/
+#if ARDUINO >= 100
+ return 1;
+#endif
}
/************ low level data pushing commands **********/
View
@@ -72,7 +72,11 @@ class SPI_VFD : public Print {
void createChar(uint8_t, uint8_t[]);
void setCursor(uint8_t, uint8_t);
+#if ARDUINO >= 100
+ virtual size_t write(uint8_t);
+#else
virtual void write(uint8_t);
+#endif
void command(uint8_t);
private:
inline void send(uint8_t data);
@@ -63,7 +63,11 @@ void loop() {
thisChar = 'a';
}
// print the character
+#if ARDUINO >= 100
+ vfd.write(thisChar);
+#else
vfd.print(thisChar, BYTE);
+#endif
// wait a second:
delay(1000);
// increment the letter:
@@ -54,7 +54,11 @@ void loop() {
// set the cursor position:
vfd.setCursor(thisRow,thisCol);
// print the letter:
+#if ARDUINO >= 100
+ vfd.write(thisLetter);
+#else
vfd.print(thisLetter, BYTE);
+#endif
delay(200);
}
}

0 comments on commit 6f27d62

Please sign in to comment.