1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-30 01:30:05 +02:00

Moved Native code into NativeStubs library.

This helps with supporting radio config
This commit is contained in:
Mitch Bradley
2021-07-13 15:35:46 -10:00
parent eb584d67e3
commit 569b3ccf71
55 changed files with 937 additions and 613 deletions

View File

@@ -0,0 +1 @@
#include "BluetoothSerial.h"

View File

@@ -0,0 +1,32 @@
#pragma once
#include "Arduino.h"
#include "Stream.h"
inline bool btStarted() {
return false;
}
typedef int esp_spp_cb_event_t;
typedef struct {
struct {
uint8_t* rem_bda;
} srv_open;
} esp_spp_cb_param_t;
enum { ESP_SPP_SRV_OPEN_EVT, ESP_SPP_SRV_CLOSE_EVT, ESP_SPP_CLOSE_EVT };
class BluetoothSerial : public Stream {
public:
BluetoothSerial(void) = default;
~BluetoothSerial(void) = default;
bool begin(String localName = String(), bool isMaster = 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) {}
size_t write(uint8_t) override { return 0; }
int available() override { return 0; }
int read() override { return -1; }
int peek() override { return -1; }
};

View File

@@ -0,0 +1,3 @@
#include "ESP.h"
EspClass ESP;

View File

@@ -0,0 +1,49 @@
#pragma once
#include <stdint.h>
inline int temperatureRead() {
return 27;
}
inline long long esp_timer_get_time() {
return 0LL;
}
typedef int esp_err_t;
const esp_err_t ESP_OK = 0;
inline uint32_t getApbFrequency() {
return 80000000;
}
inline void gpio_reset_pin(uint8_t pin) {}
inline int digitalPinToInterrupt(uint8_t pin) {}
// Most of the EspClass stuff is used by information reports,
// except for restart()
class EspClass {
public:
const char* getSdkVersion() { return "native"; }
inline void restart() {}
inline uint64_t getEfuseMac() { return 0ULL; }
inline uint32_t getCpuFreqMHz() { return 240000000; }
inline uint32_t getFreeHeap() { return 30000; }
inline uint32_t getFlashChipSize() { return 0x400000; }
};
extern EspClass ESP;
#define NO_TASKS
inline void attachInterrupt(int pin, void (*isr_limit_switches)(), int change) {}
inline void detachInterrupt(int pin) {}
inline void NOP() {}
// dacWrite stub - used by DacSpindle
inline void dacWrite(int _output_pin, uint8_t duty) {}
inline void ledcSetup(int channel_num, double freq, int bits) {}
inline void ledcWrite(int channel_num, int duty) {}
inline void ledcAttachPin(int pwm_pin, int channel_num) {}

View File

@@ -0,0 +1,121 @@
#include <FS.h>
using namespace fs;
size_t File::write(uint8_t c) {
return 0;
}
time_t File::getLastWrite() {
return 0;
}
size_t File::write(const uint8_t* buf, size_t size) {
return 0;
}
int File::available() {
return false;
}
int File::read() {
return -1;
}
size_t File::read(uint8_t* buf, size_t size) {
return -1;
}
int File::peek() {
return -1;
}
void File::flush() {}
bool File::seek(uint32_t pos, SeekMode mode) {
return false;
}
size_t File::position() const {
return 0;
}
size_t File::size() const {
return 0;
}
void File::close() {}
File::operator bool() const {
return false;
}
const char* File::name() const {
return nullptr;
}
bool File::isDirectory(void) {
return false;
}
File File::openNextFile(const char* mode) {
return File();
}
void File::rewindDirectory(void) {}
File FS::open(const String& path, const char* mode) {
return open(path.c_str(), mode);
}
File FS::open(const char* path, const char* mode) {
return File();
}
bool FS::exists(const char* path) {
return false;
}
bool FS::exists(const String& path) {
return exists(path.c_str());
}
bool FS::remove(const char* path) {
return false;
}
bool FS::remove(const String& path) {
return remove(path.c_str());
}
bool FS::rename(const char* pathFrom, const char* pathTo) {
return false;
}
bool FS::rename(const String& pathFrom, const String& pathTo) {
return rename(pathFrom.c_str(), pathTo.c_str());
}
bool FS::mkdir(const char* path) {
return false;
}
bool FS::mkdir(const String& path) {
return mkdir(path.c_str());
}
bool FS::rmdir(const char* path) {
return false;
}
bool FS::rmdir(const String& path) {
return rmdir(path.c_str());
}
#if 0
void FSImpl::mountpoint(const char* mp) {}
const char* FSImpl::mountpoint() {
return "";
}
#endif

View File

@@ -0,0 +1,63 @@
#pragma once
#include <Stream.h>
#define FILE_READ "r"
namespace fs {
enum SeekMode { SeekSet = 0, SeekCur = 1, SeekEnd = 2 };
class File : public Stream {
public:
File() {}
size_t write(uint8_t) override;
size_t write(const uint8_t* buf, size_t size) override;
int available() override;
int read() override;
int peek() override;
void flush() override;
size_t read(uint8_t* buf, size_t size);
size_t readBytes(char* buffer, size_t length) { return read((uint8_t*)buffer, length); }
bool seek(uint32_t pos, SeekMode mode);
bool seek(uint32_t pos) { return seek(pos, SeekSet); }
size_t position() const;
size_t size() const;
void close();
operator bool() const;
time_t getLastWrite();
const char* name() const;
bool isDirectory(void);
File openNextFile(const char* mode = FILE_READ);
void rewindDirectory(void);
};
class FS {
public:
File open(const char* path, const char* mode = FILE_READ);
File open(const String& path, const char* mode = FILE_READ);
bool exists(const char* path);
bool exists(const String& path);
bool remove(const char* path);
bool remove(const String& path);
bool rename(const char* pathFrom, const char* pathTo);
bool rename(const String& pathFrom, const String& pathTo);
bool mkdir(const char* path);
bool mkdir(const String& path);
bool rmdir(const char* path);
bool rmdir(const String& path);
};
}
using fs::File;
using fs::FS;
using fs::SeekCur;
using fs::SeekEnd;
using fs::SeekMode;
using fs::SeekSet;

View File

@@ -0,0 +1,7 @@
#include <IPAddress.h>
String IPAddress::toString() const {
char szRet[16];
sprintf(szRet, "%u.%u.%u.%u", _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3]);
return String(szRet);
}

View File

@@ -0,0 +1,57 @@
#pragma once
#include <stdint.h>
#include <stdio.h>
#include <WString.h>
#include <Printable.h>
// The IPAddress implementation in EpoxyDuino does not have toString()
// so we include the implementation from the esp32 arduino framework
class IPAddress : public Printable {
private:
union {
uint8_t bytes[4]; // IPv4 address
uint32_t dword;
} _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
IPAddress();
IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);
IPAddress(uint32_t address);
IPAddress(const uint8_t* address);
virtual ~IPAddress() {}
bool fromString(const char* address);
bool fromString(const String& address) { return fromString(address.c_str()); }
// Overloaded cast operator to allow IPAddress objects to be used where a pointer
// to a four-byte uint8_t array is expected
operator uint32_t() const { return _address.dword; }
bool operator==(const IPAddress& addr) const { return _address.dword == addr._address.dword; }
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 IPAddress objects from other types
IPAddress& operator=(const uint8_t* address);
IPAddress& operator=(uint32_t address);
virtual size_t printTo(Print& p) const;
String toString() const;
#if 0
friend class EthernetClass;
friend class UDP;
friend class Client;
friend class Server;
friend class DhcpClass;
friend class DNSClient;
#endif
};

View File

@@ -0,0 +1,3 @@
#include <SD.h>
SDFS SD;

View File

@@ -0,0 +1,12 @@
#pragma once
#include <SPI.h>
#include <FS.h>
class SDFS : public FS {
public:
bool begin(uint8_t sspin, SPIClass& spi, int freq, const char* mountpoint, int n_files) { return false; };
void end() {}
size_t cardSize() { return 0; }
};
extern SDFS SD;

View File

@@ -0,0 +1,3 @@
#include <SPIFFS.h>
fs::SPIFFSFS SPIFFS;

View File

@@ -0,0 +1,24 @@
#pragma once
#include <FS.h>
namespace fs {
class SPIFFSFS : public FS {
public:
SPIFFSFS() = default;
~SPIFFSFS() = default;
bool begin(bool formatOnFail, const char* basePath, uint8_t maxOpenFiles, const char* partitionLabel) { return true; }
void end() {}
bool format() { return true; }
size_t totalBytes() { return 0; }
size_t usedBytes() { return 0; }
};
}
extern fs::SPIFFSFS SPIFFS;

View File

@@ -0,0 +1,16 @@
#include <TMCStepper.h>
// Implementation of weak functions in libraries
// The compiler use for native compilation doesn't support
// __attribute__ ((weak))
void TMC2130Stepper::switchCSpin(bool state) {
// digitalWrite(_pinCS, state);
}
void TMC2130Stepper::setSPISpeed(uint32_t speed) {
// spi_speed = speed;
}
void TMC2130Stepper::write(uint8_t addressByte, uint32_t config) {}
uint32_t TMC2130Stepper::read(uint8_t addressByte) {
return 0UL;
}

View File

@@ -0,0 +1,40 @@
#pragma once
typedef int HTTPMethod;
typedef const char* Uri;
typedef void (*THandlerFunction)(void);
#define CONTENT_LENGTH_UNKNOWN ((size_t)-1)
#define HTTP_ANY 1
class WebServer {
public:
WebServer(IPAddress addr, int port = 80);
WebServer(int port = 80) {}
~WebServer() = default;
void begin() {};
void setContentLength(const size_t contentLength) {}
void collectHeaders(const char* headerKeys[], const size_t headerKeysCount) {} // set the request headers to collect
void on(const Uri& uri, HTTPMethod method, THandlerFunction fn) {}
void onNotFound(THandlerFunction fn) {} //called when handler is not assigned
void onFileUpload(THandlerFunction fn) {} //handle file uploads
String arg(String name) { return name; } // get request argument value by name
bool hasArg(String name) { return false; } // check if argument exists
template <typename T>
size_t streamFile(T& file, const String& contentType) {
return 0;
}
void sendHeader(const String& name, const String& value, bool first = false) {}
void sendContentLength(size_t len) {}
void sendContent(const String& content) {}
void send_P(int code, const char* content_type, const char* content, size_t contentLength) {}
void send(int n) {}
// WiFiClient client() { return _currentClient; }
void handleClient() {}
};

View File

@@ -0,0 +1,7 @@
class WebSocketsServer {
public:
WebSocketsServer(uint16_t port, String origin = "", String protocol = "arduino") {}
~WebSocketsServer(void) {}
void broadcastBIN(uint8_t* buf, size_t len) {}
};

View File

@@ -0,0 +1,3 @@
#include "WiFi.h"
WiFiStuff WiFi;

View File

@@ -0,0 +1,19 @@
#pragma once
#include <IPAddress.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#define WiFiEvent_t int
#define WIFI_OFF false
class WiFiStuff {
public:
void persistent(bool on) {};
void disconnect(bool on) {}
void enableSTA(bool on) {}
void enableAP(bool on) {}
void mode(bool mode) {}
};
extern WiFiStuff WiFi;

View File

@@ -0,0 +1,24 @@
#pragma once
#include <IPAddress.h>
class WiFiClient {
public:
WiFiClient() {}
WiFiClient(int fd) {}
~WiFiClient() {}
int available() { return 0; }
int read(uint8_t* buf, size_t size) { return -1; }
void stop() {}
size_t write(const uint8_t* buf, size_t size) { return 0; }
uint8_t connected() { return 0; }
IPAddress remoteIP() const { return IPAddress(uint32_t(0)); }
operator bool() { return connected(); }
// WiFiClient& operator=(const WiFiClient& other);
// bool operator==(const bool value) { return bool() == value; }
// bool operator!=(const bool value) { return bool() != value; }
// bool operator==(const WiFiClient&);
// bool operator!=(const WiFiClient& rhs) { return !this->operator==(rhs); }
};

View File

@@ -0,0 +1 @@
#pragma once

View File

@@ -0,0 +1,27 @@
#pragma once
class WiFiServer {
public:
WiFiServer(uint16_t port = 80, uint8_t max_clients = 4) {}
~WiFiServer() { end(); }
void listenOnLocalhost() {}
WiFiClient available() { return WiFiClient(); }
WiFiClient accept() { return available(); }
void begin(uint16_t port = 0) {}
void begin(uint16_t port, int reuse_enable) {}
void setNoDelay(bool nodelay) {}
bool getNoDelay() { return false; }
bool hasClient() { return false; }
size_t write(const uint8_t* data, size_t len) { return 0; }
size_t write(uint8_t data) { return write(&data, 1); }
void end() {}
void close() {}
void stop() {}
operator bool() { return false; }
int setTimeout(uint32_t seconds) { return seconds; }
void stopAll() {}
};

View File

@@ -0,0 +1,534 @@
/*
binary.h - Definitions for binary constants
Copyright (c) 2006 David A. Mellis. 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 Binary_h
#define Binary_h
#define B0 0
#define B00 0
#define B000 0
#define B0000 0
#define B00000 0
#define B000000 0
#define B0000000 0
#define B00000000 0
#define B1 1
#define B01 1
#define B001 1
#define B0001 1
#define B00001 1
#define B000001 1
#define B0000001 1
#define B00000001 1
#define B10 2
#define B010 2
#define B0010 2
#define B00010 2
#define B000010 2
#define B0000010 2
#define B00000010 2
#define B11 3
#define B011 3
#define B0011 3
#define B00011 3
#define B000011 3
#define B0000011 3
#define B00000011 3
#define B100 4
#define B0100 4
#define B00100 4
#define B000100 4
#define B0000100 4
#define B00000100 4
#define B101 5
#define B0101 5
#define B00101 5
#define B000101 5
#define B0000101 5
#define B00000101 5
#define B110 6
#define B0110 6
#define B00110 6
#define B000110 6
#define B0000110 6
#define B00000110 6
#define B111 7
#define B0111 7
#define B00111 7
#define B000111 7
#define B0000111 7
#define B00000111 7
#define B1000 8
#define B01000 8
#define B001000 8
#define B0001000 8
#define B00001000 8
#define B1001 9
#define B01001 9
#define B001001 9
#define B0001001 9
#define B00001001 9
#define B1010 10
#define B01010 10
#define B001010 10
#define B0001010 10
#define B00001010 10
#define B1011 11
#define B01011 11
#define B001011 11
#define B0001011 11
#define B00001011 11
#define B1100 12
#define B01100 12
#define B001100 12
#define B0001100 12
#define B00001100 12
#define B1101 13
#define B01101 13
#define B001101 13
#define B0001101 13
#define B00001101 13
#define B1110 14
#define B01110 14
#define B001110 14
#define B0001110 14
#define B00001110 14
#define B1111 15
#define B01111 15
#define B001111 15
#define B0001111 15
#define B00001111 15
#define B10000 16
#define B010000 16
#define B0010000 16
#define B00010000 16
#define B10001 17
#define B010001 17
#define B0010001 17
#define B00010001 17
#define B10010 18
#define B010010 18
#define B0010010 18
#define B00010010 18
#define B10011 19
#define B010011 19
#define B0010011 19
#define B00010011 19
#define B10100 20
#define B010100 20
#define B0010100 20
#define B00010100 20
#define B10101 21
#define B010101 21
#define B0010101 21
#define B00010101 21
#define B10110 22
#define B010110 22
#define B0010110 22
#define B00010110 22
#define B10111 23
#define B010111 23
#define B0010111 23
#define B00010111 23
#define B11000 24
#define B011000 24
#define B0011000 24
#define B00011000 24
#define B11001 25
#define B011001 25
#define B0011001 25
#define B00011001 25
#define B11010 26
#define B011010 26
#define B0011010 26
#define B00011010 26
#define B11011 27
#define B011011 27
#define B0011011 27
#define B00011011 27
#define B11100 28
#define B011100 28
#define B0011100 28
#define B00011100 28
#define B11101 29
#define B011101 29
#define B0011101 29
#define B00011101 29
#define B11110 30
#define B011110 30
#define B0011110 30
#define B00011110 30
#define B11111 31
#define B011111 31
#define B0011111 31
#define B00011111 31
#define B100000 32
#define B0100000 32
#define B00100000 32
#define B100001 33
#define B0100001 33
#define B00100001 33
#define B100010 34
#define B0100010 34
#define B00100010 34
#define B100011 35
#define B0100011 35
#define B00100011 35
#define B100100 36
#define B0100100 36
#define B00100100 36
#define B100101 37
#define B0100101 37
#define B00100101 37
#define B100110 38
#define B0100110 38
#define B00100110 38
#define B100111 39
#define B0100111 39
#define B00100111 39
#define B101000 40
#define B0101000 40
#define B00101000 40
#define B101001 41
#define B0101001 41
#define B00101001 41
#define B101010 42
#define B0101010 42
#define B00101010 42
#define B101011 43
#define B0101011 43
#define B00101011 43
#define B101100 44
#define B0101100 44
#define B00101100 44
#define B101101 45
#define B0101101 45
#define B00101101 45
#define B101110 46
#define B0101110 46
#define B00101110 46
#define B101111 47
#define B0101111 47
#define B00101111 47
#define B110000 48
#define B0110000 48
#define B00110000 48
#define B110001 49
#define B0110001 49
#define B00110001 49
#define B110010 50
#define B0110010 50
#define B00110010 50
#define B110011 51
#define B0110011 51
#define B00110011 51
#define B110100 52
#define B0110100 52
#define B00110100 52
#define B110101 53
#define B0110101 53
#define B00110101 53
#define B110110 54
#define B0110110 54
#define B00110110 54
#define B110111 55
#define B0110111 55
#define B00110111 55
#define B111000 56
#define B0111000 56
#define B00111000 56
#define B111001 57
#define B0111001 57
#define B00111001 57
#define B111010 58
#define B0111010 58
#define B00111010 58
#define B111011 59
#define B0111011 59
#define B00111011 59
#define B111100 60
#define B0111100 60
#define B00111100 60
#define B111101 61
#define B0111101 61
#define B00111101 61
#define B111110 62
#define B0111110 62
#define B00111110 62
#define B111111 63
#define B0111111 63
#define B00111111 63
#define B1000000 64
#define B01000000 64
#define B1000001 65
#define B01000001 65
#define B1000010 66
#define B01000010 66
#define B1000011 67
#define B01000011 67
#define B1000100 68
#define B01000100 68
#define B1000101 69
#define B01000101 69
#define B1000110 70
#define B01000110 70
#define B1000111 71
#define B01000111 71
#define B1001000 72
#define B01001000 72
#define B1001001 73
#define B01001001 73
#define B1001010 74
#define B01001010 74
#define B1001011 75
#define B01001011 75
#define B1001100 76
#define B01001100 76
#define B1001101 77
#define B01001101 77
#define B1001110 78
#define B01001110 78
#define B1001111 79
#define B01001111 79
#define B1010000 80
#define B01010000 80
#define B1010001 81
#define B01010001 81
#define B1010010 82
#define B01010010 82
#define B1010011 83
#define B01010011 83
#define B1010100 84
#define B01010100 84
#define B1010101 85
#define B01010101 85
#define B1010110 86
#define B01010110 86
#define B1010111 87
#define B01010111 87
#define B1011000 88
#define B01011000 88
#define B1011001 89
#define B01011001 89
#define B1011010 90
#define B01011010 90
#define B1011011 91
#define B01011011 91
#define B1011100 92
#define B01011100 92
#define B1011101 93
#define B01011101 93
#define B1011110 94
#define B01011110 94
#define B1011111 95
#define B01011111 95
#define B1100000 96
#define B01100000 96
#define B1100001 97
#define B01100001 97
#define B1100010 98
#define B01100010 98
#define B1100011 99
#define B01100011 99
#define B1100100 100
#define B01100100 100
#define B1100101 101
#define B01100101 101
#define B1100110 102
#define B01100110 102
#define B1100111 103
#define B01100111 103
#define B1101000 104
#define B01101000 104
#define B1101001 105
#define B01101001 105
#define B1101010 106
#define B01101010 106
#define B1101011 107
#define B01101011 107
#define B1101100 108
#define B01101100 108
#define B1101101 109
#define B01101101 109
#define B1101110 110
#define B01101110 110
#define B1101111 111
#define B01101111 111
#define B1110000 112
#define B01110000 112
#define B1110001 113
#define B01110001 113
#define B1110010 114
#define B01110010 114
#define B1110011 115
#define B01110011 115
#define B1110100 116
#define B01110100 116
#define B1110101 117
#define B01110101 117
#define B1110110 118
#define B01110110 118
#define B1110111 119
#define B01110111 119
#define B1111000 120
#define B01111000 120
#define B1111001 121
#define B01111001 121
#define B1111010 122
#define B01111010 122
#define B1111011 123
#define B01111011 123
#define B1111100 124
#define B01111100 124
#define B1111101 125
#define B01111101 125
#define B1111110 126
#define B01111110 126
#define B1111111 127
#define B01111111 127
#define B10000000 128
#define B10000001 129
#define B10000010 130
#define B10000011 131
#define B10000100 132
#define B10000101 133
#define B10000110 134
#define B10000111 135
#define B10001000 136
#define B10001001 137
#define B10001010 138
#define B10001011 139
#define B10001100 140
#define B10001101 141
#define B10001110 142
#define B10001111 143
#define B10010000 144
#define B10010001 145
#define B10010010 146
#define B10010011 147
#define B10010100 148
#define B10010101 149
#define B10010110 150
#define B10010111 151
#define B10011000 152
#define B10011001 153
#define B10011010 154
#define B10011011 155
#define B10011100 156
#define B10011101 157
#define B10011110 158
#define B10011111 159
#define B10100000 160
#define B10100001 161
#define B10100010 162
#define B10100011 163
#define B10100100 164
#define B10100101 165
#define B10100110 166
#define B10100111 167
#define B10101000 168
#define B10101001 169
#define B10101010 170
#define B10101011 171
#define B10101100 172
#define B10101101 173
#define B10101110 174
#define B10101111 175
#define B10110000 176
#define B10110001 177
#define B10110010 178
#define B10110011 179
#define B10110100 180
#define B10110101 181
#define B10110110 182
#define B10110111 183
#define B10111000 184
#define B10111001 185
#define B10111010 186
#define B10111011 187
#define B10111100 188
#define B10111101 189
#define B10111110 190
#define B10111111 191
#define B11000000 192
#define B11000001 193
#define B11000010 194
#define B11000011 195
#define B11000100 196
#define B11000101 197
#define B11000110 198
#define B11000111 199
#define B11001000 200
#define B11001001 201
#define B11001010 202
#define B11001011 203
#define B11001100 204
#define B11001101 205
#define B11001110 206
#define B11001111 207
#define B11010000 208
#define B11010001 209
#define B11010010 210
#define B11010011 211
#define B11010100 212
#define B11010101 213
#define B11010110 214
#define B11010111 215
#define B11011000 216
#define B11011001 217
#define B11011010 218
#define B11011011 219
#define B11011100 220
#define B11011101 221
#define B11011110 222
#define B11011111 223
#define B11100000 224
#define B11100001 225
#define B11100010 226
#define B11100011 227
#define B11100100 228
#define B11100101 229
#define B11100110 230
#define B11100111 231
#define B11101000 232
#define B11101001 233
#define B11101010 234
#define B11101011 235
#define B11101100 236
#define B11101101 237
#define B11101110 238
#define B11101111 239
#define B11110000 240
#define B11110001 241
#define B11110010 242
#define B11110011 243
#define B11110100 244
#define B11110101 245
#define B11110110 246
#define B11110111 247
#define B11111000 248
#define B11111001 249
#define B11111010 250
#define B11111011 251
#define B11111100 252
#define B11111101 253
#define B11111110 254
#define B11111111 255
#endif

View File

@@ -0,0 +1 @@
#pragma once

View File

@@ -0,0 +1,28 @@
#pragma once
// Timer stuff used by Stepper.cpp
typedef struct {
int divider;
int counter_dir;
int counter_en;
int alarm_en;
int intr_type;
bool auto_reload;
} timer_config_t;
const int TIMER_COUNT_UP = 0;
const int TIMER_PAUSE = 0;
const int TIMER_ALARM_EN = 0;
const int TIMER_INTR_LEVEL = 0;
typedef int timer_group_t;
typedef int timer_idx_t;
const timer_group_t TIMER_GROUP_0 = 0;
const timer_idx_t TIMER_0 = 0;
inline void timer_set_counter_value(timer_group_t group, timer_idx_t idx, uint64_t ticks) {}
inline void timer_set_alarm_value(timer_group_t group, timer_idx_t idx, uint64_t ticks) {}
inline void timer_init(timer_group_t group, timer_idx_t idx, timer_config_t* conf) {}
inline void timer_enable_intr(timer_group_t group, timer_idx_t idx) {}
inline void timer_start(timer_group_t group, timer_idx_t idx) {}
inline void timer_pause(timer_group_t group, timer_idx_t idx) {}
inline void timer_isr_register(timer_group_t group, timer_idx_t idx, void (*handler)(void*), void* arg, int a, void* arg1) {}

View File

@@ -0,0 +1,5 @@
#pragma once
typedef int uart_port_t;
#define UART_NUM_1 1

View File

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

View File

@@ -0,0 +1,43 @@
#pragma once
// Stub versions of FreeRTOS functions
typedef int TickType_t;
const int portMUX_INITIALIZER_UNLOCKED = 0;
const int portMAX_DELAY = 0;
const int portTICK_PERIOD_MS = 1;
const int portTICK_RATE_MS = 1;
typedef int portMUX_TYPE;
typedef int BaseType_t;
typedef unsigned int UBaseType_t;
typedef void* xQueueHandle;
typedef void* QueueHandle_t;
typedef void* TaskHandle_t;
typedef int TickType_t;
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) {
return pdPASS;
}
inline BaseType_t xQueueSend(QueueHandle_t queue, void* item, TickType_t ticks) {
return pdTRUE;
}
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 xTaskCreatePinnedToCore(
void (*task)(void*), const char* name, int stacksize, void* arg0, int pri, TaskHandle_t* th, int core) {}
inline int xTaskGetTickCount() {
return 0;
}
inline void vTaskDelayUntil(TickType_t* pxPreviousWakeTime, const TickType_t xTimeIncrement) {}
inline int xPortGetFreeHeapSize() {
return 0;
}
inline void vTaskEnterCritical(int* mutex) {}
inline void vTaskExitCritical(int* mutex) {}

View File

@@ -0,0 +1,10 @@
name=NativeStubs
version=1.0
author=MitchBradley
maintainer=MitchBradley
sentence=Stubs to compile Grbl_Esp32 on Windows
paragraph=
category=
url=https://github.com/bdring/Grbl_Esp32
architectures=windows_amd64

View File

@@ -0,0 +1,29 @@
#pragma once
#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()
// Templates don't work because of float/double promotion
#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
inline 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;
if (divisor == 0) {
return -1; //AVR returns -1, SAM returns 0
}
return (delta * dividend + (divisor / 2)) / divisor + out_min;
}
#define M_PI 3.1415926536

View File

@@ -0,0 +1,35 @@
#pragma once
const esp_err_t ESP_ERR_NVS_INVALID_HANDLE = 3;
const esp_err_t ESP_ERR_NVS_INVALID_NAME = 2;
const esp_err_t ESP_ERR_NVS_INVALID_LENGTH = 1;
const int NVS_READWRITE = 0;
inline esp_err_t nvs_open(const char* s, int mode, int* handle) {
return 0;
}
inline esp_err_t nvs_get_i32(int _handle, const char* _keyName, int* value) {
return -1;
}
inline esp_err_t nvs_set_i32(int _handle, const char* _keyName, int value) {
return -1;
}
inline esp_err_t nvs_get_i8(int _handle, const char* _keyName, signed char* value) {
return -1;
}
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) {
return -1;
}
inline esp_err_t nvs_set_str(int _handle, const char* _keyName, const char* value) {
return -1;
}
inline void nvs_erase_key(int _handle, const char* key) {}
inline esp_err_t nvs_get_blob(int handle, const char* _keyName, void* currentValue, size_t* len) {
return -1;
}
inline esp_err_t nvs_set_blob(int handle, const char* _keyName, void* currentValue, size_t len) {
return -1;
}