Created
June 3, 2013 06:29
-
-
Save lolsborn/5696407 to your computer and use it in GitHub Desktop.
Maple OneWire Diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/OneWire.cpp b/OneWire.cpp | |
index 631813f..01b901d 100644 | |
--- a/OneWire.cpp | |
+++ b/OneWire.cpp | |
@@ -120,8 +120,8 @@ sample code bearing this copyright. | |
OneWire::OneWire(uint8_t pin) | |
{ | |
pinMode(pin, INPUT); | |
- bitmask = PIN_TO_BITMASK(pin); | |
- baseReg = PIN_TO_BASEREG(pin); | |
+ bitmask = pin; | |
+ //baseReg = PIN_TO_BASEREG(pin); | |
#if ONEWIRE_SEARCH | |
reset_search(); | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/OneWire.h b/OneWire.h | |
index 916c529..ac7606d 100644 | |
--- a/OneWire.h | |
+++ b/OneWire.h | |
@@ -3,7 +3,10 @@ | |
#include <inttypes.h> | |
-#if ARDUINO >= 100 | |
+ | |
+#ifdef MAPLE_IDE | |
+#include "Wire.h" | |
+#elif ARDUINO >= 100 | |
#include "Arduino.h" // for delayMicroseconds, digitalPinToBitMask, etc | |
#else | |
#include "WProgram.h" // for delayMicroseconds | |
@@ -104,6 +107,23 @@ | |
#define DIRECT_WRITE_LOW(base, mask) ((*(base+8+1)) = (mask)) //LATXCLR + 0x24 | |
#define DIRECT_WRITE_HIGH(base, mask) ((*(base+8+2)) = (mask)) //LATXSET + 0x28 | |
+#elif defined(BOARD_maple) | |
+#define PIN_TO_BASEREG(pin) ((IO_REG_TYPE*)(pin)) | |
+#define PIN_TO_BITMASK(pin) ((IO_REG_TYPE)(pin)) | |
+#define IO_REG_TYPE uint32_t | |
+#define IO_REG_ASM | |
+#ifndef PROGMEM | |
+#define PROGMEM | |
+#endif | |
+#define DIRECT_READ(base, mask) digitalRead (mask) | |
+#define DIRECT_MODE_INPUT(base, mask) pinMode (mask, INPUT) | |
+#define DIRECT_MODE_OUTPUT(base, mask) pinMode(mask, OUTPUT) | |
+#define DIRECT_WRITE_LOW(base, mask) digitalWrite(mask, LOW) | |
+#define DIRECT_WRITE_HIGH(base, mask) digitalWrite(mask, HIGH) | |
+#ifndef pgm_read_byte | |
+#define pgm_read_byte(addr) (*(const uint8_t *)(addr)) | |
+#endif | |
+ | |
#else | |
#error "Please define I/O register types here" | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment