arduino-emulator
Loading...
Searching...
No Matches
arduino Namespace Reference

We provide the WiFi class to simulate the Arduino WIFI. In in Linux we can expect that networking is already active. So we dont need to do anything. More...

Classes

struct  __container__
class  ArduinoLogger
 A simple Logger that writes messages dependent on the log level. More...
class  CanMsg
class  CanMsgRingbuffer
class  Client
class  DMABuffer
class  DMAPool
class  EspClass
 ESP32 compatible ESP object (ESP.getFreeHeap() ...), so that ESP32 sketches also run on the desktop. The heap is the memory of the computer; there is no PSRAM: the psram functions return 0. More...
class  EthernetClient
class  EthernetImpl
class  EthernetServer
class  EthernetUDP
class  FileStream
 We use the FileStream class to be able to provide Serial, Serial1 and Serial2 outside of the Arduino environment;. More...
struct  FirmataAnalogMessage
 A single analog pin report (device -> host). More...
struct  FirmataDigitalMessage
 A digital port report (device -> host), 8 pins packed into one message. More...
struct  FirmataSysexMessage
class  FirmataTransport
 Single reader thread + byte-stream parser shared by every Firmata-based hardware backend (GPIO, I2C, SPI, ...) that talks to the same device. More...
class  GPIOSource
 Abstract interface for providing GPIO hardware implementations. More...
class  GPIOWrapper
 GPIO wrapper class that provides flexible hardware abstraction. More...
class  HardwareCAN
class  HardwareGPIO
 Abstract base class for GPIO (General Purpose Input/Output) functions. More...
class  HardwareGPIO_FIRMATA
 GPIO hardware abstraction that speaks the Firmata protocol over an arbitrary Stream (e.g. a serial connection to a device running StandardFirmata). More...
class  HardwareGPIO_FTDI
 GPIO hardware abstraction for FTDI FT2232HL in the Arduino emulator. More...
class  HardwareGPIO_RPI
 GPIO hardware abstraction for Raspberry Pi in the Arduino emulator. More...
class  HardwareI2C
class  HardwareI2C_FIRMATA
 I2C master implementation that speaks the Firmata protocol (I2C_REQUEST/I2C_REPLY/I2C_CONFIG SysEx messages, as implemented by StandardFirmata and ConfigurableFirmata's I2CFirmata feature). More...
class  HardwareI2C_FTDI
 Implementation of I2C communication for FTDI FT2232HL using MPSSE mode. More...
class  HardwareI2C_RPI
 Implementation of I2C communication for Raspberry Pi using Linux I2C device interface. More...
class  HardwareSerial
class  HardwareService
 Provides a virtualized hardware communication service for SPI, I2C, I2S, and GPIO over a stream. More...
class  HardwareSetupFIRMATA
 Sets up hardware interfaces (GPIO, I2C, SPI) that talk to a remote board running Firmata, all multiplexed over one FirmataTransport. More...
class  HardwareSetupFTDI
 Sets up hardware interfaces for FTDI FT2232HL (GPIO, I2C, SPI). More...
class  HardwareSetupRemote
 Configures and manages remote hardware interfaces for Arduino emulation. More...
class  HardwareSetupRPI
 Sets up hardware interfaces for Raspberry Pi (GPIO, I2C, SPI). More...
class  HardwareSPI
class  HardwareSPI_FIRMATA
 SPI master implementation that speaks the SysEx SPI protocol implemented by ConfigurableFirmata's SpiFirmata feature. More...
class  HardwareSPI_FTDI
 Implementation of SPI communication for FTDI FT2232HL using MPSSE mode. More...
class  HardwareSPI_RPI
 Implementation of SPI communication for Raspberry Pi using Linux SPI device interface. More...
class  I2CSource
 Abstract interface for providing I2C hardware implementations. More...
class  I2CWrapper
 I2C wrapper class that provides flexible hardware abstraction. More...
class  IPAddress
class  NetworkClientSecure
 NetworkClientSecure based on TinyTLS (default) or wolf ssl. More...
class  PluggableUSB_
class  PluggableUSBModule
class  Print
class  Printable
class  RemoteGPIO
 Remote GPIO implementation that operates over a communication stream. More...
class  RemoteI2C
 Remote I2C implementation that operates over a communication stream. More...
class  RemoteSerialClass
 Remote Serial implementation that operates over a communication stream. More...
class  RemoteSPI
 Remote SPI implementation that operates over a communication stream. More...
class  RingBufferExt
 Implementation of a Simple Circular Buffer. Instead of comparing the position of the read and write pointer in order to figure out if we still have characters available or space left to write we keep track of the actual length which is easier to follow. This class was implemented to support the reading and writing of arrays. More...
class  RingBufferN
class  SerialImpl
class  Server
class  SocketImpl
class  SocketImplSecure
 SSL Socket using wolf ssl. For error codes see https://wolfssl.jp/docs-3/wolfssl-manual/appendix-c. More...
class  SocketRuntime
class  SPISettings
class  SPISource
 Abstract interface for providing SPI hardware implementations. More...
class  SPIWrapper
 SPI wrapper class that provides flexible hardware abstraction. More...
class  SPSCQueue
class  StdioDevice
 Provides a Stream interface for standard input/output operations outside the Arduino environment. More...
class  Stream
class  String
class  StringSumHelper
class  UDP
class  UDPStream
 A UDP class which makes sure that we can use UDP as simple Stream w/o additional complexity. When we did not specify a target IP address we send the data to the address we received the data. Single character writes will be buffered up to the defined write buffer size (default 256 bytes). More...
class  WifiMock

Typedefs

typedef int esp_err_t
typedef int gpio_num_t
typedef RingBufferN< SERIAL_BUFFER_SIZE > RingBuffer
using SocketHandle = int
using SocketLength = socklen_t
typedef HardwareSPI SPIClass
using TwoWire = I2CWrapper
 Type alias for Arduino compatibility - TwoWire refers to I2CWrapper.
template<typename T>
using voidTemplateFuncPtrParam = void (*)(T param)
using WiFiClient = EthernetClient
 Alias for EthernetClient to provide WiFiClient compatibility.
using WiFiClientSecure = EthernetClient
 Alias for EthernetClient to provide WiFiClientSecure compatibility when HTTPS is not used.
using WiFiServer = EthernetServer
 Alias for EthernetServer to provide WiFiServer compatibility.
using WiFiUDP = EthernetUDP
 Alias for EthernetUDP to provide WiFiUDP compatibility.

Enumerations

enum  { DMA_BUFFER_READ = (1 << 0) , DMA_BUFFER_WRITE = (1 << 1) , DMA_BUFFER_DISCONT = (1 << 2) , DMA_BUFFER_INTRLVD = (1 << 3) }
enum  HWCalls {
  I2cBegin0 , I2cBegin1 , I2cEnd , I2cSetClock ,
  I2cBeginTransmission , I2cEndTransmission1 , I2cEndTransmission , I2cRequestFrom3 ,
  I2cRequestFrom2 , I2cOnReceive , I2cOnRequest , I2cWrite ,
  I2cAvailable , I2cRead , I2cPeek , SpiTransfer ,
  SpiTransfer8 , SpiTransfer16 , SpiUsingInterrupt , SpiNotUsingInterrupt ,
  SpiBeginTransaction , SpiEndTransaction , SpiAttachInterrupt , SpiDetachInterrupt ,
  SpiBegin , SpiEnd , GpioPinMode , GpioDigitalWrite ,
  GpioDigitalRead , GpioAnalogRead , GpioAnalogReference , GpioAnalogWrite ,
  GpioTone , GpioNoTone , GpioPulseIn , GpioPulseInLong ,
  GpioAnalogWriteFrequency , GpioAnalogWriteResolution , SerialBegin , SerialEnd ,
  SerialWrite , SerialRead , SerialAvailable , SerialPeek ,
  SerialFlush , I2sSetup , I2sBegin3 , I2sBegin2 ,
  I2sEnd , I2sAvailable , I2sRead , I2sPeek ,
  I2sFlush , I2sWrite , I2sAvailableForWrite , I2sSetBufferSize
}
 We virtualize the hardware and send the requests and replys over a stream.
enum  IPType { IPv4 , IPv6 }
enum  LookaheadMode { SKIP_ALL , SKIP_NONE , SKIP_WHITESPACE }
enum  SPIBusMode { SPI_CONTROLLER = 0 , SPI_PERIPHERAL = 1 }
enum  SPIMode { SPI_MODE0 = 0 , SPI_MODE1 = 1 , SPI_MODE2 = 2 , SPI_MODE3 = 3 }
enum  wifi_ps_type_t { WIFI_PS_NONE , WIFI_PS_MIN_MODEM , WIFI_PS_MAX_MODEM }
enum  WiFiMode_t { WIFI_OFF = 0 , WIFI_STA = 1 , WIFI_AP = 2 , WIFI_AP_STA = 3 }
enum  wl_status_t {
  WL_NO_SHIELD = 255 , WL_IDLE_STATUS = 0 , WL_NO_SSID_AVAIL , WL_SCAN_COMPLETED ,
  WL_CONNECTED , WL_CONNECT_FAILED , WL_CONNECTION_LOST , WL_DISCONNECTED
}

Functions

struct __attribute__ ((packed))
template<typename T>
void attachInterrupt (pin_size_t interruptNum, voidTemplateFuncPtrParam< T * > userFunc, PinStatus mode, T *param)
template<typename T>
void attachInterrupt (pin_size_t interruptNum, voidTemplateFuncPtrParam< T > userFunc, PinStatus mode, T &param)
uint32_t CanExtendedId (uint32_t const id)
uint32_t CanStandardId (uint32_t const id)
void closeSocket (SocketHandle socket)
static char * defaultInterface ()
void digitalWrite (pin_size_t pinNumber, int status)
void ensureSocketRuntime ()
void esp_deep_sleep_start ()
 Deep sleep without wake-up source: ends the program.
uint32_t getCpuFrequencyMhz ()
 ESP32: cpu frequency in MHz.
void gpio_deep_sleep_hold_dis ()
void gpio_deep_sleep_hold_en ()
esp_err_t gpio_hold_dis (gpio_num_t pin)
esp_err_t gpio_hold_en (gpio_num_t pin)
bool isAlpha (int c) __attribute__((always_inline))
bool isAlphaNumeric (int c) __attribute__((always_inline))
bool isAscii (int c) __attribute__((always_inline))
bool isControl (int c) __attribute__((always_inline))
bool isDigit (int c) __attribute__((always_inline))
bool isGraph (int c) __attribute__((always_inline))
bool isHexadecimalDigit (int c) __attribute__((always_inline))
bool isLowerCase (int c) __attribute__((always_inline))
bool isPrintable (int c) __attribute__((always_inline))
bool isPunct (int c) __attribute__((always_inline))
bool isSpace (int c) __attribute__((always_inline))
bool isUpperCase (int c) __attribute__((always_inline))
bool isWhitespace (int c) __attribute__((always_inline))
StringSumHelper & operator+ (const StringSumHelper &lhs, char c)
StringSumHelper & operator+ (const StringSumHelper &lhs, const __FlashStringHelper *rhs)
StringSumHelper & operator+ (const StringSumHelper &lhs, const char *cstr)
StringSumHelper & operator+ (const StringSumHelper &lhs, const String &rhs)
StringSumHelper & operator+ (const StringSumHelper &lhs, double num)
StringSumHelper & operator+ (const StringSumHelper &lhs, float num)
StringSumHelper & operator+ (const StringSumHelper &lhs, int num)
StringSumHelper & operator+ (const StringSumHelper &lhs, long num)
StringSumHelper & operator+ (const StringSumHelper &lhs, unsigned char num)
StringSumHelper & operator+ (const StringSumHelper &lhs, unsigned int num)
StringSumHelper & operator+ (const StringSumHelper &lhs, unsigned long num)
void pinMode (pin_size_t pinNumber, int mode)
static gpiod_line_request * requestLine (gpiod_chip *chip, pin_size_t pin, gpiod_line_direction direction, gpiod_line_value initial=GPIOD_LINE_VALUE_INACTIVE)
static FileStream Serial1 ("/dev/ttyACM0")
static FileStream Serial1 (nullptr, nullptr)
 Global Serial1 instance for secondary serial communication.
static FileStream Serial2 ("/dev/serial0")
 Second hardware serial port for Raspberry Pi.
void serialEventRun (void) __attribute__((weak))
bool setSocketNonBlocking (SocketHandle socket, bool enabled=true)
bool socketConnectionReset (int error)
int socketLastError ()
bool socketWouldBlock (int error)
int toAscii (int c) __attribute__((always_inline))
int toLowerCase (int c) __attribute__((always_inline))
int toUpperCase (int c) __attribute__((always_inline))

Variables

static constexpr uint8_t ANALOG_MESSAGE = 0xE0
static constexpr uint8_t ANALOG_MESSAGE = 0xE0
const SPISettings DEFAULT_SPI_SETTINGS = SPISettings()
static constexpr uint8_t DIGITAL_MESSAGE = 0x90
static constexpr uint8_t DIGITAL_MESSAGE = 0x90
enum arduino:: { ... }  DMABufferFlags
static constexpr uint8_t END_SYSEX = 0xF7
EspClass ESP
EthernetImpl Ethernet
static HardwareSetupFIRMATA FIRMATA
 Global instance for Firmata hardware setup.
static constexpr uint8_t FIRMATA_MODE_INPUT = 0x00
static constexpr uint8_t FIRMATA_MODE_OUTPUT = 0x01
static constexpr uint8_t FIRMATA_MODE_PULLUP = 0x0B
static HardwareSetupFTDI FTDI
 Global instance for FTDI FT2232HL hardware setup.
GPIOWrapper GPIO
 Global GPIO instance used by Arduino API functions and direct access.
static gpiod_chip * gpio_chip = nullptr
static std::map< pin_size_t, gpiod_line * > gpio_lines
static std::map< pin_size_t, gpiod_line_request * > gpio_requests
static constexpr uint8_t I2C_CONFIG = 0x78
static constexpr uint8_t I2C_END_TX_MASK = 0x40
static constexpr uint8_t I2C_READ = 0x08
static constexpr uint8_t I2C_REPLY = 0x77
static constexpr uint8_t I2C_REQUEST = 0x76
static constexpr uint8_t I2C_WRITE = 0x00
const IPAddress IN6ADDR_ANY
const IPAddress INADDR_NONE
constexpr SocketHandle INVALID_SOCKET_HANDLE = -1
static ArduinoLogger Logger
static constexpr pin_size_t MAX_FIRMATA_PIN = 15
static HardwareSetupRemote Remote {7000}
static constexpr uint8_t REPORT_ANALOG = 0xC0
static constexpr uint8_t REPORT_DIGITAL = 0xD0
static HardwareSetupRPI RPI
 Global instance for Raspberry Pi hardware setup.
StdioDevice Serial
StdioDevice Serial2
static constexpr uint8_t SET_PIN_MODE = 0xF4
const char * SOCKET_IMPL = "SocketImpl"
SPIWrapper SPI
 Global SPI instance used by Arduino API and direct access.
static constexpr uint8_t SPI_BEGIN = 0x00
static constexpr uint8_t SPI_DATA = 0x68
static constexpr uint8_t SPI_DEVICE_CONFIG = 0x01
static constexpr uint8_t SPI_END = 0x06
static constexpr uint8_t SPI_REPLY = 0x05
static constexpr uint8_t SPI_TRANSFER = 0x02
static constexpr uint8_t START_SYSEX = 0xF0
 USBSetup
WifiMock WiFi
I2CWrapper Wire
 Global Wire instance used by Arduino API functions and direct access.
static WOLFSSL_CTX * wolf_ctx = nullptr
static int wolf_ssl_counter = 0

Detailed Description

We provide the WiFi class to simulate the Arduino WIFI. In in Linux we can expect that networking is already active. So we dont need to do anything.

We support different implementations for the GPIO

We suppport different implementations for the SPI

Typedef Documentation

◆ WiFiClientSecure

Alias for EthernetClient to provide WiFiClientSecure compatibility when HTTPS is not used.

Alias for secure WiFi client using TLS/SSL.

Use this type for secure network connections (HTTPS, TLS) on platforms supporting NetworkClientSecure.

Function Documentation

◆ Serial1()

FileStream arduino::Serial1 ( nullptr ,
nullptr  )
static

Global Serial1 instance for secondary serial communication.

This object provides access to the /dev/ttyACM0 device, typically used for USB serial or secondary UART on Linux systems. Use this instance in your sketches to perform serial communication, similar to the standard Arduino Serial1 object. Example: Serial1.begin(9600); Serial1.println("Hello from Serial1");

◆ Serial2()

FileStream arduino::Serial2 ( "/dev/serial0" )
static

Second hardware serial port for Raspberry Pi.

Serial2 provides access to the Raspberry Pi's primary UART device (usually /dev/serial0). This can be used for serial communication with external devices, similar to Serial1/Serial2 on Arduino boards. Example usage: Serial2.begin(9600); Serial2.println("Hello from Serial2");

Variable Documentation

◆ FIRMATA

HardwareSetupFIRMATA arduino::FIRMATA
static

Global instance for Firmata hardware setup.

Use this object to access and initialize GPIO, I2C, and SPI interfaces on a remote Firmata device, e.g.: FIRMATA.begin(mySerialStream); pinMode(13, OUTPUT); // routed to GPIO over Firmata Wire.beginTransmission(0x76); ...

◆ FTDI

HardwareSetupFTDI arduino::FTDI
static

Global instance for FTDI FT2232HL hardware setup.

Use this object to access and initialize GPIO, I2C, and SPI interfaces on FTDI FT2232HL devices.

◆ RPI

HardwareSetupRPI arduino::RPI
static

Global instance for Raspberry Pi hardware setup.

Use this object to access and initialize GPIO, I2C, and SPI interfaces on Raspberry Pi.