#include <Wire.h>
#include <Adafruit_GFX.h>
//#include <Adafruit_SSD1306.h>
#include "SSD1306Wire.h"
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA 2, SCL 5 pins)
#define OLED_RESET -1 // Reset pin # 4 (or -1 if sharing Arduino reset pin)
//Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
SSD1306Wire display(0x3c, 12, 14); // ADDRESS, SDA, SCL
#include "ESPF_7073.h"
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
//Wire.begin();
// if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3D)) {
// Serial.println(F("SSD1306 allocation failed"));
// for(;;);
// }
/*
display.init();
display.clear();
display.display();
display.flipScreenVertically();
display.setFont(ArialMT_Plain_10);
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.setContrast(255);
display.clear();
display.drawString(64, 10, "ESPForth 7.0.7.3");
display.display();
*/
cell_t fh = heap_caps_get_free_size(MALLOC_CAP_INTERNAL);
cell_t hc = heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL);
if (fh - hc < MINIMUM_FREE_SYSTEM_HEAP) {
hc = fh - MINIMUM_FREE_SYSTEM_HEAP;
}
cell_t *heap = (cell_t *) malloc(hc);
forth_init(0, 0, heap, hc, boot, sizeof(boot));
Serial.println("ESPF>");
}
void loop() {
g_sys->rp = forth_run(g_sys->rp);
delay(10); // this speeds up the simulation
}