arduino-emulator
Loading...
Searching...
No Matches
HardwareGPIO.h
1/*
2 HardwareGPIO.h
3 Copyright (c) 2025 Phil Schatzmann. All right reserved.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
20#pragma once
21#include "api/Common.h"
22
23namespace arduino {
24
52 public:
53 HardwareGPIO() = default;
54 virtual ~HardwareGPIO() = default;
55
61 virtual void pinMode(pin_size_t pinNumber, PinMode pinMode) = 0;
62
68 virtual void digitalWrite(pin_size_t pinNumber, PinStatus status) = 0;
69
75 virtual PinStatus digitalRead(pin_size_t pinNumber) = 0;
76
82 virtual int analogRead(pin_size_t pinNumber) = 0;
83
88 virtual void analogReference(uint8_t mode) = 0;
89
95 virtual void analogWrite(pin_size_t pinNumber, int value) = 0;
96
103 virtual void tone(uint8_t _pin, unsigned int frequency,
104 unsigned long duration = 0) = 0;
105
110 virtual void noTone(uint8_t _pin) = 0;
111
119 virtual unsigned long pulseIn(uint8_t pin, uint8_t state,
120 unsigned long timeout = 1000000L) = 0;
121
129 virtual unsigned long pulseInLong(uint8_t pin, uint8_t state,
130 unsigned long timeout = 1000000L) = 0;
131
138 virtual void analogWriteFrequency(pin_size_t pin, uint32_t freq) = 0;
139
146};
147
148} // namespace arduino
Definition DMAPool.h:103
Abstract base class for GPIO (General Purpose Input/Output) functions.
Definition HardwareGPIO.h:51
virtual void analogWriteFrequency(pin_size_t pin, uint32_t freq)=0
Set the PWM frequency for analogWrite() on the specified pin.
virtual void analogReference(uint8_t mode)=0
Configure the reference voltage used for analog input.
virtual PinStatus digitalRead(pin_size_t pinNumber)=0
Read the value from a specified digital pin.
virtual void analogWriteResolution(uint8_t bits)=0
Set the resolution of the analogWrite() values.
virtual void noTone(uint8_t _pin)=0
Stop the generation of a square wave triggered by tone()
virtual void analogWrite(pin_size_t pinNumber, int value)=0
Write an analog value (PWM wave) to a pin.
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 void pinMode(pin_size_t pinNumber, PinMode pinMode)=0
Configure the specified pin to behave as an input or output.
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.
virtual int analogRead(pin_size_t pinNumber)=0
Read the value from the specified analog 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 digitalWrite(pin_size_t pinNumber, PinStatus status)=0
Write a HIGH or LOW value to a digital pin.
We provide the WiFi class to simulate the Arduino WIFI. In in Linux we can expect that networking is ...
Definition CanMsg.cpp:31