Skip to content

Commit 011f86a

Browse files
committed
Files needed
1 parent 86ba53a commit 011f86a

File tree

10 files changed

+2748
-0
lines changed

10 files changed

+2748
-0
lines changed

cores/esp32/Arduino.h

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
/*
2+
Arduino.h - Main include file for the Arduino SDK
3+
Copyright (c) 2005-2013 Arduino Team. All right reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#ifndef Arduino_h
21+
#define Arduino_h
22+
23+
#include <stdbool.h>
24+
#include <stdint.h>
25+
#include <stdarg.h>
26+
#include <stddef.h>
27+
#include <stdio.h>
28+
#include <stdlib.h>
29+
#include <string.h>
30+
#include <inttypes.h>
31+
32+
//--//#include "esp_arduino_version.h"
33+
#include "freertos/FreeRTOS.h"
34+
#include "freertos/task.h"
35+
#include "freertos/semphr.h"
36+
//--//#include "esp32-hal.h"
37+
//--//#include "esp8266-compat.h"
38+
//--//#include "soc/gpio_reg.h"
39+
40+
#include "stdlib_noniso.h"
41+
//--//#include "binary.h"
42+
43+
#define PI 3.1415926535897932384626433832795
44+
#define HALF_PI 1.5707963267948966192313216916398
45+
#define TWO_PI 6.283185307179586476925286766559
46+
#define DEG_TO_RAD 0.017453292519943295769236907684886
47+
#define RAD_TO_DEG 57.295779513082320876798154814105
48+
#define EULER 2.718281828459045235360287471352
49+
50+
//--//#define SERIAL 0x0
51+
//--//#define DISPLAY 0x1
52+
53+
//--//#define LSBFIRST 0
54+
//--//#define MSBFIRST 1
55+
56+
//Interrupt Modes
57+
#define RISING 0x01
58+
#define FALLING 0x02
59+
#define CHANGE 0x03
60+
#define ONLOW 0x04
61+
#define ONHIGH 0x05
62+
#define ONLOW_WE 0x0C
63+
#define ONHIGH_WE 0x0D
64+
65+
//--//#define DEFAULT 1
66+
//--//#define EXTERNAL 0
67+
68+
#ifndef __STRINGIFY
69+
//--//#define __STRINGIFY(a) #a
70+
#endif
71+
72+
// can't define max() / min() because of conflicts with C++
73+
//--//#define _min(a,b) ((a)<(b)?(a):(b))
74+
//--//#define _max(a,b) ((a)>(b)?(a):(b))
75+
//--//#define _abs(x) ((x)>0?(x):-(x)) // abs() comes from STL
76+
//--//#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
77+
//--//#define _round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) // round() comes from STL
78+
//--//#define radians(deg) ((deg)*DEG_TO_RAD)
79+
//--//#define degrees(rad) ((rad)*RAD_TO_DEG)
80+
//--//#define sq(x) ((x)*(x))
81+
82+
// ESP32xx runs FreeRTOS... disabling interrupts can lead to issues, such as Watchdog Timeout
83+
//--//#define sei() portENABLE_INTERRUPTS()
84+
//--//#define cli() portDISABLE_INTERRUPTS()
85+
//--//#define interrupts() sei()
86+
//--//#define noInterrupts() cli()
87+
88+
//--//#define clockCyclesPerMicrosecond() ( (long int)getCpuFrequencyMhz() )
89+
//--//#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
90+
//--//#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
91+
92+
//--//#define lowByte(w) ((uint8_t) ((w) & 0xff))
93+
//--//#define highByte(w) ((uint8_t) ((w) >> 8))
94+
95+
//--//#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
96+
//--//#define bitSet(value, bit) ((value) |= (1UL << (bit)))
97+
//--//#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
98+
//--//#define bitToggle(value, bit) ((value) ^= (1UL << (bit)))
99+
//--//#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit))
100+
101+
// avr-libc defines _NOP() since 1.6.2
102+
#ifndef _NOP
103+
//--//#define _NOP() do { __asm__ volatile ("nop"); } while (0)
104+
#endif
105+
106+
//--//#define bit(b) (1UL << (b))
107+
//--//#define _BV(b) (1UL << (b))
108+
109+
//--//#define digitalPinToTimer(pin) (0)
110+
//--//#define analogInPinToBit(P) (P)
111+
#if SOC_GPIO_PIN_COUNT <= 32
112+
//--//#define digitalPinToPort(pin) (0)
113+
//--//#define digitalPinToBitMask(pin) (1UL << digitalPinToGPIONumber(pin))
114+
//--//#define portOutputRegister(port) ((volatile uint32_t*)GPIO_OUT_REG)
115+
//--//#define portInputRegister(port) ((volatile uint32_t*)GPIO_IN_REG)
116+
//--//#define portModeRegister(port) ((volatile uint32_t*)GPIO_ENABLE_REG)
117+
#elif SOC_GPIO_PIN_COUNT <= 64
118+
//--//#define digitalPinToPort(pin) ((digitalPinToGPIONumber(pin)>31)?1:0)
119+
//--//#define digitalPinToBitMask(pin) (1UL << (digitalPinToGPIONumber(pin)&31))
120+
//--//#define portOutputRegister(port) ((volatile uint32_t*)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
121+
//--//#define portInputRegister(port) ((volatile uint32_t*)((port)?GPIO_IN1_REG:GPIO_IN_REG))
122+
//--//#define portModeRegister(port) ((volatile uint32_t*)((port)?GPIO_ENABLE1_REG:GPIO_ENABLE_REG))
123+
#else
124+
//--//#error SOC_GPIO_PIN_COUNT > 64 not implemented
125+
#endif
126+
127+
//--//#define NOT_A_PIN -1
128+
//--//#define NOT_A_PORT -1
129+
//--//#define NOT_AN_INTERRUPT -1
130+
//--//#define NOT_ON_TIMER 0
131+
132+
typedef bool boolean;
133+
typedef uint8_t byte;
134+
typedef unsigned int word;
135+
136+
#ifdef __cplusplus
137+
void setup(void);
138+
void loop(void);
139+
140+
// The default is using Real Hardware random number generator
141+
// But when randomSeed() is called, it turns to Psedo random
142+
// generator, exactly as done in Arduino mainstream
143+
long random(long);
144+
long random(long, long);
145+
// Calling randomSeed() will make random()
146+
// using pseudo random like in Arduino
147+
void randomSeed(unsigned long);
148+
// Allow the Application to decide if the random generator
149+
// will use Real Hardware random generation (true - default)
150+
// or Pseudo random generation (false) as in Arduino MainStream
151+
void useRealRandomGenerator(bool useRandomHW);
152+
#endif
153+
long map(long, long, long, long, long);
154+
155+
#ifdef __cplusplus
156+
extern "C" {
157+
#endif
158+
159+
//--//void init(void);
160+
//--//void initVariant(void);
161+
//--//void initArduino(void);
162+
163+
//--//unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
164+
//--//unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
165+
166+
//--//uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
167+
//--//void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
168+
169+
#ifdef __cplusplus
170+
}
171+
172+
#include <algorithm>
173+
#include <cmath>
174+
175+
//--//#include "WCharacter.h"
176+
//--//#include "WString.h"
177+
//--//#include "Stream.h"
178+
//--//#include "Printable.h"
179+
//--//#include "Print.h"
180+
//--//#include "IPAddress.h"
181+
//--//#include "Client.h"
182+
//--//#include "Server.h"
183+
//--//#include "Udp.h"
184+
//--//#include "HardwareSerial.h"
185+
//--//#include "Esp.h"
186+
//--//#include "esp32/spiram.h"
187+
188+
// Use float-compatible stl abs() and round(), we don't use Arduino macros to avoid issues with the C++ libraries
189+
using std::abs;
190+
using std::isinf;
191+
using std::isnan;
192+
using std::max;
193+
using std::min;
194+
using std::round;
195+
196+
//--//uint16_t makeWord(uint16_t w);
197+
//--//uint16_t makeWord(uint8_t h, uint8_t l);
198+
199+
//--//#define word(...) makeWord(__VA_ARGS__)
200+
201+
//--//size_t getArduinoLoopTaskStackSize(void);
202+
//--//#define SET_LOOP_TASK_STACK_SIZE(sz) size_t getArduinoLoopTaskStackSize() { return sz;}
203+
204+
// allows user to bypass esp_spiram_test()
205+
//--//#define BYPASS_SPIRAM_TEST(bypass) bool testSPIRAM(void) { if (bypass) return true; else return esp_spiram_test(); }
206+
207+
//--//unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
208+
//--//unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
209+
210+
//--//extern "C" bool getLocalTime(struct tm * info, uint32_t ms = 5000);
211+
//--//extern "C" void configTime(long gmtOffset_sec, int daylightOffset_sec,
212+
//--// const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
213+
//--//extern "C" void configTzTime(const char* tz,
214+
//--// const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
215+
216+
//--//void setToneChannel(uint8_t channel = 0);
217+
//--//void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
218+
//--//void noTone(uint8_t _pin);
219+
220+
#endif /* __cplusplus */
221+
222+
//--//#include "pins_arduino.h"
223+
//--//#include "io_pin_remap.h"
224+
225+
#endif /* _ESP32_CORE_ARDUINO_H_ */

0 commit comments

Comments
 (0)