Skip to content

Commit

Permalink
Don't spill arduino namespace in headers
Browse files Browse the repository at this point in the history
Needs arduino/ArduinoCore-API#144 to be merged
  • Loading branch information
facchinm committed Mar 29, 2021
1 parent f6148c3 commit a3cc04d
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 deletions.
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

0 comments on commit a3cc04d

Please sign in to comment.