arduino-emulator
|
Abstract base class for GPIO (General Purpose Input/Output) functions. More...
#include <HardwareGPIO.h>
Public Member Functions | |
virtual int | analogRead (pin_size_t pinNumber)=0 |
Read the value from the specified analog pin. | |
virtual void | analogReference (uint8_t mode)=0 |
Configure the reference voltage used for analog input. | |
virtual void | analogWrite (pin_size_t pinNumber, int value)=0 |
Write an analog value (PWM wave) to a pin. | |
virtual PinStatus | digitalRead (pin_size_t pinNumber)=0 |
Read the value from a specified digital pin. | |
virtual void | digitalWrite (pin_size_t pinNumber, PinStatus status)=0 |
Write a HIGH or LOW value to a digital pin. | |
virtual void | noTone (uint8_t _pin)=0 |
Stop the generation of a square wave triggered by tone() | |
virtual void | pinMode (pin_size_t pinNumber, PinMode pinMode)=0 |
Configure the specified pin to behave as an input or output. | |
virtual unsigned long | pulseIn (uint8_t pin, uint8_t state, unsigned long timeout=1000000L)=0 |
Read a pulse (HIGH or LOW) on a pin. | |
virtual unsigned long | pulseInLong (uint8_t pin, uint8_t state, unsigned long timeout=1000000L)=0 |
Alternative to pulseIn() which is better at handling long pulses. | |
virtual void | tone (uint8_t _pin, unsigned int frequency, unsigned long duration=0)=0 |
Generate a square wave of the specified frequency on a pin. | |
Abstract base class for GPIO (General Purpose Input/Output) functions.
HardwareGPIO defines the interface for hardware abstraction of GPIO operations across different platforms and microcontrollers. This class provides a unified API for digital and analog I/O operations that can be implemented by platform-specific classes.
The class supports:
Platform-specific implementations should inherit from this class and provide concrete implementations for all pure virtual methods. Examples include HardwareGPIO_RPI for Raspberry Pi, or similar classes for other platforms.
Read the value from the specified analog pin.
pinNumber | The analog pin to read from (A0, A1, etc.) |
Implemented in arduino::GPIOWrapper, arduino::RemoteGPIO, and arduino::HardwareGPIO_RPI.
Configure the reference voltage used for analog input.
mode | The reference type (DEFAULT, INTERNAL, EXTERNAL, etc.) |
Implemented in arduino::GPIOWrapper, arduino::RemoteGPIO, and arduino::HardwareGPIO_RPI.
Write an analog value (PWM wave) to a pin.
pinNumber | The pin to write to |
value | The duty cycle (0-255 for 8-bit PWM) |
Implemented in arduino::GPIOWrapper, arduino::RemoteGPIO, and arduino::HardwareGPIO_RPI.
|
pure virtual |
Read the value from a specified digital pin.
pinNumber | The pin number to read from |
Implemented in arduino::GPIOWrapper, arduino::RemoteGPIO, and arduino::HardwareGPIO_RPI.
|
pure virtual |
Write a HIGH or LOW value to a digital pin.
pinNumber | The pin number to write to |
status | The value to write (HIGH or LOW) |
Implemented in arduino::GPIOWrapper, arduino::RemoteGPIO, and arduino::HardwareGPIO_RPI.
Stop the generation of a square wave triggered by tone()
_pin | The pin on which to stop generating the tone |
Implemented in arduino::GPIOWrapper, arduino::HardwareGPIO_RPI, and arduino::RemoteGPIO.
Configure the specified pin to behave as an input or output.
pinNumber | The pin number to configure |
pinMode | The mode to set (INPUT, OUTPUT, INPUT_PULLUP, etc.) |
Implemented in arduino::GPIOWrapper, arduino::RemoteGPIO, and arduino::HardwareGPIO_RPI.
|
pure virtual |
Read a pulse (HIGH or LOW) on a pin.
pin | The pin on which you want to read the pulse |
state | Type of pulse to read (HIGH or LOW) |
timeout | Timeout in microseconds (default 1 second) |
Implemented in arduino::GPIOWrapper, arduino::HardwareGPIO_RPI, and arduino::RemoteGPIO.
|
pure virtual |
Alternative to pulseIn() which is better at handling long pulses.
pin | The pin on which you want to read the pulse |
state | Type of pulse to read (HIGH or LOW) |
timeout | Timeout in microseconds (default 1 second) |
Implemented in arduino::GPIOWrapper, arduino::HardwareGPIO_RPI, and arduino::RemoteGPIO.
|
pure virtual |
Generate a square wave of the specified frequency on a pin.
_pin | The pin on which to generate the tone |
frequency | The frequency of the tone in hertz |
duration | The duration of the tone in milliseconds (0 = continuous) |
Implemented in arduino::GPIOWrapper, arduino::HardwareGPIO_RPI, and arduino::RemoteGPIO.