Skip to content

Don't spill arduino namespace in headers #612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cores/arduino/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#define RAMEND (RAMSTART + RAMSIZE - 1)

#ifdef __cplusplus

using namespace arduino;

extern "C"{
#endif // __cplusplus

Expand Down
2 changes: 2 additions & 0 deletions cores/arduino/USB/CDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#ifdef CDC_ENABLED

using namespace arduino;

extern USBDevice_SAMD21G18x usbd;

#define CDC_SERIAL_BUFFER_SIZE 256
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/USB/SAMD21_USBDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 6 additions & 10 deletions cores/arduino/USB/USBAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
#include "api/USBAPI.h"
#include "CDC.h"

#if ARDUINO_API_VERSION > 10000
using namespace arduino;
#endif

//================================================================================
// USB

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions cores/arduino/USB/USBCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <stdint.h>
#include <limits.h>

using namespace arduino;

/*
* USB Device instance
Expand Down
6 changes: 3 additions & 3 deletions cores/arduino/Uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int main( void )
for (;;)
{
loop();
if (serialEventRun) serialEventRun();
if (arduino::serialEventRun) arduino::serialEventRun();
}

return 0;
Expand Down