forked from espressif/arduino-esp32
Cleanup arduino useless bullshit
This commit is contained in:
@ -14,7 +14,6 @@ set(CORE_SRCS
|
||||
cores/esp32/esp32-hal-touch.c
|
||||
cores/esp32/esp32-hal-rmt.c
|
||||
cores/esp32/FunctionalInterrupt.cpp
|
||||
cores/esp32/IPv6Address.cpp
|
||||
cores/esp32/stdlib_noniso.c
|
||||
cores/esp32/USB.cpp
|
||||
cores/esp32/USBCDC.cpp
|
||||
|
@ -20,24 +20,24 @@
|
||||
#ifndef Arduino_h
|
||||
#define Arduino_h
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
//#include <stdbool.h>
|
||||
//#include <stdint.h>
|
||||
//#include <stdarg.h>
|
||||
//#include <stddef.h>
|
||||
//#include <stdio.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
//#include <inttypes.h>
|
||||
|
||||
#include "esp_arduino_version.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "esp32-hal.h"
|
||||
#include "esp8266-compat.h"
|
||||
#include "soc/gpio_reg.h"
|
||||
//#include "esp_arduino_version.h"
|
||||
//#include "freertos/FreeRTOS.h"
|
||||
//#include "freertos/task.h"
|
||||
//#include "freertos/semphr.h"
|
||||
//#include "esp32-hal.h"
|
||||
//#include "esp8266-compat.h"
|
||||
//#include "soc/gpio_reg.h"
|
||||
|
||||
#include "stdlib_noniso.h"
|
||||
//#include "stdlib_noniso.h"
|
||||
|
||||
//#define PI 3.1415926535897932384626433832795
|
||||
//#define HALF_PI 1.5707963267948966192313216916398
|
||||
@ -49,112 +49,102 @@
|
||||
//#define SERIAL 0x0
|
||||
//#define DISPLAY 0x1
|
||||
|
||||
#define LSBFIRST 0
|
||||
#define MSBFIRST 1
|
||||
|
||||
//Interrupt Modes
|
||||
#define RISING 0x01
|
||||
#define FALLING 0x02
|
||||
#define CHANGE 0x03
|
||||
#define ONLOW 0x04
|
||||
#define ONHIGH 0x05
|
||||
#define ONLOW_WE 0x0C
|
||||
#define ONHIGH_WE 0x0D
|
||||
//#define RISING 0x01
|
||||
//#define FALLING 0x02
|
||||
//#define CHANGE 0x03
|
||||
//#define ONLOW 0x04
|
||||
//#define ONHIGH 0x05
|
||||
//#define ONLOW_WE 0x0C
|
||||
//#define ONHIGH_WE 0x0D
|
||||
|
||||
#define DEFAULT 1
|
||||
#define EXTERNAL 0
|
||||
//#define DEFAULT 1
|
||||
//#define EXTERNAL 0
|
||||
|
||||
#ifndef __STRINGIFY
|
||||
#define __STRINGIFY(a) #a
|
||||
#endif
|
||||
//#ifndef __STRINGIFY
|
||||
//#define __STRINGIFY(a) #a
|
||||
//#endif
|
||||
|
||||
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
|
||||
#define radians(deg) ((deg)*DEG_TO_RAD)
|
||||
#define degrees(rad) ((rad)*RAD_TO_DEG)
|
||||
#define sq(x) ((x)*(x))
|
||||
//#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
|
||||
//#define radians(deg) ((deg)*DEG_TO_RAD)
|
||||
//#define degrees(rad) ((rad)*RAD_TO_DEG)
|
||||
//#define sq(x) ((x)*(x))
|
||||
|
||||
#define sei()
|
||||
#define cli()
|
||||
#define interrupts() sei()
|
||||
#define noInterrupts() cli()
|
||||
//#define sei()
|
||||
//#define cli()
|
||||
//#define interrupts() sei()
|
||||
//#define noInterrupts() cli()
|
||||
|
||||
#define clockCyclesPerMicrosecond() ( (long int)getCpuFrequencyMhz() )
|
||||
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
|
||||
#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
|
||||
//#define lowByte(w) ((uint8_t) ((w) & 0xff))
|
||||
//#define highByte(w) ((uint8_t) ((w) >> 8))
|
||||
|
||||
#define lowByte(w) ((uint8_t) ((w) & 0xff))
|
||||
#define highByte(w) ((uint8_t) ((w) >> 8))
|
||||
//#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
|
||||
//#define bitSet(value, bit) ((value) |= (1UL << (bit)))
|
||||
//#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
|
||||
//#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit))
|
||||
|
||||
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
|
||||
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
|
||||
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
|
||||
#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit))
|
||||
//// avr-libc defines _NOP() since 1.6.2
|
||||
//#ifndef _NOP
|
||||
//#define _NOP() do { __asm__ volatile ("nop"); } while (0)
|
||||
//#endif
|
||||
|
||||
// avr-libc defines _NOP() since 1.6.2
|
||||
#ifndef _NOP
|
||||
#define _NOP() do { __asm__ volatile ("nop"); } while (0)
|
||||
#endif
|
||||
//#define bit(b) (1UL << (b))
|
||||
//#define _BV(b) (1UL << (b))
|
||||
|
||||
#define bit(b) (1UL << (b))
|
||||
#define _BV(b) (1UL << (b))
|
||||
//#define digitalPinToPort(pin) (((pin)>31)?1:0)
|
||||
//#define digitalPinToBitMask(pin) (1UL << (((pin)>31)?((pin)-32):(pin)))
|
||||
//#define digitalPinToTimer(pin) (0)
|
||||
//#define analogInPinToBit(P) (P)
|
||||
//#define portOutputRegister(port) ((volatile uint32_t*)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
|
||||
//#define portInputRegister(port) ((volatile uint32_t*)((port)?GPIO_IN1_REG:GPIO_IN_REG))
|
||||
//#define portModeRegister(port) ((volatile uint32_t*)((port)?GPIO_ENABLE1_REG:GPIO_ENABLE_REG))
|
||||
|
||||
#define digitalPinToPort(pin) (((pin)>31)?1:0)
|
||||
#define digitalPinToBitMask(pin) (1UL << (((pin)>31)?((pin)-32):(pin)))
|
||||
#define digitalPinToTimer(pin) (0)
|
||||
#define analogInPinToBit(P) (P)
|
||||
#define portOutputRegister(port) ((volatile uint32_t*)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
|
||||
#define portInputRegister(port) ((volatile uint32_t*)((port)?GPIO_IN1_REG:GPIO_IN_REG))
|
||||
#define portModeRegister(port) ((volatile uint32_t*)((port)?GPIO_ENABLE1_REG:GPIO_ENABLE_REG))
|
||||
//#define NOT_A_PIN -1
|
||||
//#define NOT_A_PORT -1
|
||||
//#define NOT_AN_INTERRUPT -1
|
||||
//#define NOT_ON_TIMER 0
|
||||
|
||||
#define NOT_A_PIN -1
|
||||
#define NOT_A_PORT -1
|
||||
#define NOT_AN_INTERRUPT -1
|
||||
#define NOT_ON_TIMER 0
|
||||
//typedef bool boolean;
|
||||
//typedef uint8_t byte;
|
||||
//typedef unsigned int word;
|
||||
|
||||
typedef bool boolean;
|
||||
typedef uint8_t byte;
|
||||
typedef unsigned int word;
|
||||
//long map(long, long, long, long, long);
|
||||
|
||||
long map(long, long, long, long, long);
|
||||
//#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
//#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
//unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
|
||||
//unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
|
||||
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
|
||||
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
|
||||
//#ifdef __cplusplus
|
||||
//}
|
||||
|
||||
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
|
||||
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
|
||||
//#include <algorithm>
|
||||
//#include <cmath>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
//#include "WCharacter.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
//using std::abs;
|
||||
//using std::isinf;
|
||||
//using std::isnan;
|
||||
//using std::max;
|
||||
//using std::min;
|
||||
//using ::round;
|
||||
|
||||
#include "WCharacter.h"
|
||||
//uint16_t makeWord(uint16_t w);
|
||||
//uint16_t makeWord(byte h, byte l);
|
||||
|
||||
using std::abs;
|
||||
using std::isinf;
|
||||
using std::isnan;
|
||||
using std::max;
|
||||
using std::min;
|
||||
using ::round;
|
||||
//#define word(...) makeWord(__VA_ARGS__)
|
||||
|
||||
uint16_t makeWord(uint16_t w);
|
||||
uint16_t makeWord(byte h, byte l);
|
||||
//unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
||||
//unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
||||
|
||||
#define word(...) makeWord(__VA_ARGS__)
|
||||
//#endif /* __cplusplus */
|
||||
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
||||
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
||||
//#define _min(a,b) ((a)<(b)?(a):(b))
|
||||
//#define _max(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define _min(a,b) ((a)<(b)?(a):(b))
|
||||
#define _max(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
#include "pins_arduino.h"
|
||||
//#include "pins_arduino.h"
|
||||
|
||||
#endif /* _ESP32_CORE_ARDUINO_H_ */
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "FunctionalInterrupt.h"
|
||||
#include "Arduino.h"
|
||||
#include "esp32-hal.h"
|
||||
|
||||
typedef void (*voidFuncPtr)(void);
|
||||
typedef void (*voidFuncPtrArg)(void*);
|
||||
|
@ -1,89 +0,0 @@
|
||||
/*
|
||||
IPv6Address.cpp - Base class that provides IPv6Address
|
||||
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <IPv6Address.h>
|
||||
|
||||
IPv6Address::IPv6Address()
|
||||
{
|
||||
memset(_address.bytes, 0, sizeof(_address.bytes));
|
||||
}
|
||||
|
||||
IPv6Address::IPv6Address(const uint8_t *address)
|
||||
{
|
||||
memcpy(_address.bytes, address, sizeof(_address.bytes));
|
||||
}
|
||||
|
||||
IPv6Address::IPv6Address(const uint32_t *address)
|
||||
{
|
||||
memcpy(_address.bytes, (const uint8_t *)address, sizeof(_address.bytes));
|
||||
}
|
||||
|
||||
IPv6Address& IPv6Address::operator=(const uint8_t *address)
|
||||
{
|
||||
memcpy(_address.bytes, address, sizeof(_address.bytes));
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool IPv6Address::operator==(const uint8_t* addr) const
|
||||
{
|
||||
return memcmp(addr, _address.bytes, sizeof(_address.bytes)) == 0;
|
||||
}
|
||||
|
||||
//size_t IPv6Address::printTo(Print& p) const
|
||||
//{
|
||||
// size_t n = 0;
|
||||
// for(int i = 0; i < 16; i+=2) {
|
||||
// if(i){
|
||||
// n += p.print(':');
|
||||
// }
|
||||
// n += p.printf("%02x", _address.bytes[i]);
|
||||
// n += p.printf("%02x", _address.bytes[i+1]);
|
||||
|
||||
// }
|
||||
// return n;
|
||||
//}
|
||||
|
||||
std::string IPv6Address::toString() const
|
||||
{
|
||||
char szRet[40];
|
||||
sprintf(szRet,"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
|
||||
_address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3],
|
||||
_address.bytes[4], _address.bytes[5], _address.bytes[6], _address.bytes[7],
|
||||
_address.bytes[8], _address.bytes[9], _address.bytes[10], _address.bytes[11],
|
||||
_address.bytes[12], _address.bytes[13], _address.bytes[14], _address.bytes[15]);
|
||||
return std::string(szRet);
|
||||
}
|
||||
|
||||
bool IPv6Address::fromString(const char *address)
|
||||
{
|
||||
//format 0011:2233:4455:6677:8899:aabb:ccdd:eeff
|
||||
if(strlen(address) != 39){
|
||||
return false;
|
||||
}
|
||||
char * pos = (char *)address;
|
||||
size_t i = 0;
|
||||
for(i = 0; i < 16; i+=2) {
|
||||
if(!sscanf(pos, "%2hhx", &_address.bytes[i]) || !sscanf(pos+2, "%2hhx", &_address.bytes[i+1])){
|
||||
return false;
|
||||
}
|
||||
pos += 5;
|
||||
}
|
||||
return true;
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
/*
|
||||
IPv6Address.h - Base class that provides IPv6Address
|
||||
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef IPv6Address_h
|
||||
#define IPv6Address_h
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
// A class to make it easier to handle and pass around IP addresses
|
||||
|
||||
class IPv6Address
|
||||
{
|
||||
private:
|
||||
union {
|
||||
uint8_t bytes[16]; // IPv4 address
|
||||
uint32_t dword[4];
|
||||
} _address;
|
||||
|
||||
// Access the raw byte array containing the address. Because this returns a pointer
|
||||
// to the internal structure rather than a copy of the address this function should only
|
||||
// be used when you know that the usage of the returned uint8_t* will be transient and not
|
||||
// stored.
|
||||
uint8_t* raw_address()
|
||||
{
|
||||
return _address.bytes;
|
||||
}
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
IPv6Address();
|
||||
IPv6Address(const uint8_t *address);
|
||||
IPv6Address(const uint32_t *address);
|
||||
|
||||
bool fromString(const char *address);
|
||||
bool fromString(const std::string &address) { return fromString(address.c_str()); }
|
||||
|
||||
operator const uint8_t*() const
|
||||
{
|
||||
return _address.bytes;
|
||||
}
|
||||
operator const uint32_t*() const
|
||||
{
|
||||
return _address.dword;
|
||||
}
|
||||
bool operator==(const IPv6Address& addr) const
|
||||
{
|
||||
return (_address.dword[0] == addr._address.dword[0])
|
||||
&& (_address.dword[1] == addr._address.dword[1])
|
||||
&& (_address.dword[2] == addr._address.dword[2])
|
||||
&& (_address.dword[3] == addr._address.dword[3]);
|
||||
}
|
||||
bool operator==(const uint8_t* addr) const;
|
||||
|
||||
// Overloaded index operator to allow getting and setting individual octets of the address
|
||||
uint8_t operator[](int index) const
|
||||
{
|
||||
return _address.bytes[index];
|
||||
}
|
||||
uint8_t& operator[](int index)
|
||||
{
|
||||
return _address.bytes[index];
|
||||
}
|
||||
|
||||
// Overloaded copy operators to allow initialisation of IPv6Address objects from other types
|
||||
IPv6Address& operator=(const uint8_t *address);
|
||||
|
||||
// virtual size_t printTo(Print& p) const;
|
||||
std::string toString() const;
|
||||
|
||||
friend class UDP;
|
||||
friend class Client;
|
||||
friend class Server;
|
||||
};
|
||||
|
||||
#endif
|
@ -25,83 +25,83 @@
|
||||
#define toascii(__c) ((__c)&0177)
|
||||
|
||||
// WCharacter.h prototypes
|
||||
inline boolean isAlphaNumeric(int c) __attribute__((always_inline));
|
||||
inline boolean isAlpha(int c) __attribute__((always_inline));
|
||||
inline boolean isAscii(int c) __attribute__((always_inline));
|
||||
inline boolean isWhitespace(int c) __attribute__((always_inline));
|
||||
inline boolean isControl(int c) __attribute__((always_inline));
|
||||
inline boolean isDigit(int c) __attribute__((always_inline));
|
||||
inline boolean isGraph(int c) __attribute__((always_inline));
|
||||
inline boolean isLowerCase(int c) __attribute__((always_inline));
|
||||
inline boolean isPrintable(int c) __attribute__((always_inline));
|
||||
inline boolean isPunct(int c) __attribute__((always_inline));
|
||||
inline boolean isSpace(int c) __attribute__((always_inline));
|
||||
inline boolean isUpperCase(int c) __attribute__((always_inline));
|
||||
inline boolean isHexadecimalDigit(int c) __attribute__((always_inline));
|
||||
inline bool isAlphaNumeric(int c) __attribute__((always_inline));
|
||||
inline bool isAlpha(int c) __attribute__((always_inline));
|
||||
inline bool isAscii(int c) __attribute__((always_inline));
|
||||
inline bool isWhitespace(int c) __attribute__((always_inline));
|
||||
inline bool isControl(int c) __attribute__((always_inline));
|
||||
inline bool isDigit(int c) __attribute__((always_inline));
|
||||
inline bool isGraph(int c) __attribute__((always_inline));
|
||||
inline bool isLowerCase(int c) __attribute__((always_inline));
|
||||
inline bool isPrintable(int c) __attribute__((always_inline));
|
||||
inline bool isPunct(int c) __attribute__((always_inline));
|
||||
inline bool isSpace(int c) __attribute__((always_inline));
|
||||
inline bool isUpperCase(int c) __attribute__((always_inline));
|
||||
inline bool isHexadecimalDigit(int c) __attribute__((always_inline));
|
||||
inline int toAscii(int c) __attribute__((always_inline));
|
||||
inline int toLowerCase(int c) __attribute__((always_inline));
|
||||
inline int toUpperCase(int c) __attribute__((always_inline));
|
||||
|
||||
// Checks for an alphanumeric character.
|
||||
// It is equivalent to (isalpha(c) || isdigit(c)).
|
||||
inline boolean isAlphaNumeric(int c)
|
||||
inline bool isAlphaNumeric(int c)
|
||||
{
|
||||
return (isalnum(c) == 0 ? false : true);
|
||||
}
|
||||
|
||||
// Checks for an alphabetic character.
|
||||
// It is equivalent to (isupper(c) || islower(c)).
|
||||
inline boolean isAlpha(int c)
|
||||
inline bool isAlpha(int c)
|
||||
{
|
||||
return (isalpha(c) == 0 ? false : true);
|
||||
}
|
||||
|
||||
// Checks whether c is a 7-bit unsigned char value
|
||||
// that fits into the ASCII character set.
|
||||
inline boolean isAscii(int c)
|
||||
inline bool isAscii(int c)
|
||||
{
|
||||
return ( isascii (c) == 0 ? false : true);
|
||||
}
|
||||
|
||||
// Checks for a blank character, that is, a space or a tab.
|
||||
inline boolean isWhitespace(int c)
|
||||
inline bool isWhitespace(int c)
|
||||
{
|
||||
return (isblank(c) == 0 ? false : true);
|
||||
}
|
||||
|
||||
// Checks for a control character.
|
||||
inline boolean isControl(int c)
|
||||
inline bool isControl(int c)
|
||||
{
|
||||
return (iscntrl(c) == 0 ? false : true);
|
||||
}
|
||||
|
||||
// Checks for a digit (0 through 9).
|
||||
inline boolean isDigit(int c)
|
||||
inline bool isDigit(int c)
|
||||
{
|
||||
return (isdigit(c) == 0 ? false : true);
|
||||
}
|
||||
|
||||
// Checks for any printable character except space.
|
||||
inline boolean isGraph(int c)
|
||||
inline bool isGraph(int c)
|
||||
{
|
||||
return (isgraph(c) == 0 ? false : true);
|
||||
}
|
||||
|
||||
// Checks for a lower-case character.
|
||||
inline boolean isLowerCase(int c)
|
||||
inline bool isLowerCase(int c)
|
||||
{
|
||||
return (islower(c) == 0 ? false : true);
|
||||
}
|
||||
|
||||
// Checks for any printable character including space.
|
||||
inline boolean isPrintable(int c)
|
||||
inline bool isPrintable(int c)
|
||||
{
|
||||
return (isprint(c) == 0 ? false : true);
|
||||
}
|
||||
|
||||
// Checks for any printable character which is not a space
|
||||
// or an alphanumeric character.
|
||||
inline boolean isPunct(int c)
|
||||
inline bool isPunct(int c)
|
||||
{
|
||||
return (ispunct(c) == 0 ? false : true);
|
||||
}
|
||||
@ -109,20 +109,20 @@ inline boolean isPunct(int c)
|
||||
// Checks for white-space characters. For the avr-libc library,
|
||||
// these are: space, formfeed ('\f'), newline ('\n'), carriage
|
||||
// return ('\r'), horizontal tab ('\t'), and vertical tab ('\v').
|
||||
inline boolean isSpace(int c)
|
||||
inline bool isSpace(int c)
|
||||
{
|
||||
return (isspace(c) == 0 ? false : true);
|
||||
}
|
||||
|
||||
// Checks for an uppercase letter.
|
||||
inline boolean isUpperCase(int c)
|
||||
inline bool isUpperCase(int c)
|
||||
{
|
||||
return (isupper(c) == 0 ? false : true);
|
||||
}
|
||||
|
||||
// Checks for a hexadecimal digits, i.e. one of 0 1 2 3 4 5 6 7
|
||||
// 8 9 a b c d e f A B C D E F.
|
||||
inline boolean isHexadecimalDigit(int c)
|
||||
inline bool isHexadecimalDigit(int c)
|
||||
{
|
||||
return (isxdigit(c) == 0 ? false : true);
|
||||
}
|
||||
|
@ -27,20 +27,20 @@ extern "C" {
|
||||
#include "esp_system.h"
|
||||
}
|
||||
|
||||
long map(long x, long in_min, long in_max, long out_min, long out_max) {
|
||||
const long dividend = out_max - out_min;
|
||||
const long divisor = in_max - in_min;
|
||||
const long delta = x - in_min;
|
||||
//long map(long x, long in_min, long in_max, long out_min, long out_max) {
|
||||
// const long dividend = out_max - out_min;
|
||||
// const long divisor = in_max - in_min;
|
||||
// const long delta = x - in_min;
|
||||
|
||||
return (delta * dividend + (divisor / 2)) / divisor + out_min;
|
||||
}
|
||||
// return (delta * dividend + (divisor / 2)) / divisor + out_min;
|
||||
//}
|
||||
|
||||
unsigned int makeWord(unsigned int w)
|
||||
{
|
||||
return w;
|
||||
}
|
||||
//unsigned int makeWord(unsigned int w)
|
||||
//{
|
||||
// return w;
|
||||
//}
|
||||
|
||||
unsigned int makeWord(unsigned char h, unsigned char l)
|
||||
{
|
||||
return (h << 8) | l;
|
||||
}
|
||||
//unsigned int makeWord(unsigned char h, unsigned char l)
|
||||
//{
|
||||
// return (h << 8) | l;
|
||||
//}
|
||||
|
@ -42,6 +42,7 @@ static uint8_t __analogVRefPin = 0;
|
||||
#include "rom/ets_sys.h"
|
||||
#include "esp_intr.h"
|
||||
#endif
|
||||
#include "esp32-hal-gpio.h"
|
||||
|
||||
static uint8_t __analogAttenuation = 3;//11db
|
||||
static uint8_t __analogWidth = 3;//12 bits
|
||||
|
@ -45,4 +45,8 @@ uint32_t getApbFrequency(); // In Hz
|
||||
}
|
||||
#endif
|
||||
|
||||
#define clockCyclesPerMicrosecond() ( (long int)getCpuFrequencyMhz() )
|
||||
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
|
||||
#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
|
||||
|
||||
#endif /* _ESP32_HAL_CPU_H_ */
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "soc/sens_reg.h"
|
||||
#include "soc/sens_struct.h"
|
||||
#include "driver/dac.h"
|
||||
#include "esp32-hal-gpio.h"
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#define DAC1 25
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "esp_attr.h"
|
||||
#include "esp32-hal-cpu.h" // cpu clock change support 31DEC2018
|
||||
#include "esp32-hal-log.h"
|
||||
#include "esp32-hal-gpio.h"
|
||||
#include "esp32-hal-matrix.h"
|
||||
|
||||
#include "esp_system.h"
|
||||
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
|
||||
@ -38,6 +40,7 @@
|
||||
#else // ESP32 Before IDF 4.0
|
||||
#include "rom/ets_sys.h"
|
||||
#endif
|
||||
#include "driver/gpio.h"
|
||||
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
|
@ -21,6 +21,9 @@
|
||||
#include "soc/dport_reg.h"
|
||||
#include "soc/ledc_reg.h"
|
||||
#include "soc/ledc_struct.h"
|
||||
#include "esp32-hal-cpu.h"
|
||||
#include "esp32-hal-gpio.h"
|
||||
#include "esp32-hal-ledc.h"
|
||||
|
||||
#include "esp_system.h"
|
||||
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
|
||||
|
@ -25,6 +25,9 @@
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "hal/rmt_ll.h"
|
||||
#include "driver/rmt.h"
|
||||
#include "esp32-hal-rmt.h"
|
||||
#include "esp32-hal-gpio.h"
|
||||
#include "esp32-hal-matrix.h"
|
||||
|
||||
// RMTMEM address is declared in <target>.peripherals.ld
|
||||
extern rmt_mem_t RMTMEM;
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "soc/gpio_sd_reg.h"
|
||||
#include "soc/gpio_sd_struct.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "esp32-hal-cpu.h"
|
||||
#include "esp32-hal-gpio.h"
|
||||
|
||||
#include "esp_system.h"
|
||||
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
|
||||
|
@ -43,6 +43,9 @@
|
||||
#include "rom/gpio.h"
|
||||
#include "esp_intr.h"
|
||||
#endif
|
||||
#include "esp32-hal-gpio.h"
|
||||
#include "esp32-hal-matrix.h"
|
||||
#include "esp32-hal-cpu.h"
|
||||
|
||||
struct spi_struct_t {
|
||||
spi_dev_t * dev;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "rom/ets_sys.h"
|
||||
#include "esp_intr.h"
|
||||
#endif
|
||||
#include "esp32-hal-gpio.h"
|
||||
|
||||
static uint16_t __touchSleepCycles = 0x1000;
|
||||
static uint16_t __touchMeasureCycles = 0x1000;
|
||||
|
@ -61,18 +61,18 @@ void yield(void);
|
||||
#define NOP() asm volatile ("nop")
|
||||
|
||||
//#include "esp32-hal-log.h"
|
||||
#include "esp32-hal-matrix.h"
|
||||
#include "esp32-hal-gpio.h"
|
||||
#include "esp32-hal-touch.h"
|
||||
#include "esp32-hal-dac.h"
|
||||
#include "esp32-hal-adc.h"
|
||||
#include "esp32-hal-spi.h"
|
||||
#include "esp32-hal-i2c.h"
|
||||
#include "esp32-hal-ledc.h"
|
||||
#include "esp32-hal-rmt.h"
|
||||
#include "esp32-hal-sigmadelta.h"
|
||||
#include "esp32-hal-psram.h"
|
||||
#include "esp32-hal-cpu.h"
|
||||
//#include "esp32-hal-matrix.h"
|
||||
//#include "esp32-hal-gpio.h"
|
||||
//#include "esp32-hal-touch.h"
|
||||
//#include "esp32-hal-dac.h"
|
||||
//#include "esp32-hal-adc.h"
|
||||
//#include "esp32-hal-spi.h"
|
||||
//#include "esp32-hal-i2c.h"
|
||||
//#include "esp32-hal-ledc.h"
|
||||
//#include "esp32-hal-rmt.h"
|
||||
//#include "esp32-hal-sigmadelta.h"
|
||||
//#include "esp32-hal-psram.h"
|
||||
//#include "esp32-hal-cpu.h"
|
||||
|
||||
//returns chip temperature in Celsius
|
||||
float temperatureRead();
|
||||
|
@ -17,8 +17,10 @@
|
||||
$Id: wiring.c 248 2007-02-03 15:36:30Z mellis $
|
||||
*/
|
||||
|
||||
#include "wiring_shift.h"
|
||||
#include "esp32-hal.h"
|
||||
#include "wiring_private.h"
|
||||
#include "esp32-hal-gpio.h"
|
||||
|
||||
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) {
|
||||
uint8_t value = 0;
|
||||
|
9
cores/esp32/wiring_shift.h
Normal file
9
cores/esp32/wiring_shift.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#define LSBFIRST 0
|
||||
#define MSBFIRST 1
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
|
||||
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
|
@ -153,7 +153,7 @@ const char* File::name() const
|
||||
}
|
||||
|
||||
//to implement
|
||||
boolean File::isDirectory(void)
|
||||
bool File::isDirectory(void)
|
||||
{
|
||||
if (!_p) {
|
||||
return false;
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
time_t getLastWrite();
|
||||
const char* name() const;
|
||||
|
||||
boolean isDirectory(void);
|
||||
bool isDirectory(void);
|
||||
File openNextFile(const char* mode = FILE_READ);
|
||||
void rewindDirectory(void);
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
virtual void close() = 0;
|
||||
virtual time_t getLastWrite() = 0;
|
||||
virtual const char* name() const = 0;
|
||||
virtual boolean isDirectory(void) = 0;
|
||||
virtual bool isDirectory(void) = 0;
|
||||
virtual FileImplPtr openNextFile(const char* mode) = 0;
|
||||
virtual void rewindDirectory(void) = 0;
|
||||
virtual operator bool() = 0;
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
#include "esp32-hal-log.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
using namespace fs;
|
||||
|
||||
FileImplPtr VFSImpl::open(const char* path, const char* mode)
|
||||
@ -385,7 +387,7 @@ const char* VFSFileImpl::name() const
|
||||
}
|
||||
|
||||
//to implement
|
||||
boolean VFSFileImpl::isDirectory(void)
|
||||
bool VFSFileImpl::isDirectory(void)
|
||||
{
|
||||
return _isDirectory;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
void close() override;
|
||||
const char* name() const override;
|
||||
time_t getLastWrite() override;
|
||||
boolean isDirectory(void) override;
|
||||
bool isDirectory(void) override;
|
||||
FileImplPtr openNextFile(const char* mode) override;
|
||||
void rewindDirectory(void) override;
|
||||
operator bool();
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include "SPI.h"
|
||||
|
||||
#include "pins_arduino.h"
|
||||
|
||||
SPIClass::SPIClass(uint8_t spi_bus)
|
||||
:_spi_num(spi_bus)
|
||||
,_spi(NULL)
|
||||
|
@ -22,7 +22,6 @@
|
||||
#define _SPI_H_INCLUDED
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "pins_arduino.h"
|
||||
#include "esp32-hal-spi.h"
|
||||
|
||||
#define SPI_HAS_TRANSACTION
|
||||
|
@ -25,6 +25,8 @@ extern "C" {
|
||||
|
||||
#include "esp32-hal-log.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
using namespace fs;
|
||||
|
||||
class SPIFFSImpl : public VFSImpl
|
||||
|
@ -35,7 +35,7 @@ extern "C" {
|
||||
#include "esp32-hal-i2c.h"
|
||||
#include "esp32-hal-log.h"
|
||||
#include "Wire.h"
|
||||
#include "Arduino.h"
|
||||
#include "pins_arduino.h"
|
||||
|
||||
std::string toString(i2c_err_t val)
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include <string>
|
||||
#include "esp32-hal-i2c.h"
|
||||
|
||||
#define STICKBREAKER 'V1.1.0'
|
||||
#define I2C_BUFFER_LENGTH 128
|
||||
|
Reference in New Issue
Block a user