Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Done comparing with Arduino 1.0 core + add Atmega 644P support

  • Loading branch information...
commit 205d15c80b39777a32d439e50dc3a6be258a2112 1 parent 115a1b4
Ismail Ibrahim authored
View
2  boards.txt
@@ -1,6 +1,6 @@
##############################################################
-sanguino.name=Sanguino 644P
+sanguino.name=Sanguino 644p 16Mhz
sanguino.upload.protocol=arduino
sanguino.upload.maximum_size=63488
sanguino.upload.speed=38400
View
2  cores/standard/Arduino.h
@@ -45,7 +45,7 @@ extern "C"{
#define EXTERNAL 1
#define INTERNAL 2
#else
-#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284P__)
+#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284P__) || (__AVR_ATmega644P__)
#define INTERNAL1V1 2
#define INTERNAL2V56 3
#else
View
2  cores/standard/WInterrupts.c
@@ -32,7 +32,7 @@
#include "wiring_private.h"
-static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS];
+volatile static voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS];
// volatile static voidFuncPtr twiIntFunc;
void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) {
View
4 cores/standard/WString.cpp
@@ -500,7 +500,7 @@ int String::lastIndexOf( char theChar ) const
int String::lastIndexOf(char ch, unsigned int fromIndex) const
{
- if (fromIndex >= len) return -1;
+ if (fromIndex >= len || fromIndex < 0) return -1;
char tempchar = buffer[fromIndex + 1];
buffer[fromIndex + 1] = '\0';
char* temp = strrchr( buffer, ch );
@@ -516,7 +516,7 @@ int String::lastIndexOf(const String &s2) const
int String::lastIndexOf(const String &s2, unsigned int fromIndex) const
{
- if (s2.len == 0 || len == 0 || s2.len > len) return -1;
+ if (s2.len == 0 || len == 0 || s2.len > len || fromIndex < 0) return -1;
if (fromIndex >= len) fromIndex = len - 1;
int found = -1;
for (char *p = buffer; p <= buffer + fromIndex; p++) {
View
10 cores/standard/wiring_analog.c
@@ -41,7 +41,15 @@ int analogRead(uint8_t pin)
{
uint8_t low, high;
- if (pin >= A0) pin -= A0; // allow for channel or pin numbers
+#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
+ if (pin >= 54) pin -= 54; // allow for channel or pin numbers
+#elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__)
+ if (pin >= 24) pin -= 24; // allow for channel or pin numbers
+#elif defined(__AVR_ATmega32U4__)
+ if (pin >= 18) pin -= 18; // allow for channel or pin numbers
+#else
+ if (pin >= 14) pin -= 14; // allow for channel or pin numbers
+#endif
#if defined(__AVR_ATmega32U4__)
pin = analogPinToChannel(pin);
View
2  cores/standard/wiring_private.h
@@ -54,7 +54,7 @@ extern "C"{
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define EXTERNAL_NUM_INTERRUPTS 8
-#elif defined(__AVR_ATmega1284P__)
+#elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__)
#define EXTERNAL_NUM_INTERRUPTS 3
#else
#define EXTERNAL_NUM_INTERRUPTS 2
View
29 variants/sanguino/pins_arduino.h
@@ -17,8 +17,8 @@
// PWM (D 3) PB3 4| |37 PA3 (AI 3 / D28)
// PWM/SS (D 4) PB4 5| |36 PA4 (AI 4 / D27)
// MOSI (D 5) PB5 6| |35 PA5 (AI 5 / D26)
-// PWM/MISO (D 6) PB6 7| |34 PA6 (AI 6 / D25)
-// PWM/SCK (D 7) PB7 8| |33 PA7 (AI 7 / D24)
+// MISO (D 6) PB6 7| |34 PA6 (AI 6 / D25)
+// SCK (D 7) PB7 8| |33 PA7 (AI 7 / D24)
// RST 9| |32 AREF
// VCC 10| |31 GND
// GND 11| |30 AVCC
@@ -38,14 +38,13 @@
PCINT15-8: D7-0 : bit 1
PCINT31-24: D15-8 : bit 3
PCINT23-16: D23-16 : bit 2
- PCINT7-0: D31-24 : bit 0
+ PCINT7-0: D24-31 : bit 0
*/
#define NUM_DIGITAL_PINS 31
#define NUM_ANALOG_INPUTS 8
#define analogInputToDigitalPin(p) ((p < NUM_ANALOG_INPUTS) ? (p) + 24 : -1)
-
-#define digitalPinHasPWM(p) ((p) == 3 || (p) == 4 || (p) == 6 || (p) == 7 || (p) == 12 || (p) == 13 || (p) == 14 || (p) == 15)
+#define digitalPinHasPWM(p) ((p) == 3 || (p) == 4 || (p) == 12 || (p) == 13 || (p) == 14 || (p) == 15)
static const uint8_t SS = 4;
static const uint8_t MOSI = 5;
@@ -56,14 +55,14 @@ static const uint8_t SDA = 17;
static const uint8_t SCL = 16;
static const uint8_t LED = 0;
-static const uint8_t A0 = 24;
-static const uint8_t A1 = 25;
-static const uint8_t A2 = 26;
-static const uint8_t A3 = 27;
-static const uint8_t A4 = 28;
-static const uint8_t A5 = 29;
-static const uint8_t A6 = 30;
-static const uint8_t A7 = 31;
+static const uint8_t A0 = 31;
+static const uint8_t A1 = 30;
+static const uint8_t A2 = 29;
+static const uint8_t A3 = 28;
+static const uint8_t A4 = 27;
+static const uint8_t A5 = 26;
+static const uint8_t A6 = 25;
+static const uint8_t A7 = 24;
#define digitalPinToPCICR(p) (((p) >= 0 && (p) < NUM_DIGITAL_PINS) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 1 : (((p) <= 15) ? 3 : (((p) <= 23) ? 2 : 0)))
@@ -187,8 +186,8 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[] =
TIMER0A, /* 3 - PB3 */
TIMER0B, /* 4 - PB4 */
NOT_ON_TIMER, /* 5 - PB5 */
- TIMER3A, /* 6 - PB6 */
- TIMER3B, /* 7 - PB7 */
+ NOT_ON_TIMER, /* 6 - PB6 */
+ NOT_ON_TIMER, /* 7 - PB7 */
NOT_ON_TIMER, /* 8 - PD0 */
NOT_ON_TIMER, /* 9 - PD1 */
NOT_ON_TIMER, /* 10 - PD2 */
Please sign in to comment.
Something went wrong with that request. Please try again.