1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-29 09:10:03 +02:00

Use new EpoxyDuino version with patches

This commit is contained in:
Mitch Bradley
2021-12-12 14:00:06 -10:00
parent 868797b11d
commit 9bcb0479e1
24 changed files with 156 additions and 100 deletions

View File

@@ -20,7 +20,7 @@ public:
BluetoothSerial(void) = default;
~BluetoothSerial(void) = default;
bool begin(String localName = String(), bool isMaster = false) {}
bool begin(String localName = String(), bool isMaster = false) { return false; }
void register_callback(void (*callback)(esp_spp_cb_event_t event, esp_spp_cb_param_t* param)) {}
bool hasClient(void) { return false; }
void end(void) {}

View File

@@ -1,3 +1,12 @@
#include "ESP.h"
#include <Arduino.h>
#if EPOXY_DUINO_VERSION < 10000
# include "ESP.h"
EspClass ESP;
#else
# include <stdint.h>
extern "C" {
void attachInterrupt(uint8_t pin, void (*isr_limit_switches)(), int change) {}
void detachInterrupt(uint8_t pin) {}
}
#endif

View File

@@ -19,8 +19,11 @@ inline uint32_t getApbFrequency() {
}
inline void gpio_reset_pin(uint8_t pin) {}
inline int digitalPinToInterrupt(uint8_t pin) {}
inline int digitalPinToInterrupt(uint8_t pin) {
return 0;
}
#ifndef EPOXY_DUINO
// Most of the EspClass stuff is used by information reports,
// except for restart()
class EspClass {
@@ -33,11 +36,12 @@ public:
inline uint32_t getFlashChipSize() { return 0x400000; }
};
extern EspClass ESP;
#endif
#define NO_TASKS
inline void attachInterrupt(int pin, void (*isr_limit_switches)(), int change) {}
inline void detachInterrupt(int pin) {}
void attachInterrupt(uint8_t pin, void (*isr_limit_switches)(), int change);
void detachInterrupt(uint8_t pin);
inline void NOP() {}

View File

@@ -1,4 +1,6 @@
#include <FS.h>
#include <Arduino.h>
#if EPOXY_DUINO_VERSION < 10000
# include <FS.h>
using namespace fs;
@@ -112,10 +114,11 @@ bool FS::rmdir(const String& path) {
return rmdir(path.c_str());
}
#if 0
# if 0
void FSImpl::mountpoint(const char* mp) {}
const char* FSImpl::mountpoint() {
return "";
}
# endif
#endif

View File

@@ -1,3 +1,4 @@
#if EPOXY_DUINO_VERSION < 10000
#pragma once
#include <Stream.h>
@@ -61,3 +62,4 @@ using fs::SeekCur;
using fs::SeekEnd;
using fs::SeekMode;
using fs::SeekSet;
#endif

View File

@@ -2,7 +2,11 @@
#include <SPI.h>
#include <FS.h>
#if EPOXY_DUINO_VERSION < 10000
class SDFS : public FS {
#else
class SDFS {
#endif
public:
bool begin(uint8_t sspin, SPIClass& spi, int freq, const char* mountpoint, int n_files) { return false; };
void end() {}

View File

@@ -1,3 +1,6 @@
#include <SPIFFS.h>
#include <Arduino.h>
#if EPOXY_DUINO_VERSION < 10000
# include <SPIFFS.h>
fs::SPIFFSFS SPIFFS;
#endif

View File

@@ -1,6 +1,8 @@
#pragma once
#include <Arduino.h>
#if EPOXY_DUINO_VERSION < 10000
#include <FS.h>
# include <FS.h>
namespace fs {
class SPIFFSFS : public FS {
@@ -22,3 +24,4 @@ namespace fs {
}
extern fs::SPIFFSFS SPIFFS;
#endif

View File

@@ -1,5 +1,7 @@
#pragma once
extern "C" {
inline esp_err_t esp_task_wdt_reset() {}
inline esp_err_t esp_task_wdt_reset() {
return 0;
}
}

View File

@@ -18,9 +18,13 @@ const BaseType_t pdTRUE = 1;
const BaseType_t pdFALSE = 0;
const BaseType_t pdPASS = 0;
inline void vTaskDelay(TickType_t ticks) {}
inline BaseType_t xQueueReceive(QueueHandle_t xQueue, void* pvBuffer, TickType_t xTicksToWait) {}
inline xQueueHandle xQueueCreate(int n, int len) {}
inline BaseType_t xQueueReset(QueueHandle_t queue) {
inline BaseType_t xQueueReceive(QueueHandle_t xQueue, void* pvBuffer, TickType_t xTicksToWait) {
return pdFALSE;
}
inline xQueueHandle xQueueCreate(int n, int len) {
return nullptr;
}
inline BaseType_t xQueueReset(QueueHandle_t queue) {
return pdPASS;
}
inline BaseType_t xQueueSend(QueueHandle_t queue, void* item, TickType_t ticks) {
@@ -29,9 +33,13 @@ inline BaseType_t xQueueSend(QueueHandle_t queue, void* item, TickType_t ticks)
inline BaseType_t xQueueSendFromISR(QueueHandle_t queue, void* item, void* p) {
return pdTRUE;
}
inline TaskHandle_t xTaskCreate(void (*task)(void*), const char* name, int stacksize, void* arg0, int pri, TaskHandle_t* th) {}
inline TaskHandle_t xTaskCreate(void (*task)(void*), const char* name, int stacksize, void* arg0, int pri, TaskHandle_t* th) {
return nullptr;
}
inline TaskHandle_t xTaskCreatePinnedToCore(
void (*task)(void*), const char* name, int stacksize, void* arg0, int pri, TaskHandle_t* th, int core) {}
void (*task)(void*), const char* name, int stacksize, void* arg0, int pri, TaskHandle_t* th, int core) {
return nullptr;
}
inline int xTaskGetTickCount() {
return 0;
}

View File

@@ -2,19 +2,23 @@
#include <ctype.h>
#include <binary.h>
inline bool isPrintable(int c) {
return (isprint(c) == 0 ? false : true);
}
#define IRAM_ATTR
// The native compiler might not support __attribute__ ((weak))
#define WEAK_FUNC
// Unlike the ESP32 Arduino framework, EpoxyDuino does not have contrain() and map()
#if EPOXY_DUINO_VERSION < 10000
inline bool isPrintable(int c) {
return (isprint(c) == 0 ? false : true);
}
#else
static const uint8_t SS = 1;
#endif
#if EPOXY_DUINO_VERSION < 10100
// Templates don't work because of float/double promotion
#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
# define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
#endif
inline long map(long x, long in_min, long in_max, long out_min, long out_max) {
const long dividend = out_max - out_min;
@@ -26,7 +30,9 @@ inline long map(long x, long in_min, long in_max, long out_min, long out_max) {
return (delta * dividend + (divisor / 2)) / divisor + out_min;
}
#define M_PI 3.1415926536
#ifndef M_PI // native on linux
# define M_PI 3.1415926536
#endif
#define GPIO_NUM_0 0
#define GPIO_NUM_1 1
@@ -68,19 +74,3 @@ inline long map(long x, long in_min, long in_max, long out_min, long out_max) {
#define GPIO_NUM_37 37
#define GPIO_NUM_38 38
#define GPIO_NUM_39 39
#if 0
# define INPUT 0x0
# define OUTPUT 0x1
# define INPUT_PULLUP 0x2
# define CHANGE 0x03
// Define pins used by I2C and SPI.
static const uint8_t SS = 1;
static const uint8_t MOSI = 2;
static const uint8_t MISO = 3;
static const uint8_t SCK = 4;
static const uint8_t SDA = 5;
static const uint8_t SCL = 6;
#endif

View File

@@ -20,7 +20,7 @@ inline esp_err_t nvs_get_i8(int _handle, const char* _keyName, signed char* valu
inline esp_err_t nvs_set_i8(int _handle, const char* _keyName, int value) {
return -1;
}
inline esp_err_t nvs_get_str(int _handle, const char* _keyName, void* p, unsigned int* len) {
inline esp_err_t nvs_get_str(int _handle, const char* _keyName, void* p, size_t* len) {
return -1;
}
inline esp_err_t nvs_set_str(int _handle, const char* _keyName, const char* value) {