Download data/Basic2/IoTBasic/hardware.h from introvoyz041/tinybasic: direct link, hf CLI and curl.
- Browser
- Download file 29.2 kB
-
https://huggingface.co/datasets/introvoyz041/tinybasic/resolve/main/data/Basic2/IoTBasic/hardware.h
- Command line
-
hf download hf://datasets/introvoyz041/tinybasic/data/Basic2/IoTBasic/hardware.h
-
curl -L -o hardware.h https://huggingface.co/datasets/introvoyz041/tinybasic/resolve/main/data/Basic2/IoTBasic/hardware.h
29.2 kB
| /* | |
| * Stefan's basic interpreter. | |
| * | |
| * Playing around with frugal programming. See the licence file on | |
| * https://github.com/slviajero/tinybasic for copyright/left. | |
| * (GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007) | |
| * | |
| * Author: Stefan Lenz, sl001@serverfabrik.de | |
| * | |
| * Architectures and the definitions from the Arduino IDE. | |
| * | |
| * Arduino hardware settings , set here what you need or | |
| * use one of the predefined configurations below. | |
| * | |
| * If HARDWAREHEURISTICS is set, some of the settings below | |
| * are activated automatically for some platforms. If you want | |
| * to control ALL settings below manually, undef HARDWAREHEURISTICS | |
| * | |
| * Input/output methods ARUINOPICOSERIAL, ARDUINOPS2 | |
| * ARDUINOUSBKBD, ARDUINOZX81KBD, ARDUINOI2CKBD, GIGAUSBKBD | |
| * ARDUINOPRT, DISPLAYCANSCROLL, ARDUINOLCDI2C, | |
| * ARDUINOTFT, ARDUINONOKIA51, ARDUINOILI9488, | |
| * ARDUINOSSD1306, ARDUINOMCUFRIEND | |
| * Storage ARDUINOEEPROM, ARDUINOSD, ESPSPIFFS, RP2040LITTLEFS | |
| * storage ARDUINOEFS, SM32SDIO, ESP32FAT, ESPSDMMC | |
| * sensors ARDUINOWIRE, ARDUINOSIMPLEWIRE, ARDUINOSENSORS | |
| * network ARDUINORF24, ARDUNIOMQTT | |
| * memory ARDUINOSPIRAM | |
| * real time clocks ARDUINORTC, ARDUINORTCEMULATION | |
| * | |
| * Secial features | |
| * ARDUINOPGMEEPROM: makes the EEPROM primary program store | |
| * HASMSTAB: counts characters, prerequisite for MSTAB in languages | |
| * BUILDIN: include buildin programs | |
| * | |
| * Instead of setting all this manually, you can use one of the | |
| * predefined hardware models. They are stored in board and are sources | |
| * here later in the code to override some of the defaults. Custom configurations | |
| * coming with BASIC are: | |
| * | |
| * dummy.h: | |
| * do nothing. | |
| * avrlcd.h: | |
| * a AVR system with a LCD shield | |
| * avrmcufriend.h: | |
| * a AVR system with a parallel TFT | |
| * wemosshield.h: | |
| * a ESP8266 UNO lookalike with a modified datalogger shield | |
| * great hardware for small BASIC based IoT projects. | |
| * megashield.h: | |
| * an Arduino Mega with Ethernet Shield optional keyboard | |
| * and i2c display | |
| * megatft.h: | |
| * duetft.h: | |
| * TFT 7inch screen systems, standalone | |
| * nanoboard.h: | |
| * Arduino Nano Every board with PS2 keyboard and sensor | |
| * kit. | |
| * megaboard.h: | |
| * A board for the MEGA with 64 kB RAM, SD Card, and real time | |
| * clock. | |
| * unoboard.h: | |
| * A board for an UNO with 64kB memory and EEPROM disk | |
| * fits into an UNO flash only with integer | |
| * esp01board.h: | |
| * ESP01 based board as a sensor / MQTT interface | |
| * rp2040board.h: | |
| * A ILI9488 hardware design based on an Arduino connect RP2040. | |
| * rp2040board2.h: | |
| * like the one above but based on the Pi Pico core | |
| * esp32board.h: | |
| * same like above with an ESP32 core | |
| * mkboard.h: | |
| * a digital signage and low energy board | |
| * tdeck.h: | |
| * the LILYGO T-Deck - not yet finished | |
| * ttgovga.h: | |
| * the TTGO VGA 1.4 board with VGA output | |
| */ | |
| /* undef this if you want to overide all defaults, then use the settings below */ | |
| /* | |
| * These are the individual settings. Logic: | |
| * PREDEFINEDBOARD is set, and some of the settings below are | |
| * activated automatically. | |
| * HARDWAREHEURISTICS is set, some of the settings below are | |
| * activated automatically depending on the hardware. | |
| * HARDWAREHEURISTICS is not set, all settings below are | |
| * have to be set manually. | |
| * | |
| * Important: HARDWAREHEURISTICS is processed last in the code | |
| * so it can override all settings below. | |
| * | |
| * In one sentence: | |
| * First PREDEFINEDBOARD, then manual settings, then HARDWAREHEURISTICS. | |
| */ | |
| /* | |
| #undef ARDUINOPICOSERIAL | |
| #undef ARDUINOPS2 | |
| #undef ARDUINOUSBKBD | |
| #undef ARDUINOZX81KBD | |
| #undef ARDUINOI2CKBD | |
| #undef GIGAUSBKBD | |
| #undef ARDUINOPRT | |
| #undef DISPLAYCANSCROLL | |
| #undef ARDUINOLCDI2C | |
| #undef ARDUINONOKIA51 | |
| #undef ARDUINOILI9488 | |
| #undef ARDUINOSSD1306 | |
| #undef ARDUINOMCUFRIEND | |
| #undef ARDUINOEDP47 | |
| #undef ARDUINOGRAPHDUMMY | |
| #undef LCDSHIELD | |
| #undef ARDUINOTFT | |
| #undef ARDUINOVGA | |
| #undef TFTESPI | |
| #undef ARDUINOEEPROM | |
| #undef ARDUINOI2CEEPROM | |
| #undef ARDUINOEFS | |
| #undef ARDUINOSD | |
| #undef ESPSDMMC | |
| #undef ESPSPIFFS | |
| #undef ESP32FAT | |
| #undef RP2040LITTLEFS | |
| #undef STM32SDIO | |
| #undef GIGAUSBFS | |
| #undef ARDUINORTC | |
| #undef ARDUINORTCEMULATION | |
| #undef ARDUINOTONEEMULATION | |
| #undef ARDUINOWIRE | |
| #undef ARDUINOSIMPLEWIRE | |
| #undef ARDUINOWIRESLAVE | |
| #undef ARDUINORF24 | |
| #undef ARDUINOETH | |
| #undef ARDUINOMQTT | |
| #undef ARDUINOSENSORS | |
| #undef ARDUINOSPIRAM | |
| #undef STANDALONE | |
| #undef STANDALONESECONDSERIAL | |
| */ | |
| // #define ALTSERIAL Serial | |
| /* we debug the runtime library and where the logging goes */ | |
| /* the memory size, set to 0 means determine automatically | |
| leaving it undefined means zero. setting it larger than 16 bit | |
| make the address_t 32bit */ | |
| /* experimental features, don't use unless you know the code */ | |
| /* | |
| * this setting uses the EEPROM as program storage | |
| * The idea is to create a virtual memory layout starting from 0 with the EEPROM | |
| * from elength() and then adding the BASIC RAM to it. himem and top need to be | |
| * handled carefully. | |
| */ | |
| /* IO control, emulate real tab by counting characters, on by default | |
| but overriden for very small boards - see hardware heuristics */ | |
| /* VT52 settings, on by default but override further down for very | |
| small boards, check the hardware heuristics section if you need VT52 | |
| on small AVR boards */ | |
| /* | |
| * Experimental BUILDIN feature, implemented as a filesystem. | |
| * Buildin BASIC programs are stored in the flash memory of the Arduino. | |
| * They appear as files in the filesystem. | |
| */ | |
| /* this is the demo module */ | |
| /* a small tutorial */ | |
| // #define BUILDINMODULE "buildin/buildin-tutorial.h" | |
| /* test program for Arduinos */ | |
| // #define BUILDINMODULE "buildin/buildin-arduinotest.h" | |
| /* a games module */ | |
| // #define BUILDINMODULE "buildin/buildin-games.h" | |
| /* interrupts for the EVENT command, this is needed to use Arduino interrupts */ | |
| /* | |
| * handle the break condition in the background. | |
| * Off by default but needed for some keyboards. | |
| * On an UNO 170 bytes overhead if on and 5% | |
| * performance loss. If any system runs background | |
| * tasks anyway, better to switch it on. | |
| */ | |
| /* | |
| * This code measures the fast ticker frequency in microseconds | |
| * It counts the number of tokens drawn plus statements executed. | |
| */ | |
| /* the default EEPROM dummy size */ | |
| /* | |
| * PIN settings and I2C addresses for various hardware configurations | |
| * used a few heuristics and then the hardware definitions above | |
| * | |
| * #define SDPIN sets the SD CS pin - can be left as a default for most HW configs | |
| * TTGO needs it as default definitions in the board file are broken | |
| * #define PS2DATAPIN, PS2IRQPIN sets PS2 pin | |
| */ | |
| /* PS2 Keyboard pins for AVR - use one interrupt pin 2 and one date pin | |
| 5 not 4 because 4 conflicts with SDPIN of the standard SD shield */ | |
| /* | |
| * Pin settings for the ZX81 Keyboard | |
| * first the 8 rows, then the 5 columns or the keyboard | |
| * | |
| * MEGAs have many pins and default is to use the odd pins on the side | |
| * UNOs, NANOs, and others use the lower pins by default avoiding the | |
| * pin 13 which is LED and doesn't work with standard schematics | |
| */ | |
| /* Ethernet - 10 is the default */ | |
| /* #define ETHPIN 10 */ | |
| /* The Pretzelboard definitions for Software Serial, conflicts with SPI */ | |
| /* near field pin settings for CE and CSN*/ | |
| /* use standard I2C pins almost always */ | |
| /* | |
| * BREAKCHAR is the character stopping the program on Ardunios | |
| * BREAKPIN can be set, it is a pin that needs to go to low to stop a BASIC program | |
| * This should be done in hardware*.h | |
| * BREAKSIGNAL can also be set, should be done in hardware*.h | |
| */ | |
| /* set this is you want pin 4 on low interrupting the interpreter */ | |
| /* #define BREAKPIN 4 */ | |
| /* the primary serial stream aka serial aka sream 1 */ | |
| /* the secondary serial port aka prt aka stream 4 */ | |
| /* | |
| * this is soft SPI for SD cards on MEGAs using | |
| * pins 10-13, a patched SD library is needed | |
| * for this: https://github.com/slviajero/SoftSD | |
| * only needed for MEGA boards with an UNO shield | |
| */ | |
| /* | |
| * list of default i2c addresses | |
| * | |
| * some clock modules do have their EEPROM at 0x57. | |
| * 0x050 this is the default lowest adress of standard EEPROMs | |
| * Configurable range is between 0x50 and 0x57 for modules with jumpers. | |
| * Some clock modules do have their EEPROM at 0x57. | |
| * | |
| * Clock default for the size is 4096. Define your EFS EEPROM and I2C EEPROM | |
| * size here. One parameter set is for EFS and one parameter set is for | |
| * plain serial EEPROMs. | |
| * | |
| * RTCs are often at 0x68 | |
| */ | |
| /* #define EFSEEPROMSIZE 32768 */ | |
| /* the size of the plain I2C EEPROM, typically a clock */ | |
| /* #define I2CEEPROMADDR 0x057 */ | |
| /* #define I2CEEPROMSIZE 4096 */ | |
| /* definition for an external EEPROM */ | |
| /* is the I2C EEPROM buffered, left open here for the board file to decided - defaults to unbuffered */ | |
| /* #define ARDUINOI2CEEPROM_BUFFERED */ | |
| /* use the direct i2c code and bypass the Wire library on AVR | |
| * default off here, board file and heuristics to decide, this | |
| * is currently only implemented on ARDUINO_ARCH_AVR and tested on UNO | |
| */ | |
| /* | |
| * Sensor library code - configure your sensors here, will go to a | |
| * separate file in the future | |
| */ | |
| /* | |
| * Keyboard configuation code, currently only GERMAN and US are supported | |
| * This is used for PS2, FABGL and USB. USB very raw. | |
| * ZX81 is not supported with different languages, I only have a UK one. | |
| */ | |
| //#define ARDUINOKBDLANG_US | |
| /* | |
| * The heuristics. These are things that normally would make sense on a | |
| * board. | |
| */ | |
| /* | |
| * Buffer sizes depending on what we are doing. | |
| */ | |
| /* the small memory model with shallow stacks and small buffers */ | |
| /* the for larger microcontrollers */ | |
| /* UNOS are very common. Small memory, we put the program into EEPROM and make everything small */ | |
| /* der Pro */ | |
| /* on a DUEMILA we allocate just as little main memory as possible, currenly not working because sketch too big | |
| * needs to be checked */ | |
| /* tested for LTQF32 Mini EVB - very low memory as core needs a lot */ | |
| /* all AVR 8 bit boards have an EEPROM (most probably) */ | |
| /* megaAVR boards have an EEPROM */ | |
| /* LEONARDO boards */ | |
| /* to be done */ | |
| /* all ESPs best are compiled with ESPSPIFFS predefined */ | |
| /* all ESPs best have EEPROM emulation */ | |
| /* all RP2040 boards best are compiled with RP2040LITTLEFS predefined */ | |
| /* use the EEPROM dummy of the NRESESA boards */ | |
| /* for XMC there is an EEPROM emulation, which needs: https://github.com/slviajero/XMCEEPROMLib */ | |
| /* the China Nano clones. Super fast but with very small flash. */ | |
| /* | |
| * Now source the the hardware models if this is set. | |
| */ | |
| /* | |
| * Here, dependencies are handled. Some settings require others to be set | |
| * first. | |
| * | |
| * Examples: | |
| * Many filesystems and displays need SPI. | |
| * Some components need Wire. | |
| * Some platforms do not have tone, so we need to emulate it. | |
| */ | |
| /* | |
| * DUE has no tone, we switch to emulation mode automatically. | |
| */ | |
| /* | |
| * Some settings, defaults, and dependencies | |
| * | |
| * HASWIRE is set to start wire. Some libraries do this again. | |
| * | |
| * Handling Wire and SPI is tricky as some of the libraries | |
| * also include and start SPI and Wire code. | |
| * | |
| * HASIMPLEWIRE avoids the overhead of importing the entire | |
| * filesystem code. It only activates plain Wire and provides | |
| * the WIRE command in basic. | |
| */ | |
| /* | |
| * Safety net for ARDUINODIRECTI2C, architectures that are | |
| * not AVR 8 bit and do not have TWDR are not supported. | |
| */ | |
| /* a clock needs wire */ | |
| /* a display needs wire */ | |
| /* EEPROM storage needs wire */ | |
| /* external EEPROMs also need wire */ | |
| /* external EEPROM buffered needs full wire support, because EFS not ported */ | |
| /* plain Wire support also needs wire ;-) */ | |
| /* and I2C Keyboard needs wire */ | |
| /* the BASIC command/function WIRE */ | |
| /* radio needs SPI */ | |
| /* a filesystem needs SPI */ | |
| /* networking may need SPI */ | |
| /* the NOKIA and ILI9488 display needs SPI */ | |
| /* the RAM chips */ | |
| /* Networking and keyboards need the background task capability */ | |
| /* the ESP8266 needs to run the background task calls for the scheduler */ | |
| /* Break in background needs background tasks as well */ | |
| /* picoserial is not a available on many platforms */ | |
| /* | |
| * incompatibilities and library stuff | |
| */ | |
| /* these platforms have no EEPROM and no emulation built-in */ | |
| /* | |
| * SD filesystems with the standard SD driver | |
| * for MEGA 256 a soft SPI solution is needed | |
| * if standard shields are used, this is a patched | |
| * SD library https://github.com/slviajero/SoftSD | |
| */ | |
| /* | |
| * ESPSPIFFS tested on ESP8266 and ESP32 | |
| * supports formating in BASIC | |
| */ | |
| /* | |
| * ESP32FAT tested on ESP32 | |
| * supports formating in BASIC | |
| */ | |
| /* | |
| * RP2040 internal filesystem | |
| * This is test code from https://github.com/slviajero/littlefs | |
| * and the main branch is actively developed | |
| */ | |
| /* | |
| * STM32 SDIO driver for he SD card slot of the STM32F4 boards (and others) | |
| */ | |
| /* | |
| * The USB filesystem of the GIGA board | |
| */ | |
| /* | |
| * external flash file systems override internal filesystems | |
| * currently BASIC can only have one filesystem | |
| */ | |
| /* | |
| * support for external EEPROMs as filesystem | |
| * overriding all other filessystems. This is a minimalistic | |
| * filesystem meant for very small systems with not enough | |
| * memory for real filesystems | |
| * https://github.com/slviajero/EepromFS | |
| */ | |
| /* | |
| * The build in file system for read only programs, only | |
| * if there is no other file system present | |
| */ | |
| /* | |
| * Software SPI only on Mega2560 | |
| */ | |
| /* | |
| * I used these two articles | |
| * https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/ | |
| * https://randomnerdtutorials.com/esp32-deep-sleep-arduino-ide-wake-up-sources/ | |
| * for this very simple implementation - needs to be improved (pass data from sleep | |
| * state to sleep state via EEPROM) | |
| */ | |
| /* this is done only here now to make sure HASCLOCK is set properly */ | |
| /* STM32duino have the same structure */ | |
| /* the NRENESA board have a buildin RTC as well */ | |
| /* | |
| * global variables for a standard LCD shield. | |
| * Includes the standard Arduino LiquidCrystal library | |
| */ | |
| /* | |
| * A LCD display connnected via I2C, uses the standard | |
| * Arduino I2C display library. | |
| */ | |
| /* | |
| * A Nokia 5110 with ug8lib2 - can scroll quite well | |
| * https://github.com/olikraus/u8g2/wiki/u8g2reference | |
| * This is a buffered display it has a dspupdate() function | |
| * it also needs to call dspgraphupdate() after each graphic | |
| * operation | |
| * | |
| * default PIN settings here are for ESP8266, using the standard | |
| * SPI SS for 15 for CS/CE, and 0 for DC, 2 for reset | |
| * | |
| */ | |
| /* | |
| * 4.7 inch epaper displays are derived from the NOKIA51 code, no grayscales | |
| * at the moment. Forcing the font into rectangles and hoping this works. | |
| * | |
| * Epapers bypass the display driver here and use a graphics based display | |
| * mode instead | |
| */ | |
| /* | |
| * Small SSD1306 OLED displays with I2C interface | |
| * This is a buffered display it has a dspupdate() function | |
| * it also needs to call dspgraphupdate() after each graphic | |
| * operation | |
| */ | |
| /* | |
| * A ILI9488 with Jarett Burkets version of Adafruit GFX and patches | |
| * by Stefan Lenz | |
| * currently only slow software scrolling implemented in BASIC | |
| * | |
| * https://github.com/slviajero/ILI9488 | |
| * | |
| * we use 9, 8, 7 as CS, CE, RST by default and A7 for the led brightness control | |
| */ | |
| /* | |
| * A MCUFRIEND parallel port display for the various tft shields | |
| * This implementation is mainly for Arduino MEGA | |
| * | |
| * currently only slow software scrolling implemented in BASIC | |
| * | |
| */ | |
| /* | |
| * The driver for the TFT_eSPI graphics of the T-Deck from Lilygo | |
| * currently not finished | |
| */ | |
| /* | |
| * A no operations graphics dummy | |
| * Tests the BASIC side of the graphics code without triggering | |
| * any output | |
| */ | |
| /* | |
| * SD1963 TFT display code with UTFT. | |
| * Tested witth SD1963 800*480 board. | |
| * it is mainly intended for a MEGA or DUE as a all in one system | |
| * this is for a MEGA shield and the CTE DUE shield, for the due | |
| * you need to read the comment in Arduino/libraries/UTFT/hardware/arm | |
| * HW_ARM_defines.h -> uncomment the DUE shield | |
| * See also | |
| * https://github.com/slviajero/tinybasic/wiki/Projects:-4.-A-standalone-computer-with-a-TFT-screen-based-on-a-DUE | |
| */ | |
| /* | |
| * Keyboard code for either the Fablib Terminal class or | |
| * PS2Keyboard - please note that you need the ESP patched | |
| * version here as mentioned above | |
| * | |
| * sets HASKEYBOARD to inform basic about this capability | |
| * | |
| * keyboards can implement | |
| * kbdbegin() | |
| * they need to provide | |
| * kbdavailable(), kbdread(), kbdcheckch() | |
| * the later is for interrupting running BASIC code | |
| */ | |
| /* BREAKINBACKGROUND is needed here to avoid slowdown, probably also for the other keyboards */ | |
| /* set the HASKEYBOARD feature to tell BASIC about it */ | |
| /* | |
| * Arduino Real Time clock. The interface here offers the values as number_t | |
| * combining all values. | |
| * | |
| * The code does not use an RTC library any more all the rtc support is | |
| * builtin now. | |
| * | |
| * A clock must activate the macro #define HASCLOCK to make the clock | |
| * available in BASIC. | |
| * | |
| * The following software models are supported | |
| * - Built-in clocks of STM32 and MKR and NRESAS and XIAO are supported by default | |
| * as RTCZero type code | |
| * - Built-in clocks of ESP32 are supported by default with a time structure type code | |
| * - Built-in clocks of GIGA the same as ESP32 | |
| * - I2C clocks can be activated: DS1307, DS3231, and DS3232 | |
| * - A Real Time Clock emulation is possible using millis() | |
| * | |
| * rtcget accesses the internal registers of the clock. | |
| * Registers 0-6 are bcd transformed to return | |
| * seconds, minutes, hours, day of week, day, month, year | |
| * | |
| * On I2C clocks registers 7-255 are returned as memory cells | |
| */ | |
| /* | |
| * External EEPROM is handled through an EFS filesystem object | |
| * see https://github.com/slviajero/EepromFS | |
| * for details. Here the most common parameters are set as a default. | |
| */ | |
| /* | |
| * Tell BASIC we have a second serial port | |
| */ | |
| /* | |
| * Tell BASIC we have a radio adapter | |
| */ | |
| /* | |
| * Tell BASIC we have MQTT and make sure one low level | |
| * interface is available | |
| */ | |
| /* | |
| * handling the PROGMEM macros | |
| */ | |
| /* | |
| * if the PROGMEM macro is define we compile on the Arduino IDE | |
| * we undef all hardware settings otherwise a little odd | |
| */ | |
| /* on XMC we circumvent progmem */ | |
| /* the code to address EEPROMs directly */ | |
| /* only AVR controllers are tested with this, don't use elsewhere, there are multiple bugs */ | |
| /* the SPI RAM interface */ | |
| /* | |
| * to handle strings in situations with a memory interface two more buffers are | |
| * needed they store intermediate results of string operations. The buffersize | |
| * limits the maximum string length indepents of how big strings are set. | |
| * | |
| * default is 128, on an MEGA 512 is possible | |
| */ | |
| /* | |
| * Does the platform has command line args and do we want to use them | |
| * Arduinos don't have them | |
| */ | |
| /* | |
| * How restrictive are we on function recursive calls to protect the stack | |
| * On 8 bit Arduinos this needs to be limited strictly | |
| */ | |
| /* | |
| * here the runtime environment makes a good guess which | |
| * language can be supported by the boards. This is tricky | |
| * it may not always work. | |
| * | |
| * MEGAAVR does BASICFULL but this leaves little room for hardware drivers | |
| * LEONARDO currently broken, to much flash allocated. | |
| */ | |