diff options
author | Alexander Entinger <consulting@lxrobotics.com> | 2019-09-16 10:21:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-16 10:21:51 +0200 |
commit | 366b1b814702ec0da8951f9e13af882352442940 (patch) | |
tree | 597ffcfd6407f4b7c55639ee54f5b517c25c9e79 | |
parent | 0c5aa78ff40d208a1341b3dae84166e837901070 (diff) | |
parent | 742abcd9660d4b754fede51f098113fca918cb54 (diff) |
Merge branch 'master' into patch-1
-rw-r--r-- | cores/arduino/Arduino.h | 18 | ||||
-rw-r--r-- | cores/arduino/Stream.cpp | 1 | ||||
-rw-r--r-- | cores/arduino/USBAPI.h | 2 | ||||
-rw-r--r-- | cores/arduino/USBCore.cpp | 9 | ||||
-rw-r--r-- | cores/arduino/WInterrupts.c | 14 | ||||
-rw-r--r-- | cores/arduino/new.cpp | 5 | ||||
-rw-r--r-- | cores/arduino/new.h | 1 | ||||
-rw-r--r-- | libraries/EEPROM/src/EEPROM.h | 6 | ||||
-rw-r--r-- | libraries/SoftwareSerial/src/SoftwareSerial.h | 9 | ||||
-rw-r--r-- | platform.txt | 4 | ||||
-rw-r--r-- | programmers.txt | 13 |
11 files changed, 40 insertions, 42 deletions
diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 808ff19..91eeb16 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -112,7 +112,7 @@ void yield(void); #define bitSet(value, bit) ((value) |= (1UL << (bit))) #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) #define bitToggle(value, bit) ((value) ^= (1UL << (bit))) -#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) +#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit)) // avr-libc defines _NOP() since 1.6.2 #ifndef _NOP @@ -131,16 +131,16 @@ void initVariant(void); int atexit(void (*func)()) __attribute__((weak)); -void pinMode(uint8_t, uint8_t); -void digitalWrite(uint8_t, uint8_t); -int digitalRead(uint8_t); -int analogRead(uint8_t); +void pinMode(uint8_t pin, uint8_t mode); +void digitalWrite(uint8_t pin, uint8_t val); +int digitalRead(uint8_t pin); +int analogRead(uint8_t pin); void analogReference(uint8_t mode); -void analogWrite(uint8_t, int); +void analogWrite(uint8_t pin, int val); unsigned long millis(void); unsigned long micros(void); -void delay(unsigned long); +void delay(unsigned long ms); void delayMicroseconds(unsigned int us); unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout); unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout); @@ -148,8 +148,8 @@ unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout); void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val); uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder); -void attachInterrupt(uint8_t, void (*)(void), int mode); -void detachInterrupt(uint8_t); +void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode); +void detachInterrupt(uint8_t interruptNum); void setup(void); void loop(void); diff --git a/cores/arduino/Stream.cpp b/cores/arduino/Stream.cpp index d284631..9eff663 100644 --- a/cores/arduino/Stream.cpp +++ b/cores/arduino/Stream.cpp @@ -218,7 +218,6 @@ size_t Stream::readBytes(char *buffer, size_t length) size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) { - if (length < 1) return 0; size_t index = 0; while (index < length) { int c = timedRead(); diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h index 479ced9..701a14f 100644 --- a/cores/arduino/USBAPI.h +++ b/cores/arduino/USBAPI.h @@ -65,6 +65,8 @@ public: void detach(); // Serial port goes down too... void poll(); bool wakeupHost(); // returns false, when wakeup cannot be processed + + bool isSuspended(); }; extern USBDevice_ USBDevice; diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index 81f689d..dc6bc38 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -496,14 +496,13 @@ bool SendConfiguration(int maxlen) static bool SendDescriptor(USBSetup& setup) { - int ret; u8 t = setup.wValueH; if (USB_CONFIGURATION_DESCRIPTOR_TYPE == t) return SendConfiguration(setup.wLength); InitControl(setup.wLength); #ifdef PLUGGABLE_USB_ENABLED - ret = PluggableUSB().getDescriptor(setup); + int ret = PluggableUSB().getDescriptor(setup); if (ret != 0) { return (ret > 0 ? true : false); } @@ -855,4 +854,10 @@ bool USBDevice_::wakeupHost() return false; } +bool USBDevice_::isSuspended() +{ + return (_usbSuspendState & (1 << SUSPI)); +} + + #endif /* if defined(USBCON) */ diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index cef1106..ac72dda 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -65,7 +65,6 @@ static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS] = { nothing, #endif }; -// volatile static voidFuncPtr twiIntFunc; void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) { if(interruptNum < EXTERNAL_NUM_INTERRUPTS) { @@ -274,11 +273,6 @@ void detachInterrupt(uint8_t interruptNum) { } } -/* -void attachInterruptTwi(void (*userFunc)(void) ) { - twiIntFunc = userFunc; -} -*/ #define IMPLEMENT_ISR(vect, interrupt) \ ISR(vect) { \ @@ -314,11 +308,3 @@ IMPLEMENT_ISR(INT2_vect, EXTERNAL_INT_2) #endif #endif - -/* -ISR(TWI_vect) { - if(twiIntFunc) - twiIntFunc(); -} -*/ - diff --git a/cores/arduino/new.cpp b/cores/arduino/new.cpp index cf6f89c..fc30cf8 100644 --- a/cores/arduino/new.cpp +++ b/cores/arduino/new.cpp @@ -26,6 +26,11 @@ void *operator new[](size_t size) { return malloc(size); } +void * operator new(size_t size, void * ptr) noexcept { + (void)size; + return ptr; +} + void operator delete(void * ptr) { free(ptr); } diff --git a/cores/arduino/new.h b/cores/arduino/new.h index 6e1b68f..763f5cc 100644 --- a/cores/arduino/new.h +++ b/cores/arduino/new.h @@ -23,6 +23,7 @@ void * operator new(size_t size); void * operator new[](size_t size); +void * operator new(size_t size, void * ptr) noexcept; void operator delete(void * ptr); void operator delete[](void * ptr); diff --git a/libraries/EEPROM/src/EEPROM.h b/libraries/EEPROM/src/EEPROM.h index cde75db..c8ec271 100644 --- a/libraries/EEPROM/src/EEPROM.h +++ b/libraries/EEPROM/src/EEPROM.h @@ -40,7 +40,7 @@ struct EERef{ //Access/read members. uint8_t operator*() const { return eeprom_read_byte( (uint8_t*) index ); } - operator const uint8_t() const { return **this; } + operator uint8_t() const { return **this; } //Assignment/write members. EERef &operator=( const EERef &ref ) { return *this = *ref; } @@ -89,7 +89,7 @@ struct EEPtr{ EEPtr( const int index ) : index( index ) {} - operator const int() const { return index; } + operator int() const { return index; } EEPtr &operator=( int in ) { return index = in, *this; } //Iterator functionality. @@ -143,4 +143,4 @@ struct EEPROMClass{ }; static EEPROMClass EEPROM; -#endif
\ No newline at end of file +#endif diff --git a/libraries/SoftwareSerial/src/SoftwareSerial.h b/libraries/SoftwareSerial/src/SoftwareSerial.h index b1a37c4..d8b88ce 100644 --- a/libraries/SoftwareSerial/src/SoftwareSerial.h +++ b/libraries/SoftwareSerial/src/SoftwareSerial.h @@ -111,13 +111,4 @@ public: static inline void handle_interrupt() __attribute__((__always_inline__));
};
-// Arduino 0012 workaround
-#undef int
-#undef char
-#undef long
-#undef byte
-#undef float
-#undef abs
-#undef round
-
#endif
diff --git a/platform.txt b/platform.txt index f1546a3..cb48698 100644 --- a/platform.txt +++ b/platform.txt @@ -6,7 +6,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification name=Arduino AVR Boards -version=1.6.22 +version=1.6.23 # AVR compile variables # --------------------- @@ -25,7 +25,7 @@ compiler.c.elf.flags={compiler.warning_flags} -Os -g -flto -fuse-linker-plugin - compiler.c.elf.cmd=avr-gcc compiler.S.flags=-c -g -x assembler-with-cpp -flto -MMD compiler.cpp.cmd=avr-g++ -compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto +compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto compiler.ar.cmd=avr-gcc-ar compiler.ar.flags=rcs compiler.objcopy.cmd=avr-objcopy diff --git a/programmers.txt b/programmers.txt index d0d2cc1..69ddf69 100644 --- a/programmers.txt +++ b/programmers.txt @@ -43,13 +43,22 @@ parallel.program.extra_params=-F arduinoasisp.name=Arduino as ISP arduinoasisp.communication=serial -arduinoasisp.protocol=arduino +arduinoasisp.protocol=stk500v1 arduinoasisp.speed=19200 -arduinoasisp.program.protocol=arduino +arduinoasisp.program.protocol=stk500v1 arduinoasisp.program.speed=19200 arduinoasisp.program.tool=avrdude arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed} +arduinoasispatmega32u4.name=Arduino as ISP (ATmega32U4) +arduinoasispatmega32u4.communication=serial +arduinoasispatmega32u4.protocol=arduino +arduinoasispatmega32u4.speed=19200 +arduinoasispatmega32u4.program.protocol=arduino +arduinoasispatmega32u4.program.speed=19200 +arduinoasispatmega32u4.program.tool=avrdude +arduinoasispatmega32u4.program.extra_params=-P{serial.port} -b{program.speed} + usbGemma.name=Arduino Gemma usbGemma.protocol=arduinogemma usbGemma.program.tool=avrdude |