Skip to content

Commit 30805ba

Browse files
committed
Rename of arduino headers to A_ prefix. Reorg file structure.
1 parent 60c0d8d commit 30805ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+393
-373
lines changed

api/WAnalog.h renamed to api/A_Analog.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
#pragma once
1+
#ifndef ARDUINO_ANALOG_H
2+
#define ARDUINO_ANALOG_H
23

34
#include <stdint.h>
45

6+
#include "A_Types.h"
7+
58
#ifdef __cplusplus
69
extern "C"{
710
#endif
@@ -16,3 +19,5 @@ void analogWriteResolution(int bits);
1619
#ifdef __cplusplus
1720
} // extern "C"
1821
#endif
22+
23+
#endif // ARDUINO_ANALOG_H

api/WCharacter.h renamed to api/A_Character.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#pragma once
1+
#ifndef ARDUINO_CHARACTER_H
2+
#define ARDUINO_CHARACTER_H
23

34
#include <ctype.h>
45

@@ -19,3 +20,5 @@
1920
#define toAscii(c) (toascii(c))
2021
#define toLowerCase(c) (tolower(c))
2122
#define toUpperCase(c) (toupper(c))
23+
24+
#endif // ARDUINO_CHARACTER_H

api/Client.h renamed to api/A_Client.h

+12-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@
1717
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1818
*/
1919

20-
#pragma once
20+
#ifndef ARDUINO_CLIENT_H
21+
#define ARDUINO_CLIENT_H
2122

22-
#include "Stream.h"
23-
#include "IPAddress.h"
23+
#ifdef __cplusplus
24+
25+
#include <stddef.h>
26+
#include <stdint.h>
27+
28+
#include "A_IPAddress.h"
29+
#include "A_Stream.h"
2430

2531
class Client : public Stream {
2632

@@ -41,3 +47,6 @@ class Client : public Stream {
4147
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
4248
};
4349

50+
#endif // __cplusplus
51+
52+
#endif // ARDUINO_CLIENT_H

api/WDelay.h renamed to api/A_Delay.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#pragma once
1+
#ifndef ARDUINO_DELAY_H
2+
#define ARDUINO_DELAY_H
23

34
#ifdef __cplusplus
45
extern "C"{
@@ -10,3 +11,5 @@ void delayMicroseconds(unsigned int us);
1011
#ifdef __cplusplus
1112
} // extern "C"
1213
#endif
14+
15+
#endif // ARDUINO_DELAY_H
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
#pragma once
1+
#ifndef ARDUINO_DIGITAL_H
2+
#define ARDUINO_DIGITAL_H
23

3-
#include "WTypes.h"
4+
#include "A_Types.h"
45

56
#ifdef __cplusplus
67
extern "C"{
78
#endif
89

910
void pinMode(pin_size_t pinNumber, PinMode pinMode);
10-
void digitalWrite(pin_size_t pinNumber, PinStatus status);
11+
//void digitalWrite(pin_size_t pinNumber, PinStatus status);
1112
PinStatus digitalRead(pin_size_t pinNumber);
1213

1314
#ifdef __cplusplus
1415
} // extern "C"
1516
#endif
17+
18+
#endif // ARDUINO_DIGITAL_H

api/HardwareI2C.h renamed to api/A_HardwareI2C.h

+12-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@
1616
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1717
*/
1818

19-
#pragma once
19+
#ifndef ARDUINO_HARDWARE_I2C_H
20+
#define ARDUINO_HARDWARE_I2C_H
2021

21-
#include <inttypes.h>
22-
#include "Stream.h"
22+
#ifdef __cplusplus
23+
24+
#include <stddef.h>
25+
#include <stdint.h>
26+
27+
#include "A_Stream.h"
2328

2429
class HardwareI2C : public Stream
2530
{
@@ -29,7 +34,7 @@ class HardwareI2C : public Stream
2934
virtual void end() = 0;
3035

3136
virtual void setClock(uint32_t freq) = 0;
32-
37+
3338
virtual void beginTransmission(uint8_t address) = 0;
3439
virtual uint8_t endTransmission(bool stopBit) = 0;
3540
virtual uint8_t endTransmission(void) = 0;
@@ -41,3 +46,6 @@ class HardwareI2C : public Stream
4146
virtual void onRequest(void(*)(void)) = 0;
4247
};
4348

49+
#endif // __cplusplus
50+
51+
#endif // ARDUINO_HARDWARE_I2C_H

api/HardwareSerial.h renamed to api/A_HardwareSerial.h

+10-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1717
*/
1818

19-
#pragma once
19+
#ifndef ARDUINO_HARDWARE_SERIAL_H
20+
#define ARDUINO_HARDWARE_SERIAL_H
2021

21-
#include <inttypes.h>
22-
#include "Stream.h"
22+
#ifdef __cplusplus
23+
24+
#include <stdint.h>
25+
26+
#include "A_Stream.h"
2327

2428
// XXX: Those constants should be defined as const int / enums?
2529
// XXX: shall we use namespaces too?
@@ -100,3 +104,6 @@ class HardwareSerial : public Stream
100104
// XXX: Are we keeping the serialEvent API?
101105
extern void serialEventRun(void) __attribute__((weak));
102106

107+
#endif // __cplusplus
108+
109+
#endif // ARDUINO_HARDWARE_SERIAL_H

api/IPAddress.h renamed to api/A_IPAddress.h

+10-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1818
*/
1919

20-
#pragma once
20+
#ifndef ARDUINO_IP_ADDRESS_H
21+
#define ARDUINO_IP_ADDRESS_H
22+
23+
#ifdef __cplusplus
2124

2225
#include <stdint.h>
23-
#include "Printable.h"
24-
#include "String.h"
26+
27+
#include "A_Printable.h"
28+
#include "A_String.h"
2529

2630
// A class to make it easier to handle and pass around IP addresses
2731

@@ -75,3 +79,6 @@ class IPAddress : public Printable {
7579

7680
extern const IPAddress INADDR_NONE;
7781

82+
#endif // __cplusplus
83+
84+
#endif // ARDUINO_IP_ADDRESS_H

api/WInterrupts.h renamed to api/A_Interrupts.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#pragma once
1+
#ifndef ARDUINO_INTERRUPTS_H
2+
#define ARDUINO_INTERRUPTS_H
23

3-
#include "WTypes.h"
4-
5-
#include <stdint.h>
4+
#include "A_Types.h"
65

76
// interrupts() / noInterrupts() must be defined by the core
87

@@ -20,3 +19,5 @@ void detachInterrupt(pin_size_t interruptNumber);
2019
#ifdef __cplusplus
2120
} // extern "C"
2221
#endif
22+
23+
#endif // ARDUINO_INTERRUPTS_H

api/WMath.h renamed to api/A_Math.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
#pragma once
1+
#ifndef ARDUINO_MATH_H
2+
#define ARDUINO_MATH_H
23

34
#include <math.h>
4-
#include "WTypes.h"
5+
#include <stdint.h>
6+
7+
#include "A_Types.h"
58

69
#define PI 3.1415926535897932384626433832795
710
#define HALF_PI 1.5707963267948966192313216916398
@@ -76,4 +79,6 @@ word makeWord(byte h, byte l);
7679

7780
#define word(...) makeWord(__VA_ARGS__)
7881

79-
#endif
82+
#endif // __cplusplus
83+
84+
#endif // ARDUINO_MATH_H
+7-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
#pragma once
1+
#ifndef ARDUINO_MEMORY_H
2+
#define ARDUINO_MEMORY_H
23

34
#ifdef __cplusplus
4-
#include <stdlib.h>
5+
6+
#include <stddef.h>
57

68
void *operator new(size_t size);
79
void operator delete(void *ptr);
810
void *operator new[](size_t size);
911
void operator delete[](void *ptr);
1012

11-
#endif
13+
#endif // __cplusplus
14+
15+
#endif // ARDUINO_MEMORY_H

api/PluggableUSB.h renamed to api/A_PluggableUSB.h

+10-5
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@
1717
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1818
*/
1919

20-
#ifndef PUSB_h
21-
#define PUSB_h
20+
#ifndef ARDUINO_PLUGGABLE_USB_H
21+
#define ARDUINO_PLUGGABLE_USB_H
22+
23+
#ifdef __cplusplus
2224

23-
#include "USBAPI.h"
24-
#include <stdint.h>
2525
#include <stddef.h>
26+
#include <stdint.h>
27+
28+
#include "A_USBAPI.h"
2629

2730
// core need to define
2831
void* epBuffer(unsigned int n); // -> returns a poointer to the Nth element of the EP buffer structure
@@ -72,4 +75,6 @@ class PluggableUSB_ {
7275
// https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use
7376
PluggableUSB_& PluggableUSB();
7477

75-
#endif
78+
#endif // __cplusplus
79+
80+
#endif // ARDUINO_PLUGGABLE_USB_H

api/Print.h renamed to api/A_Print.h

+10-4
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@
1616
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1717
*/
1818

19-
#pragma once
19+
#ifndef ARDUINO_PRINT_H
20+
#define ARDUINO_PRINT_H
21+
22+
#ifdef __cplusplus
2023

2124
#include <inttypes.h>
22-
#include <stdio.h> // for size_t
25+
#include <stddef.h>
2326

24-
#include "String.h"
25-
#include "Printable.h"
27+
#include "A_Printable.h"
28+
#include "A_String.h"
2629

2730
#define DEC 10
2831
#define HEX 16
@@ -82,3 +85,6 @@ class Print
8285
size_t println(void);
8386
};
8487

88+
#endif // __cplusplus
89+
90+
#endif // ARDUINO_PRINT_H

api/Printable.h renamed to api/A_Printable.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1717
*/
1818

19-
#pragma once
19+
#ifndef ARDUINO_PRINTABLE_H
20+
#define ARDUINO_PRINTABLE_H
2021

21-
#include <stdlib.h>
22+
#ifdef __cplusplus
23+
24+
#include <stddef.h>
2225

2326
class Print;
2427

@@ -34,3 +37,6 @@ class Printable
3437
virtual size_t printTo(Print& p) const = 0;
3538
};
3639

40+
#endif // __cplusplus
41+
42+
#endif // ARDUINO_PRINTABLE_H
+9-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
#pragma once
1+
#ifndef ARDUINO_PULSE_H
2+
#define ARDUINO_PULSE_H
3+
4+
#include "A_Types.h"
5+
6+
unsigned long pulseIn(pin_size_t pin, PinStatus state, unsigned long timeout);
7+
unsigned long pulseInLong(pin_size_t pin, PinStatus state, unsigned long timeout);
28

39
#ifdef __cplusplus
4-
#include <stdint.h>
510

611
unsigned long pulseIn(pin_size_t pin, PinStatus state, unsigned long timeout = 1000000L);
712
unsigned long pulseInLong(pin_size_t pin, PinStatus state, unsigned long timeout = 1000000L);
8-
unsigned long pulseIn(pin_size_t pin, PinStatus state, unsigned long timeout);
9-
unsigned long pulseInLong(pin_size_t pin, PinStatus state, unsigned long timeout);
1013

14+
#endif // __cplusplus
1115

12-
#endif
16+
#endif // ARDUINO_PULSE_H
+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#pragma once
1+
#ifndef ARDUINO_RANDOM_H
2+
#define ARDUINO_RANDOM_H
23

34
#ifdef __cplusplus
45

@@ -7,4 +8,6 @@ long random(long min, long max);
78

89
void randomSeed(unsigned long seed);
910

10-
#endif
11+
#endif // __cplusplus
12+
13+
#endif // ARDUINO_RANDOM_H

api/RingBuffer.h renamed to api/A_RingBuffer.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1717
*/
1818

19-
#ifdef __cplusplus
19+
#ifndef ARDUINO_RING_BUFFER_H
20+
#define ARDUINO_RING_BUFFER_H
2021

21-
#ifndef _RING_BUFFER_
22-
#define _RING_BUFFER_
22+
#ifdef __cplusplus
2323

2424
#include <stdint.h>
2525

@@ -137,6 +137,6 @@ bool RingBufferN<N>::isFull()
137137
return (nextIndex(_iHead) == _iTail);
138138
}
139139

140-
#endif /* _RING_BUFFER_ */
140+
#endif // __cplusplus
141141

142-
#endif /* __cplusplus */
142+
#endif // ARDUINO_RING_BUFFER_H

api/Server.h renamed to api/A_Server.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@
1717
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1818
*/
1919

20-
#pragma once
20+
#ifndef ARDUINO_SERVER_H
21+
#define ARDUINO_SERVER_H
2122

22-
#include "Print.h"
23+
#ifdef __cplusplus
24+
25+
#include "A_Print.h"
2326

2427
class Server : public Print {
2528
public:
2629
virtual void begin() = 0;
2730
};
2831

32+
#endif // __cplusplus
33+
34+
#endif // ARDUINO_SERVER_H

0 commit comments

Comments
 (0)