aboutsummaryrefslogtreecommitdiff
path: root/cores
diff options
context:
space:
mode:
Diffstat (limited to 'cores')
-rw-r--r--cores/arduino/Arduino.h19
-rw-r--r--cores/arduino/CDC.cpp2
-rw-r--r--cores/arduino/Stream.cpp1
-rw-r--r--cores/arduino/USBCore.cpp3
-rw-r--r--cores/arduino/WString.cpp2
-rw-r--r--cores/arduino/new.cpp5
-rw-r--r--cores/arduino/new.h1
7 files changed, 19 insertions, 14 deletions
diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h
index 09c1448..91eeb16 100644
--- a/cores/arduino/Arduino.h
+++ b/cores/arduino/Arduino.h
@@ -111,7 +111,8 @@ void yield(void);
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
-#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
+#define bitToggle(value, bit) ((value) ^= (1UL << (bit)))
+#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit))
// avr-libc defines _NOP() since 1.6.2
#ifndef _NOP
@@ -130,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);
@@ -147,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/CDC.cpp b/cores/arduino/CDC.cpp
index 142f8f6..4ff6b9b 100644
--- a/cores/arduino/CDC.cpp
+++ b/cores/arduino/CDC.cpp
@@ -41,7 +41,7 @@ static u8 wdtcsr_save;
extern const CDCDescriptor _cdcInterface PROGMEM;
const CDCDescriptor _cdcInterface =
{
- D_IAD(0,2,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,1),
+ D_IAD(0,2,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,0),
// CDC communication interface
D_INTERFACE(CDC_ACM_INTERFACE,1,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,0),
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/USBCore.cpp b/cores/arduino/USBCore.cpp
index c0a4c7c..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);
}
diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp
index f2572d6..043fda7 100644
--- a/cores/arduino/WString.cpp
+++ b/cores/arduino/WString.cpp
@@ -121,7 +121,7 @@ String::String(double value, unsigned char decimalPlaces)
String::~String()
{
- free(buffer);
+ if (buffer) free(buffer);
}
/*********************************************/
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);