Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Arduino 1.0 compatibility #4

Merged
merged 1 commit into from Jun 13, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions Max3421e.h
Expand Up @@ -3,10 +3,12 @@
#ifndef _MAX3421E_H_ #ifndef _MAX3421E_H_
#define _MAX3421E_H_ #define _MAX3421E_H_



// Arduino 1.0 compatibility
//#include <Spi.h> #if defined(ARDUINO) && ARDUINO >= 100
//#include <WProgram.h> #include <Arduino.h>
#include "WProgram.h" #else
#include <WProgram.h>
#endif
#include "Max3421e_constants.h" #include "Max3421e_constants.h"


class MAX3421E /* : public SPI */ { class MAX3421E /* : public SPI */ {
Expand Down
12 changes: 11 additions & 1 deletion Max_LCD.cpp
Expand Up @@ -7,7 +7,12 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#include "WProgram.h" // Arduino 1.0 compatibility
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif


// When the display powers up, it is configured as follows: // When the display powers up, it is configured as follows:
// //
Expand Down Expand Up @@ -226,7 +231,12 @@ inline void Max_LCD::command(uint8_t value) {
delayMicroseconds(100); delayMicroseconds(100);
} }


// Arduino 1.0 compatibility
#if defined(ARDUINO) && ARDUINO >= 100
inline size_t Max_LCD::write(uint8_t value) {
#else
inline void Max_LCD::write(uint8_t value) { inline void Max_LCD::write(uint8_t value) {
#endif
LCD_sendchar(value); LCD_sendchar(value);
} }


Expand Down
7 changes: 6 additions & 1 deletion Max_LCD.h
Expand Up @@ -70,7 +70,12 @@ class Max_LCD : public Print {
void noAutoscroll(); void noAutoscroll();
void createChar(uint8_t, uint8_t[]); void createChar(uint8_t, uint8_t[]);
void setCursor(uint8_t, uint8_t); void setCursor(uint8_t, uint8_t);
// Arduino 1.0 compatibility
#if defined(ARDUINO) && ARDUINO >= 100
virtual size_t write(uint8_t);
#else
virtual void write(uint8_t); virtual void write(uint8_t);
#endif
void command(uint8_t); void command(uint8_t);
private: private:
void sendbyte( uint8_t val ); void sendbyte( uint8_t val );
Expand All @@ -84,4 +89,4 @@ class Max_LCD : public Print {






#endif #endif