diff options
Diffstat (limited to 'cores/arduino')
-rw-r--r-- | cores/arduino/CDC.cpp | 10 | ||||
-rwxr-xr-x | cores/arduino/Print.cpp | 2 | ||||
-rwxr-xr-x | cores/arduino/Tone.cpp | 31 | ||||
-rw-r--r-- | cores/arduino/WString.h | 2 |
4 files changed, 11 insertions, 34 deletions
diff --git a/cores/arduino/CDC.cpp b/cores/arduino/CDC.cpp index 701e483..1ee3a48 100644 --- a/cores/arduino/CDC.cpp +++ b/cores/arduino/CDC.cpp @@ -141,22 +141,16 @@ void Serial_::end(void) void Serial_::accept(void) { ring_buffer *buffer = &cdc_rx_buffer; + int c = USB_Recv(CDC_RX); int i = (unsigned int)(buffer->head+1) % SERIAL_BUFFER_SIZE; // if we should be storing the received character into the location // just before the tail (meaning that the head would advance to the // current location of the tail), we're about to overflow the buffer // and so we don't write the character or advance the head. - - // while we have room to store a byte - while (i != buffer->tail) { - int c = USB_Recv(CDC_RX); - if (c == -1) - break; // no more data + if (i != buffer->tail) { buffer->buffer[buffer->head] = c; buffer->head = i; - - i = (unsigned int)(buffer->head+1) % SERIAL_BUFFER_SIZE; } } diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp index 53961ec..711251c 100755 --- a/cores/arduino/Print.cpp +++ b/cores/arduino/Print.cpp @@ -228,8 +228,6 @@ size_t Print::printFloat(double number, uint8_t digits) if (isnan(number)) return print("nan"); if (isinf(number)) return print("inf"); - if (number > 4294967040.0) return print ("ovf"); // constant determined empirically - if (number <-4294967040.0) return print ("ovf"); // constant determined empirically // Handle negative numbers if (number < 0.0) diff --git a/cores/arduino/Tone.cpp b/cores/arduino/Tone.cpp index 9bb6fe7..20eed3f 100755 --- a/cores/arduino/Tone.cpp +++ b/cores/arduino/Tone.cpp @@ -29,7 +29,6 @@ Version Modified By Date Comments 09/11/25 Fixed timer0 from being excluded 0006 D Mellis 09/12/29 Replaced objects with functions 0007 M Sproul 10/08/29 Changed #ifdefs from cpu to register -0008 S Kanemoto 12/06/22 Fixed for Leonardo by @maris_HY *************************************************/ #include <avr/interrupt.h> @@ -86,10 +85,10 @@ volatile uint8_t timer5_pin_mask; #endif +// MLS: This does not make sense, the 3 options are the same #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) #define AVAILABLE_TONE_PINS 1 -#define USE_TIMER2 const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 2 /*, 3, 4, 5, 1, 0 */ }; static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255 /*, 255, 255, 255, 255, 255 */ }; @@ -97,23 +96,13 @@ static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255 /*, 255, 255, 255, 255, 25 #elif defined(__AVR_ATmega8__) #define AVAILABLE_TONE_PINS 1 -#define USE_TIMER2 const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 2 /*, 1 */ }; static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255 /*, 255 */ }; -#elif defined(__AVR_ATmega32U4__) - -#define AVAILABLE_TONE_PINS 1 -#define USE_TIMER3 - -const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 3 /*, 1 */ }; -static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255 /*, 255 */ }; - #else #define AVAILABLE_TONE_PINS 1 -#define USE_TIMER2 // Leave timer 0 to last. const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 2 /*, 1, 0 */ }; @@ -491,7 +480,8 @@ void noTone(uint8_t _pin) digitalWrite(_pin, 0); } -#ifdef USE_TIMER0 +#if 0 +#if !defined(__AVR_ATmega8__) ISR(TIMER0_COMPA_vect) { if (timer0_toggle_count != 0) @@ -511,7 +501,6 @@ ISR(TIMER0_COMPA_vect) #endif -#ifdef USE_TIMER1 ISR(TIMER1_COMPA_vect) { if (timer1_toggle_count != 0) @@ -531,7 +520,6 @@ ISR(TIMER1_COMPA_vect) #endif -#ifdef USE_TIMER2 ISR(TIMER2_COMPA_vect) { @@ -553,10 +541,12 @@ ISR(TIMER2_COMPA_vect) // *timer2_pin_port &= ~(timer2_pin_mask); // keep pin low after stop } } -#endif -#ifdef USE_TIMER3 + +//#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +#if 0 + ISR(TIMER3_COMPA_vect) { if (timer3_toggle_count != 0) @@ -573,10 +563,7 @@ ISR(TIMER3_COMPA_vect) *timer3_pin_port &= ~(timer3_pin_mask); // keep pin low after stop } } -#endif - -#ifdef USE_TIMER4 ISR(TIMER4_COMPA_vect) { if (timer4_toggle_count != 0) @@ -593,10 +580,7 @@ ISR(TIMER4_COMPA_vect) *timer4_pin_port &= ~(timer4_pin_mask); // keep pin low after stop } } -#endif - -#ifdef USE_TIMER5 ISR(TIMER5_COMPA_vect) { if (timer5_toggle_count != 0) @@ -613,4 +597,5 @@ ISR(TIMER5_COMPA_vect) *timer5_pin_port &= ~(timer5_pin_mask); // keep pin low after stop } } + #endif diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h index 947325e..d76d2a3 100644 --- a/cores/arduino/WString.h +++ b/cores/arduino/WString.h @@ -35,7 +35,7 @@ // -std=c++0x class __FlashStringHelper; -#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal))) +#define F(string_literal) (reinterpret_cast<__FlashStringHelper *>(PSTR(string_literal))) // An inherited class for holding the result of a concatenation. These // result objects are assumed to be writable by subsequent concatenations. |