Skip to content

Commit 552f51b

Browse files
committed
lock down dependencies version
1 parent fa11c24 commit 552f51b

File tree

3 files changed

+93
-632
lines changed

3 files changed

+93
-632
lines changed

Diff for: cores/esp32/Arduino.h

+71-58
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "soc/gpio_reg.h"
3939

4040
#include "stdlib_noniso.h"
41-
#include "binary.h"
4241
#include "extra_attr.h"
4342

4443
#define PI 3.1415926535897932384626433832795
@@ -48,19 +47,19 @@
4847
#define RAD_TO_DEG 57.295779513082320876798154814105
4948
#define EULER 2.718281828459045235360287471352
5049

51-
#define SERIAL 0x0
50+
#define SERIAL 0x0
5251
#define DISPLAY 0x1
5352

5453
#define LSBFIRST 0
5554
#define MSBFIRST 1
5655

57-
//Interrupt Modes
58-
#define RISING 0x01
59-
#define FALLING 0x02
60-
#define CHANGE 0x03
61-
#define ONLOW 0x04
62-
#define ONHIGH 0x05
63-
#define ONLOW_WE 0x0C
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
6463
#define ONHIGH_WE 0x0D
6564

6665
#define DEFAULT 1
@@ -71,27 +70,27 @@
7170
#endif
7271

7372
// can't define max() / min() because of conflicts with C++
74-
#define _min(a,b) ((a)<(b)?(a):(b))
75-
#define _max(a,b) ((a)>(b)?(a):(b))
76-
#define _abs(x) ((x)>0?(x):-(x)) // abs() comes from STL
77-
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
78-
#define _round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) // round() comes from STL
79-
#define radians(deg) ((deg)*DEG_TO_RAD)
80-
#define degrees(rad) ((rad)*RAD_TO_DEG)
81-
#define sq(x) ((x)*(x))
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))
8281

8382
// ESP32xx runs FreeRTOS... disabling interrupts can lead to issues, such as Watchdog Timeout
8483
#define sei() portENABLE_INTERRUPTS()
8584
#define cli() portDISABLE_INTERRUPTS()
8685
#define interrupts() sei()
8786
#define noInterrupts() cli()
8887

89-
#define clockCyclesPerMicrosecond() ( (long int)getCpuFrequencyMhz() )
90-
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
91-
#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
88+
#define clockCyclesPerMicrosecond() ((long int)getCpuFrequencyMhz())
89+
#define clockCyclesToMicroseconds(a) ((a) / clockCyclesPerMicrosecond())
90+
#define microsecondsToClockCycles(a) ((a) * clockCyclesPerMicrosecond())
9291

93-
#define lowByte(w) ((uint8_t) ((w) & 0xff))
94-
#define highByte(w) ((uint8_t) ((w) >> 8))
92+
#define lowByte(w) ((uint8_t)((w) & 0xff))
93+
#define highByte(w) ((uint8_t)((w) >> 8))
9594

9695
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
9796
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
@@ -101,26 +100,30 @@
101100

102101
// avr-libc defines _NOP() since 1.6.2
103102
#ifndef _NOP
104-
#define _NOP() do { __asm__ volatile ("nop"); } while (0)
103+
#define _NOP() \
104+
do \
105+
{ \
106+
__asm__ volatile("nop"); \
107+
} while (0)
105108
#endif
106109

107110
#define bit(b) (1UL << (b))
108111
#define _BV(b) (1UL << (b))
109112

110-
#define digitalPinToTimer(pin) (0)
111-
#define analogInPinToBit(P) (P)
113+
#define digitalPinToTimer(pin) (0)
114+
#define analogInPinToBit(P) (P)
112115
#if SOC_GPIO_PIN_COUNT <= 32
113-
#define digitalPinToPort(pin) (0)
114-
#define digitalPinToBitMask(pin) (1UL << digitalPinToGPIONumber(pin))
115-
#define portOutputRegister(port) ((volatile uint32_t*)GPIO_OUT_REG)
116-
#define portInputRegister(port) ((volatile uint32_t*)GPIO_IN_REG)
117-
#define portModeRegister(port) ((volatile uint32_t*)GPIO_ENABLE_REG)
116+
#define digitalPinToPort(pin) (0)
117+
#define digitalPinToBitMask(pin) (1UL << digitalPinToGPIONumber(pin))
118+
#define portOutputRegister(port) ((volatile uint32_t *)GPIO_OUT_REG)
119+
#define portInputRegister(port) ((volatile uint32_t *)GPIO_IN_REG)
120+
#define portModeRegister(port) ((volatile uint32_t *)GPIO_ENABLE_REG)
118121
#elif SOC_GPIO_PIN_COUNT <= 64
119-
#define digitalPinToPort(pin) ((digitalPinToGPIONumber(pin)>31)?1:0)
120-
#define digitalPinToBitMask(pin) (1UL << (digitalPinToGPIONumber(pin)&31))
121-
#define portOutputRegister(port) ((volatile uint32_t*)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
122-
#define portInputRegister(port) ((volatile uint32_t*)((port)?GPIO_IN1_REG:GPIO_IN_REG))
123-
#define portModeRegister(port) ((volatile uint32_t*)((port)?GPIO_ENABLE1_REG:GPIO_ENABLE_REG))
122+
#define digitalPinToPort(pin) ((digitalPinToGPIONumber(pin) > 31) ? 1 : 0)
123+
#define digitalPinToBitMask(pin) (1UL << (digitalPinToGPIONumber(pin) & 31))
124+
#define portOutputRegister(port) ((volatile uint32_t *)((port) ? GPIO_OUT1_REG : GPIO_OUT_REG))
125+
#define portInputRegister(port) ((volatile uint32_t *)((port) ? GPIO_IN1_REG : GPIO_IN_REG))
126+
#define portModeRegister(port) ((volatile uint32_t *)((port) ? GPIO_ENABLE1_REG : GPIO_ENABLE_REG))
124127
#else
125128
#error SOC_GPIO_PIN_COUNT > 64 not implemented
126129
#endif
@@ -131,16 +134,16 @@
131134
#define NOT_ON_TIMER 0
132135

133136
// some defines generic for all SoC moved from variants/board_name/pins_arduino.h
134-
#define NUM_DIGITAL_PINS SOC_GPIO_PIN_COUNT // All GPIOs
137+
#define NUM_DIGITAL_PINS SOC_GPIO_PIN_COUNT // All GPIOs
135138
#if SOC_ADC_PERIPH_NUM == 1
136-
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0)) // Depends on the SoC (ESP32C6, ESP32H2, ESP32C2, ESP32P4)
139+
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0)) // Depends on the SoC (ESP32C6, ESP32H2, ESP32C2, ESP32P4)
137140
#elif SOC_ADC_PERIPH_NUM == 2
138-
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0)+SOC_ADC_CHANNEL_NUM(1)) // Depends on the SoC (ESP32, ESP32S2, ESP32S3, ESP32C3)
141+
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0) + SOC_ADC_CHANNEL_NUM(1)) // Depends on the SoC (ESP32, ESP32S2, ESP32S3, ESP32C3)
139142
#endif
140-
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs
141-
#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
142-
#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p))<NUM_DIGITAL_PINS)?digitalPinToGPIONumber(p):NOT_AN_INTERRUPT)
143-
#define digitalPinHasPWM(p) (((uint8_t)digitalPinToGPIONumber(p))<NUM_DIGITAL_PINS)
143+
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs
144+
#define analogInputToDigitalPin(p) (((p) < NUM_ANALOG_INPUTS) ? (analogChannelToDigitalPin(p)) : -1)
145+
#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p)) < NUM_DIGITAL_PINS) ? digitalPinToGPIONumber(p) : NOT_AN_INTERRUPT)
146+
#define digitalPinHasPWM(p) (((uint8_t)digitalPinToGPIONumber(p)) < NUM_DIGITAL_PINS)
144147

145148
typedef bool boolean;
146149
typedef uint8_t byte;
@@ -150,7 +153,7 @@ typedef unsigned int word;
150153
void setup(void);
151154
void loop(void);
152155

153-
// The default is using Real Hardware random number generator
156+
// The default is using Real Hardware random number generator
154157
// But when randomSeed() is called, it turns to Psedo random
155158
// generator, exactly as done in Arduino mainstream
156159
long random(long);
@@ -166,18 +169,19 @@ void useRealRandomGenerator(bool useRandomHW);
166169
long map(long, long, long, long, long);
167170

168171
#ifdef __cplusplus
169-
extern "C" {
172+
extern "C"
173+
{
170174
#endif
171175

172-
void init(void);
173-
void initVariant(void);
174-
void initArduino(void);
176+
void init(void);
177+
void initVariant(void);
178+
void initArduino(void);
175179

176-
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
177-
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
180+
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
181+
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
178182

179-
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
180-
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
183+
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
184+
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
181185

182186
#ifdef __cplusplus
183187
}
@@ -211,23 +215,32 @@ uint16_t makeWord(uint8_t h, uint8_t l);
211215
#define word(...) makeWord(__VA_ARGS__)
212216

213217
size_t getArduinoLoopTaskStackSize(void);
214-
#define SET_LOOP_TASK_STACK_SIZE(sz) size_t getArduinoLoopTaskStackSize() { return sz;}
218+
#define SET_LOOP_TASK_STACK_SIZE(sz) \
219+
size_t getArduinoLoopTaskStackSize() { return sz; }
215220

216221
bool shouldPrintChipDebugReport(void);
217-
#define ENABLE_CHIP_DEBUG_REPORT bool shouldPrintChipDebugReport(void){return true;}
222+
#define ENABLE_CHIP_DEBUG_REPORT \
223+
bool shouldPrintChipDebugReport(void) { return true; }
218224

219225
// allows user to bypass esp_spiram_test()
220226
bool esp_psram_extram_test(void);
221-
#define BYPASS_SPIRAM_TEST(bypass) bool testSPIRAM(void) { if (bypass) return true; else return esp_psram_extram_test(); }
227+
#define BYPASS_SPIRAM_TEST(bypass) \
228+
bool testSPIRAM(void) \
229+
{ \
230+
if (bypass) \
231+
return true; \
232+
else \
233+
return esp_psram_extram_test(); \
234+
}
222235

223236
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
224237
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
225238

226-
extern "C" bool getLocalTime(struct tm * info, uint32_t ms = 5000);
239+
extern "C" bool getLocalTime(struct tm *info, uint32_t ms = 5000);
227240
extern "C" void configTime(long gmtOffset_sec, int daylightOffset_sec,
228-
const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
229-
extern "C" void configTzTime(const char* tz,
230-
const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
241+
const char *server1, const char *server2 = nullptr, const char *server3 = nullptr);
242+
extern "C" void configTzTime(const char *tz,
243+
const char *server1, const char *server2 = nullptr, const char *server3 = nullptr);
231244

232245
void setToneChannel(uint8_t channel = 0);
233246
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);

0 commit comments

Comments
 (0)