Skip to content

Commit a3cc04d

Browse files
committed
Don't spill arduino namespace in headers
Needs arduino/ArduinoCore-API#144 to be merged
1 parent f6148c3 commit a3cc04d

File tree

7 files changed

+17
-15
lines changed

7 files changed

+17
-15
lines changed

cores/arduino/Arduino.h

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
#define RAMEND (RAMSTART + RAMSIZE - 1)
2828

2929
#ifdef __cplusplus
30+
31+
using namespace arduino;
32+
3033
extern "C"{
3134
#endif // __cplusplus
3235

cores/arduino/USB/CDC.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828

2929
#ifdef CDC_ENABLED
3030

31+
using namespace arduino;
32+
3133
extern USBDevice_SAMD21G18x usbd;
3234

3335
#define CDC_SERIAL_BUFFER_SIZE 256

cores/arduino/USB/SAMD21_USBDevice.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ class DoubleBufferedEPOutHandler : public EPHandler {
396396
private:
397397
USBDevice_SAMD21G18x &usbd;
398398

399-
RingBuffer _rx_buffer;
399+
arduino::RingBuffer _rx_buffer;
400400

401401
const uint32_t ep;
402402
volatile uint32_t current, incoming;

cores/arduino/USB/USBAPI.h

+6-10
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535
#include "api/USBAPI.h"
3636
#include "CDC.h"
3737

38-
#if ARDUINO_API_VERSION > 10000
39-
using namespace arduino;
40-
#endif
41-
4238
//================================================================================
4339
// USB
4440

@@ -59,9 +55,9 @@ class USBDeviceClass {
5955
void standby();
6056

6157
// Setup API
62-
bool handleClassInterfaceSetup(USBSetup &setup);
63-
bool handleStandardSetup(USBSetup &setup);
64-
bool sendDescriptor(USBSetup &setup);
58+
bool handleClassInterfaceSetup(arduino::USBSetup &setup);
59+
bool handleStandardSetup(arduino::USBSetup &setup);
60+
bool sendDescriptor(arduino::USBSetup &setup);
6561

6662
// Control EndPoint API
6763
uint32_t sendControl(const void *data, uint32_t len);
@@ -100,7 +96,7 @@ extern USBDeviceClass USBDevice;
10096
//================================================================================
10197
// Serial over CDC (Serial1 is the physical port)
10298

103-
class Serial_ : public Stream, public arduino::PluggableUSBModule
99+
class Serial_ : public arduino::Stream, public arduino::PluggableUSBModule
104100
{
105101
public:
106102
Serial_(USBDeviceClass &_usb);
@@ -163,8 +159,8 @@ class Serial_ : public Stream, public arduino::PluggableUSBModule
163159
protected:
164160
// Implementation of the PUSBListNode
165161
int getInterface(uint8_t* interfaceNum);
166-
int getDescriptor(USBSetup& setup);
167-
bool setup(USBSetup& setup);
162+
int getDescriptor(arduino::USBSetup& setup);
163+
bool setup(arduino::USBSetup& setup);
168164
uint8_t getShortName(char* name);
169165
void handleEndpoint(int ep);
170166
void enableInterrupt();

cores/arduino/USB/USBCore.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <stdint.h>
3232
#include <limits.h>
3333

34+
using namespace arduino;
3435

3536
/*
3637
* USB Device instance

cores/arduino/Uart.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#define SERIAL_BUFFER_SIZE 64
2626

27-
class Uart : public HardwareSerial
27+
class Uart : public arduino::HardwareSerial
2828
{
2929
public:
3030
Uart(SERCOM *_s, uint8_t _pinRX, uint8_t _pinTX, SercomRXPad _padRX, SercomUartTXPad _padTX);
@@ -46,8 +46,8 @@ class Uart : public HardwareSerial
4646

4747
private:
4848
SERCOM *sercom;
49-
SafeRingBuffer rxBuffer;
50-
SafeRingBuffer txBuffer;
49+
arduino::SafeRingBuffer rxBuffer;
50+
arduino::SafeRingBuffer txBuffer;
5151

5252
uint8_t uc_pinRX;
5353
uint8_t uc_pinTX;

cores/arduino/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int main( void )
5151
for (;;)
5252
{
5353
loop();
54-
if (serialEventRun) serialEventRun();
54+
if (arduino::serialEventRun) arduino::serialEventRun();
5555
}
5656

5757
return 0;

0 commit comments

Comments
 (0)