SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
pwm_output.h
Go to the documentation of this file.
1#ifndef SENSESP_SYSTEM_PWM_OUTPUT_H
2#define SENSESP_SYSTEM_PWM_OUTPUT_H
3
4#include <map>
5
6#include "valueconsumer.h"
7
8namespace sensesp {
9
32class PWMOutput : public ValueConsumer<float> {
33 public:
44 PWMOutput(int pin = -1, int pwm_channel = -1, int channel_frequency = 5000,
45 int channel_resolution = 13);
46
52 virtual void set(const float& new_value) override;
53
54 protected:
58
59 static std::map<uint8_t, int8_t> channel_to_pin_;
60 uint8_t pwm_channel_{};
61
71 int assign_channel(int pin, int pwm_channel = -1);
72
78 void set_pwm(float value);
79};
80
81} // namespace sensesp
82
83#endif
Provides a cross platform mechanism for generating Pulse Width Modulation signals over one or more GP...
Definition pwm_output.h:32
void set_pwm(float value)
PWMOutput(int pin=-1, int pwm_channel=-1, int channel_frequency=5000, int channel_resolution=13)
static std::map< uint8_t, int8_t > channel_to_pin_
Definition pwm_output.h:59
int assign_channel(int pin, int pwm_channel=-1)
virtual void set(const float &new_value) override
A base class for piece of code (like a transform) that accepts data for input. ValueConsumers can acc...