diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 199e65e22..d78acd9b4 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -27,6 +27,9 @@ #define RAMEND (RAMSTART + RAMSIZE - 1) #ifdef __cplusplus + +using namespace arduino; + extern "C"{ #endif // __cplusplus diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index e1a133ca8..c8314c2bb 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -28,6 +28,8 @@ #ifdef CDC_ENABLED +using namespace arduino; + extern USBDevice_SAMD21G18x usbd; #define CDC_SERIAL_BUFFER_SIZE 256 diff --git a/cores/arduino/USB/SAMD21_USBDevice.h b/cores/arduino/USB/SAMD21_USBDevice.h index 3fff6e1b8..98a95ce95 100644 --- a/cores/arduino/USB/SAMD21_USBDevice.h +++ b/cores/arduino/USB/SAMD21_USBDevice.h @@ -396,7 +396,7 @@ class DoubleBufferedEPOutHandler : public EPHandler { private: USBDevice_SAMD21G18x &usbd; - RingBuffer _rx_buffer; + arduino::RingBuffer _rx_buffer; const uint32_t ep; volatile uint32_t current, incoming; diff --git a/cores/arduino/USB/USBAPI.h b/cores/arduino/USB/USBAPI.h index c5cec6257..07633825d 100644 --- a/cores/arduino/USB/USBAPI.h +++ b/cores/arduino/USB/USBAPI.h @@ -35,10 +35,6 @@ #include "api/USBAPI.h" #include "CDC.h" -#if ARDUINO_API_VERSION > 10000 -using namespace arduino; -#endif - //================================================================================ // USB @@ -59,9 +55,9 @@ class USBDeviceClass { void standby(); // Setup API - bool handleClassInterfaceSetup(USBSetup &setup); - bool handleStandardSetup(USBSetup &setup); - bool sendDescriptor(USBSetup &setup); + bool handleClassInterfaceSetup(arduino::USBSetup &setup); + bool handleStandardSetup(arduino::USBSetup &setup); + bool sendDescriptor(arduino::USBSetup &setup); // Control EndPoint API uint32_t sendControl(const void *data, uint32_t len); @@ -100,7 +96,7 @@ extern USBDeviceClass USBDevice; //================================================================================ // Serial over CDC (Serial1 is the physical port) -class Serial_ : public Stream, public arduino::PluggableUSBModule +class Serial_ : public arduino::Stream, public arduino::PluggableUSBModule { public: Serial_(USBDeviceClass &_usb); @@ -163,8 +159,8 @@ class Serial_ : public Stream, public arduino::PluggableUSBModule protected: // Implementation of the PUSBListNode int getInterface(uint8_t* interfaceNum); - int getDescriptor(USBSetup& setup); - bool setup(USBSetup& setup); + int getDescriptor(arduino::USBSetup& setup); + bool setup(arduino::USBSetup& setup); uint8_t getShortName(char* name); void handleEndpoint(int ep); void enableInterrupt(); diff --git a/cores/arduino/USB/USBCore.cpp b/cores/arduino/USB/USBCore.cpp index be0bb5612..f8322436f 100644 --- a/cores/arduino/USB/USBCore.cpp +++ b/cores/arduino/USB/USBCore.cpp @@ -31,6 +31,7 @@ #include #include +using namespace arduino; /* * USB Device instance diff --git a/cores/arduino/Uart.h b/cores/arduino/Uart.h index d02600b3f..6aa847839 100644 --- a/cores/arduino/Uart.h +++ b/cores/arduino/Uart.h @@ -24,7 +24,7 @@ #define SERIAL_BUFFER_SIZE 64 -class Uart : public HardwareSerial +class Uart : public arduino::HardwareSerial { public: Uart(SERCOM *_s, uint8_t _pinRX, uint8_t _pinTX, SercomRXPad _padRX, SercomUartTXPad _padTX); @@ -46,8 +46,8 @@ class Uart : public HardwareSerial private: SERCOM *sercom; - SafeRingBuffer rxBuffer; - SafeRingBuffer txBuffer; + arduino::SafeRingBuffer rxBuffer; + arduino::SafeRingBuffer txBuffer; uint8_t uc_pinRX; uint8_t uc_pinTX; diff --git a/cores/arduino/main.cpp b/cores/arduino/main.cpp index 5a59884f6..a6d2cb5f5 100644 --- a/cores/arduino/main.cpp +++ b/cores/arduino/main.cpp @@ -51,7 +51,7 @@ int main( void ) for (;;) { loop(); - if (serialEventRun) serialEventRun(); + if (arduino::serialEventRun) arduino::serialEventRun(); } return 0;