arduino-emulator
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
arduino::RemoteGPIO Class Reference

Remote GPIO implementation that operates over a communication stream. More...

#include <RemoteGPIO.h>

Inheritance diagram for arduino::RemoteGPIO:
arduino::HardwareGPIO

Public Member Functions

 RemoteGPIO (Stream *stream)
 
int analogRead (pin_size_t pinNumber)
 Read the value from the specified analog pin.
 
void analogReference (uint8_t mode)
 Configure the reference voltage used for analog input.
 
void analogWrite (pin_size_t pinNumber, int value)
 Write an analog value (PWM wave) to a pin.
 
PinStatus digitalRead (pin_size_t pinNumber)
 Read the value from a specified digital pin.
 
void digitalWrite (pin_size_t pinNumber, PinStatus status)
 Write a HIGH or LOW value to a digital pin.
 
virtual void noTone (uint8_t pinNumber)
 Stop the generation of a square wave triggered by tone()
 
 operator boolean ()
 
void pinMode (pin_size_t pinNumber, PinMode pinMode)
 Configure the specified pin to behave as an input or output.
 
virtual unsigned long pulseIn (uint8_t pinNumber, uint8_t state, unsigned long timeout=1000000L)
 Read a pulse (HIGH or LOW) on a pin.
 
virtual unsigned long pulseInLong (uint8_t pinNumber, uint8_t state, unsigned long timeout=1000000L)
 Alternative to pulseIn() which is better at handling long pulses.
 
void setStream (Stream *stream)
 
virtual void tone (uint8_t pinNumber, unsigned int frequency, unsigned long duration=0)
 Generate a square wave of the specified frequency on a pin.
 

Protected Attributes

HardwareService service
 

Detailed Description

Remote GPIO implementation that operates over a communication stream.

RemoteGPIO provides GPIO functionality by forwarding all operations to a remote GPIO controller via a communication stream (serial, network, etc.). This enables GPIO operations to be performed on remote hardware while maintaining the standard HardwareGPIO interface.

Key features:

The class uses HardwareService for protocol handling and can work with any Stream implementation (Serial, TCP, etc.) for remote connectivity.

See also
HardwareGPIO
HardwareService
Stream

Member Function Documentation

◆ analogRead()

int arduino::RemoteGPIO::analogRead ( pin_size_t  pinNumber)
inlinevirtual

Read the value from the specified analog pin.

Parameters
pinNumberThe analog pin to read from (A0, A1, etc.)
Returns
The analog reading on the pin (0-1023 for 10-bit ADC)

Implements arduino::HardwareGPIO.

◆ analogReference()

void arduino::RemoteGPIO::analogReference ( uint8_t  mode)
inlinevirtual

Configure the reference voltage used for analog input.

Parameters
modeThe reference type (DEFAULT, INTERNAL, EXTERNAL, etc.)

Implements arduino::HardwareGPIO.

◆ analogWrite()

void arduino::RemoteGPIO::analogWrite ( pin_size_t  pinNumber,
int  value 
)
inlinevirtual

Write an analog value (PWM wave) to a pin.

Parameters
pinNumberThe pin to write to
valueThe duty cycle (0-255 for 8-bit PWM)

Implements arduino::HardwareGPIO.

◆ digitalRead()

PinStatus arduino::RemoteGPIO::digitalRead ( pin_size_t  pinNumber)
inlinevirtual

Read the value from a specified digital pin.

Parameters
pinNumberThe pin number to read from
Returns
HIGH or LOW

Implements arduino::HardwareGPIO.

◆ digitalWrite()

void arduino::RemoteGPIO::digitalWrite ( pin_size_t  pinNumber,
PinStatus  status 
)
inlinevirtual

Write a HIGH or LOW value to a digital pin.

Parameters
pinNumberThe pin number to write to
statusThe value to write (HIGH or LOW)

Implements arduino::HardwareGPIO.

◆ noTone()

virtual void arduino::RemoteGPIO::noTone ( uint8_t  _pin)
inlinevirtual

Stop the generation of a square wave triggered by tone()

Parameters
_pinThe pin on which to stop generating the tone

Implements arduino::HardwareGPIO.

◆ pinMode()

void arduino::RemoteGPIO::pinMode ( pin_size_t  pinNumber,
PinMode  pinMode 
)
inlinevirtual

Configure the specified pin to behave as an input or output.

Parameters
pinNumberThe pin number to configure
pinModeThe mode to set (INPUT, OUTPUT, INPUT_PULLUP, etc.)

Implements arduino::HardwareGPIO.

◆ pulseIn()

virtual unsigned long arduino::RemoteGPIO::pulseIn ( uint8_t  pin,
uint8_t  state,
unsigned long  timeout = 1000000L 
)
inlinevirtual

Read a pulse (HIGH or LOW) on a pin.

Parameters
pinThe pin on which you want to read the pulse
stateType of pulse to read (HIGH or LOW)
timeoutTimeout in microseconds (default 1 second)
Returns
The length of the pulse in microseconds, or 0 if timeout

Implements arduino::HardwareGPIO.

◆ pulseInLong()

virtual unsigned long arduino::RemoteGPIO::pulseInLong ( uint8_t  pin,
uint8_t  state,
unsigned long  timeout = 1000000L 
)
inlinevirtual

Alternative to pulseIn() which is better at handling long pulses.

Parameters
pinThe pin on which you want to read the pulse
stateType of pulse to read (HIGH or LOW)
timeoutTimeout in microseconds (default 1 second)
Returns
The length of the pulse in microseconds, or 0 if timeout

Implements arduino::HardwareGPIO.

◆ tone()

virtual void arduino::RemoteGPIO::tone ( uint8_t  _pin,
unsigned int  frequency,
unsigned long  duration = 0 
)
inlinevirtual

Generate a square wave of the specified frequency on a pin.

Parameters
_pinThe pin on which to generate the tone
frequencyThe frequency of the tone in hertz
durationThe duration of the tone in milliseconds (0 = continuous)

Implements arduino::HardwareGPIO.


The documentation for this class was generated from the following file: