PIDUINO
Loading...
Searching...
No Matches
gpiopwm.h
1/* Copyright © 2018-2025 Pascal JEAN, All rights reserved.
2 This file is part of the Piduino Library.
3
4 The Piduino Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 The Piduino Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with the Piduino Library; if not, see <http://www.gnu.org/licenses/>.
16*/
17#pragma once
18
19#include <piduino/converter.h>
20#include <piduino/gpiopin.h>
21
22namespace Piduino {
23
33 class GpioPwm : public Converter {
34
35 public:
42 GpioPwm (Pin *pin, long range = 1024, long freq = 100);
43
47 virtual ~GpioPwm();
48
54 GpioPwm (const std::string &parameters);
55
61 static std::string registeredName() {
62 return "gpiopwm";
63 }
64
69 const Pin &pin() const;
70
71 protected:
76 class Private;
78
79 private:
84 };
85}
86
87/* ========================================================================== */
The Converter class provides an interface for analog-to-digital and digital-to-analog converters.
Definition converter.h:34
virtual long range() const
Gets the digital range of the converter.
Provides PWM (Pulse Width Modulation) control for a GPIO pin.
Definition gpiopwm.h:33
const Pin & pin() const
Returns a constant reference to the associated Pin object.
GpioPwm(Pin *pin, long range=1024, long freq=100)
Constructs a GpioPwm object for the specified pin, with optional range and frequency.
GpioPwm(Private &dd)
virtual ~GpioPwm()
Destructor for the GpioPwm class.
static std::string registeredName()
Returns the name registered for this converter.
Definition gpiopwm.h:61
GpioPwm(const std::string &parameters)
Constructs a GpioPwm object from a string of parameters.
Represents a general-purpose input/output (GPIO) pin and its configuration.
Definition gpiopin.h:68
Internal implementation class for GpioDevice.
#define PIMP_DECLARE_PRIVATE(Class)
PIMP_DECLARE_PRIVATE.
Definition global.h:82
Global namespace for Piduino.
Definition board.h:28