Updated copy of Arduino1 files related to the USB AVRs to RC2.
This commit is contained in:
@@ -1 +0,0 @@
|
||||
This directory contains the core firmware of Arduino1-RC1 related to the USB AVRs.
|
||||
1
Micropendous/libs/Arduino1/Arduino1-RC2.txt
Normal file
1
Micropendous/libs/Arduino1/Arduino1-RC2.txt
Normal file
@@ -0,0 +1 @@
|
||||
This directory contains the core firmware of Arduino1-RC2 related to the USB AVRs.
|
||||
@@ -40,6 +40,11 @@ extern "C"{
|
||||
#define FALLING 2
|
||||
#define RISING 3
|
||||
|
||||
#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
|
||||
#define DEFAULT 0
|
||||
#define EXTERNAL 1
|
||||
#define INTERNAL 2
|
||||
#else
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
#define INTERNAL1V1 2
|
||||
#define INTERNAL2V56 3
|
||||
@@ -48,6 +53,7 @@ extern "C"{
|
||||
#endif
|
||||
#define DEFAULT 1
|
||||
#define EXTERNAL 0
|
||||
#endif
|
||||
|
||||
// undefine stdlib's abs if encountered
|
||||
#ifdef abs
|
||||
@@ -142,6 +148,7 @@ extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
|
||||
#define NOT_A_PIN 0
|
||||
#define NOT_A_PORT 0
|
||||
|
||||
#ifdef ARDUINO_MAIN
|
||||
#define PA 1
|
||||
#define PB 2
|
||||
#define PC 3
|
||||
@@ -153,6 +160,7 @@ extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
|
||||
#define PJ 10
|
||||
#define PK 11
|
||||
#define PL 12
|
||||
#endif
|
||||
|
||||
#define NOT_ON_TIMER 0
|
||||
#define TIMER0A 1
|
||||
|
||||
@@ -91,7 +91,7 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
||||
#if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \
|
||||
!defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \
|
||||
!defined(SIG_UART_RECV)
|
||||
#error Don't know what the Data Received vector is called for the first UART
|
||||
#error "Don't know what the Data Received vector is called for the first UART"
|
||||
#else
|
||||
void serialEvent() __attribute__((weak));
|
||||
void serialEvent() {}
|
||||
@@ -180,7 +180,7 @@ void serialEventRun(void)
|
||||
// do nothing - on the 32u4 the first USART is USART1
|
||||
#else
|
||||
#if !defined(UART0_UDRE_vect) && !defined(UART_UDRE_vect) && !defined(USART0_UDRE_vect) && !defined(USART_UDRE_vect)
|
||||
#error Don't know what the Data Register Empty vector is called for the first UART
|
||||
#error "Don't know what the Data Register Empty vector is called for the first UART"
|
||||
#else
|
||||
#if defined(UART0_UDRE_vect)
|
||||
ISR(UART0_UDRE_vect)
|
||||
|
||||
@@ -54,7 +54,7 @@ size_t Print::print(const __FlashStringHelper *ifsh)
|
||||
size_t Print::print(const String &s)
|
||||
{
|
||||
size_t n = 0;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
for (uint16_t i = 0; i < s.length(); i++) {
|
||||
n += write(s[i]);
|
||||
}
|
||||
return n;
|
||||
|
||||
@@ -67,9 +67,9 @@ int Stream::peekNextDigit()
|
||||
// Public Methods
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
void Stream::setTimeout( long timeout) // sets the maximum number of milliseconds to wait
|
||||
void Stream::setTimeout(unsigned long timeout) // sets the maximum number of milliseconds to wait
|
||||
{
|
||||
this->_timeout = timeout;
|
||||
_timeout = timeout;
|
||||
}
|
||||
|
||||
// find returns true if the target string is found
|
||||
@@ -165,7 +165,7 @@ long Stream::parseInt(char skipChar)
|
||||
// as parseInt but returns a floating point value
|
||||
float Stream::parseFloat()
|
||||
{
|
||||
parseFloat(NO_SKIP_CHAR);
|
||||
return parseFloat(NO_SKIP_CHAR);
|
||||
}
|
||||
|
||||
// as above but the given skipChar is ignored
|
||||
@@ -174,7 +174,6 @@ float Stream::parseFloat(char skipChar){
|
||||
boolean isNegative = false;
|
||||
boolean isFraction = false;
|
||||
long value = 0;
|
||||
float fValue;
|
||||
char c;
|
||||
float fraction = 1.0;
|
||||
|
||||
@@ -223,7 +222,7 @@ int Stream::readBytes( char *buffer, size_t length)
|
||||
|
||||
int Stream::readBytesUntil( char terminator, char *buffer, size_t length)
|
||||
{
|
||||
int index = 0;
|
||||
unsigned int index = 0;
|
||||
*buffer = 0;
|
||||
while(index < length-1 ){
|
||||
int c = timedRead();
|
||||
|
||||
@@ -38,8 +38,8 @@ readBytesBetween( pre_string, terminator, buffer, length)
|
||||
class Stream : public Print
|
||||
{
|
||||
private:
|
||||
long _timeout; // number of milliseconds to wait for the next char before aborting timed read
|
||||
long _startMillis; // used for timeout measurement
|
||||
unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read
|
||||
unsigned long _startMillis; // used for timeout measurement
|
||||
int timedRead(); // private method to read stream with timeout
|
||||
int timedPeek(); // private method to peek stream with timeout
|
||||
int peekNextDigit(); // returns the next numeric digit in the stream or -1 if timeout
|
||||
@@ -54,7 +54,7 @@ class Stream : public Print
|
||||
|
||||
// parsing methods
|
||||
|
||||
void setTimeout(long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second
|
||||
void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second
|
||||
|
||||
bool find(char *target); // reads data from the stream until the target string is found
|
||||
// returns true if target string is found, false if timed out (see setTimeout)
|
||||
|
||||
@@ -498,7 +498,7 @@ int String::lastIndexOf( char theChar ) const
|
||||
return lastIndexOf(theChar, len - 1);
|
||||
}
|
||||
|
||||
int String::lastIndexOf(char ch, int fromIndex) const
|
||||
int String::lastIndexOf(char ch, unsigned int fromIndex) const
|
||||
{
|
||||
if (fromIndex >= len || fromIndex < 0) return -1;
|
||||
char tempchar = buffer[fromIndex + 1];
|
||||
@@ -514,7 +514,7 @@ int String::lastIndexOf(const String &s2) const
|
||||
return lastIndexOf(s2, len - s2.len);
|
||||
}
|
||||
|
||||
int String::lastIndexOf(const String &s2, int fromIndex) const
|
||||
int String::lastIndexOf(const String &s2, unsigned int fromIndex) const
|
||||
{
|
||||
if (s2.len == 0 || len == 0 || s2.len > len || fromIndex < 0) return -1;
|
||||
if (fromIndex >= len) fromIndex = len - 1;
|
||||
@@ -522,7 +522,7 @@ int String::lastIndexOf(const String &s2, int fromIndex) const
|
||||
for (char *p = buffer; p <= buffer + fromIndex; p++) {
|
||||
p = strstr(p, s2.buffer);
|
||||
if (!p) break;
|
||||
if (p - buffer <= fromIndex) found = p - buffer;
|
||||
if ((unsigned int)(p - buffer) <= fromIndex) found = p - buffer;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
@@ -593,7 +593,7 @@ void String::replace(const String& find, const String& replace)
|
||||
if (size == len) return;
|
||||
if (size > capacity && !changeBuffer(size)) return; // XXX: tell user!
|
||||
int index = len - 1;
|
||||
while ((index = lastIndexOf(find, index)) >= 0) {
|
||||
while (index >= 0 && (index = lastIndexOf(find, index)) >= 0) {
|
||||
readFrom = buffer + index + find.len;
|
||||
memmove(readFrom + diff, readFrom, len - (readFrom - buffer));
|
||||
len += diff;
|
||||
|
||||
@@ -154,9 +154,9 @@ public:
|
||||
int indexOf( const String &str ) const;
|
||||
int indexOf( const String &str, unsigned int fromIndex ) const;
|
||||
int lastIndexOf( char ch ) const;
|
||||
int lastIndexOf( char ch, int fromIndex ) const;
|
||||
int lastIndexOf( char ch, unsigned int fromIndex ) const;
|
||||
int lastIndexOf( const String &str ) const;
|
||||
int lastIndexOf( const String &str, int fromIndex ) const;
|
||||
int lastIndexOf( const String &str, unsigned int fromIndex ) const;
|
||||
String substring( unsigned int beginIndex ) const;
|
||||
String substring( unsigned int beginIndex, unsigned int endIndex ) const;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#define ARDUINO_MAIN
|
||||
#include <Arduino.h>
|
||||
|
||||
int main(void)
|
||||
|
||||
@@ -41,7 +41,11 @@ volatile unsigned long timer0_overflow_count = 0;
|
||||
volatile unsigned long timer0_millis = 0;
|
||||
static unsigned char timer0_fract = 0;
|
||||
|
||||
#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
|
||||
SIGNAL(TIM0_OVF_vect)
|
||||
#else
|
||||
SIGNAL(TIMER0_OVF_vect)
|
||||
#endif
|
||||
{
|
||||
// copy these to local variables so they can be stored in registers
|
||||
// (volatile variables must be read from memory on every access)
|
||||
@@ -217,10 +221,14 @@ void init()
|
||||
|
||||
// set timer 1 prescale factor to 64
|
||||
sbi(TCCR1B, CS11);
|
||||
#if F_CPU >= 8000000L
|
||||
sbi(TCCR1B, CS10);
|
||||
#endif
|
||||
#elif defined(TCCR1) && defined(CS11) && defined(CS10)
|
||||
sbi(TCCR1, CS11);
|
||||
#if F_CPU >= 8000000L
|
||||
sbi(TCCR1, CS10);
|
||||
#endif
|
||||
#endif
|
||||
// put timer 1 in 8-bit phase correct pwm mode
|
||||
#if defined(TCCR1A) && defined(WGM10)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
$Id: wiring.c 248 2007-02-03 15:36:30Z mellis $
|
||||
*/
|
||||
|
||||
#define ARDUINO_MAIN
|
||||
#include "wiring_private.h"
|
||||
#include "pins_arduino.h"
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/delay.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user