TinyGPU
Loading...
Searching...
No Matches
Classes | Namespaces | Functions | Variables
EmulationIDF.h File Reference

ESP-IDF-native emulation of exactly the Arduino surface TinyGPU/Drivers and TinyGPU/Input actually call - delay()/millis(), pinMode()/digitalWrite()/digitalRead() (+ HIGH/LOW/OUTPUT/INPUT/ INPUT_PULLUP), SPIClass/SPISettings (+ MSBFIRST/LSBFIRST/SPI_MODEn) and a global SPI (driver/spi_master.h), and TwoWire (+ a global Wire) on the legacy driver/i2c.h controller driver. More...

#include <stddef.h>
#include <stdint.h>
#include "driver/gpio.h"
#include "driver/i2c.h"
#include "driver/spi_master.h"
#include "esp_timer.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
Include dependency graph for EmulationIDF.h:

Go to the source code of this file.

Classes

struct  SPISettings
 
class  SPIClass
 
class  TwoWire
 

Namespaces

namespace  tinygpu
 

Functions

void delay (uint32_t ms)
 
unsigned long millis ()
 
void pinMode (int pin, int mode)
 
void digitalWrite (int pin, int value)
 Sets a GPIO output level, matching Arduino's digitalWrite().
 
int digitalRead (int pin)
 Reads a GPIO input level, matching Arduino's digitalRead().
 

Variables

constexpr int HIGH = 1
 
constexpr int LOW = 0
 
constexpr int INPUT = 0x00
 
constexpr int OUTPUT = 0x01
 
constexpr int INPUT_PULLUP = 0x02
 
constexpr int MSBFIRST = 0
 
constexpr int LSBFIRST = 1
 
constexpr int SPI_MODE0 = 0
 
constexpr int SPI_MODE1 = 1
 
constexpr int SPI_MODE2 = 2
 
constexpr int SPI_MODE3 = 3
 
SPIClass SPI
 
TwoWire Wire
 

Detailed Description

ESP-IDF-native emulation of exactly the Arduino surface TinyGPU/Drivers and TinyGPU/Input actually call - delay()/millis(), pinMode()/digitalWrite()/digitalRead() (+ HIGH/LOW/OUTPUT/INPUT/ INPUT_PULLUP), SPIClass/SPISettings (+ MSBFIRST/LSBFIRST/SPI_MODEn) and a global SPI (driver/spi_master.h), and TwoWire (+ a global Wire) on the legacy driver/i2c.h controller driver.

This is the ESP-IDF branch of TinyGPU/Emulation.h's fallback - include that instead of this file directly; it decides whether a real Arduino core is available, and routes here only when it isn't and ESP_PLATFORM is defined (a plain ESP-IDF component build via idf_component_register, without arduino-esp32).

Not a general Arduino-core replacement - only covers the calls this library's own Drivers/Input headers make (verified by grepping them), not the full Arduino API. A sketch built against this fallback that calls other Arduino functions will still need its own additions here, or the real Arduino core after all.

Not compiled or hardware-tested as part of this repo's own CI (which only exercises the desktop/Arduino-Emulator and Arduino-IDE paths) - treat it as a reasonable-effort starting point and verify against your exact IDF version/target before relying on it on real hardware.