Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 41794fa

Browse files
giulcioffifacchinm
authored andcommittedApr 10, 2020
Remove common functions already implemented in API
1 parent 8ac2905 commit 41794fa

File tree

16 files changed

+2
-2998
lines changed

16 files changed

+2
-2998
lines changed
 

‎cores/arduino/Arduino.h

Lines changed: 2 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -20,47 +20,16 @@
2020
#ifndef Arduino_h
2121
#define Arduino_h
2222

23-
#include <stdlib.h>
24-
#include <stdbool.h>
25-
#include <string.h>
26-
#include <math.h>
27-
23+
#include "api/ArduinoAPI.h"
24+
#include "api/Common.h"
2825
#include <avr/pgmspace.h>
2926
#include <avr/io.h>
3027
#include <avr/interrupt.h>
3128

32-
#include "binary.h"
33-
3429
#ifdef __cplusplus
3530
extern "C"{
3631
#endif
3732

38-
void yield(void);
39-
40-
#define HIGH 0x1
41-
#define LOW 0x0
42-
43-
#define INPUT 0x0
44-
#define OUTPUT 0x1
45-
#define INPUT_PULLUP 0x2
46-
47-
#define PI 3.1415926535897932384626433832795
48-
#define HALF_PI 1.5707963267948966192313216916398
49-
#define TWO_PI 6.283185307179586476925286766559
50-
#define DEG_TO_RAD 0.017453292519943295769236907684886
51-
#define RAD_TO_DEG 57.295779513082320876798154814105
52-
#define EULER 2.718281828459045235360287471352
53-
54-
#define SERIAL 0x0
55-
#define DISPLAY 0x1
56-
57-
#define LSBFIRST 0
58-
#define MSBFIRST 1
59-
60-
#define CHANGE 1
61-
#define FALLING 2
62-
#define RISING 3
63-
6433
#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
6534
#define DEFAULT 0
6635
#define EXTERNAL 1
@@ -84,75 +53,18 @@ void yield(void);
8453
#define EXTERNAL 0
8554
#endif
8655

87-
// undefine stdlib's abs if encountered
88-
#ifdef abs
89-
#undef abs
90-
#endif
91-
92-
#define min(a,b) ((a)<(b)?(a):(b))
93-
#define max(a,b) ((a)>(b)?(a):(b))
94-
#define abs(x) ((x)>0?(x):-(x))
95-
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
96-
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
97-
#define radians(deg) ((deg)*DEG_TO_RAD)
98-
#define degrees(rad) ((rad)*RAD_TO_DEG)
99-
#define sq(x) ((x)*(x))
100-
10156
#define interrupts() sei()
10257
#define noInterrupts() cli()
10358

10459
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
10560
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
10661
#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
10762

108-
#define lowByte(w) ((uint8_t) ((w) & 0xff))
109-
#define highByte(w) ((uint8_t) ((w) >> 8))
110-
111-
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
112-
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
113-
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
114-
#define bitToggle(value, bit) ((value) ^= (1UL << (bit)))
115-
#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit))
116-
11763
// avr-libc defines _NOP() since 1.6.2
11864
#ifndef _NOP
11965
#define _NOP() do { __asm__ volatile ("nop"); } while (0)
12066
#endif
12167

122-
typedef unsigned int word;
123-
124-
#define bit(b) (1UL << (b))
125-
126-
typedef bool boolean;
127-
typedef uint8_t byte;
128-
129-
void init(void);
130-
void initVariant(void);
131-
132-
int atexit(void (*func)()) __attribute__((weak));
133-
134-
void pinMode(uint8_t pin, uint8_t mode);
135-
void digitalWrite(uint8_t pin, uint8_t val);
136-
int digitalRead(uint8_t pin);
137-
int analogRead(uint8_t pin);
138-
void analogReference(uint8_t mode);
139-
void analogWrite(uint8_t pin, int val);
140-
141-
unsigned long millis(void);
142-
unsigned long micros(void);
143-
void delay(unsigned long ms);
144-
void delayMicroseconds(unsigned int us);
145-
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
146-
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
147-
148-
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
149-
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
150-
151-
void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode);
152-
void detachInterrupt(uint8_t interruptNum);
153-
154-
void setup(void);
155-
void loop(void);
15668

15769
// Get the bit location within the hardware port of the given virtual pin.
15870
// This comes from the pins_*.c file for the active board configuration.
@@ -236,23 +148,6 @@ extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
236148
#error "Targets with both UART0 and CDC serial not supported"
237149
#endif
238150

239-
uint16_t makeWord(uint16_t w);
240-
uint16_t makeWord(byte h, byte l);
241-
242-
#define word(...) makeWord(__VA_ARGS__)
243-
244-
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
245-
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
246-
247-
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
248-
void noTone(uint8_t _pin);
249-
250-
// WMath prototypes
251-
long random(long);
252-
long random(long, long);
253-
void randomSeed(unsigned long);
254-
long map(long, long, long, long, long);
255-
256151
#endif
257152

258153
#include "pins_arduino.h"

‎cores/arduino/Client.h

Lines changed: 0 additions & 45 deletions
This file was deleted.

‎cores/arduino/IPAddress.cpp

Lines changed: 0 additions & 114 deletions
This file was deleted.

‎cores/arduino/IPAddress.h

Lines changed: 0 additions & 78 deletions
This file was deleted.

‎cores/arduino/Print.cpp

Lines changed: 0 additions & 266 deletions
This file was deleted.

‎cores/arduino/Print.h

Lines changed: 0 additions & 93 deletions
This file was deleted.

‎cores/arduino/Printable.h

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎cores/arduino/Server.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎cores/arduino/Stream.cpp

Lines changed: 0 additions & 318 deletions
This file was deleted.

‎cores/arduino/Stream.h

Lines changed: 0 additions & 129 deletions
This file was deleted.

‎cores/arduino/Udp.h

Lines changed: 0 additions & 89 deletions
This file was deleted.

‎cores/arduino/WCharacter.h

Lines changed: 0 additions & 168 deletions
This file was deleted.

‎cores/arduino/WMath.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,3 @@ long random(long howsmall, long howbig)
4848
long diff = howbig - howsmall;
4949
return random(diff) + howsmall;
5050
}
51-
52-
long map(long x, long in_min, long in_max, long out_min, long out_max)
53-
{
54-
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
55-
}
56-
57-
unsigned int makeWord(unsigned int w) { return w; }
58-
unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; }

‎cores/arduino/WString.cpp

Lines changed: 0 additions & 750 deletions
This file was deleted.

‎cores/arduino/WString.h

Lines changed: 0 additions & 229 deletions
This file was deleted.

‎cores/arduino/binary.h

Lines changed: 0 additions & 534 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.