21#ifdef SUPPORT_OutputType_Servo_PCA9685
24#include <Adafruit_PWMServoDriver.h>
29#define SERVO_PCA9685_OUTPUT_MIN_PULSE_WIDTH 650
30#define SERVO_PCA9685_OUTPUT_MAX_PULSE_WIDTH 2350
32 struct ServoPCA9685Channel_t
36 uint16_t MinLevel = SERVO_PCA9685_OUTPUT_MIN_PULSE_WIDTH;
37 uint16_t MaxLevel = SERVO_PCA9685_OUTPUT_MAX_PULSE_WIDTH;
38 uint16_t PreviousValue = 0;
39 bool IsReversed =
false;
42 uint16_t HomeValue = 0;
43 uint8_t BufferOffset = 0;
45 Adafruit_PWMServoDriver pwm;
51 gpio_num_t outputGpio,
54 virtual ~c_OutputServoPCA9685 ();
58 bool SetConfig (ArduinoJson::JsonObject & jsonConfig);
59 void GetConfig (ArduinoJson::JsonObject & jsonConfig);
61#if defined(ARDUINO_ARCH_ESP32)
62 bool RmtPoll () {
return false;}
70# define OM_SERVO_PCA9685_CHANNEL_LIMIT 16
71# define OM_SERVO_PCA9685_UPDATE_INTERVAL_NAME CN_updateinterval
72# define OM_SERVO_PCA9685_CHANNELS_NAME CN_channels
73# define OM_SERVO_PCA9685_CHANNEL_ENABLED_NAME CN_en
74# define OM_SERVO_PCA9685_CHANNEL_MINLEVEL_NAME CN_Min
75# define OM_SERVO_PCA9685_CHANNEL_MAXLEVEL_NAME CN_Max
76# define OM_SERVO_PCA9685_CHANNEL_GPIO_NAME CN_gid
77# define OM_SERVO_PCA9685_CHANNEL_ID_NAME CN_id
78# define OM_SERVO_PCA9685_CHANNEL_REVERSED CN_rev
79# define OM_SERVO_PCA9685_CHANNEL_16BITS CN_b16
80# define OM_SERVO_PCA9685_CHANNEL_SCALED CN_sca
81# define OM_SERVO_PCA9685_CHANNEL_HOME CN_hv
82# define SERVO_PCA9685_UPDATE_FREQUENCY 50
85 void CalculateNumChannels();
88 ServoPCA9685Channel_t OutputList[OM_SERVO_PCA9685_CHANNEL_LIMIT];
89 float UpdateFrequency = SERVO_PCA9685_UPDATE_FREQUENCY;
Definition OutputCommon.hpp:31
virtual void GetDriverName(String &sDriverName)=0
get the name for the instantiated driver
virtual void Begin()
set up the operating environment based on the current config (or defaults)
Definition OutputCommon.hpp:43
virtual uint32_t GetNumOutputBufferChannelsServiced()=0
uint32_t OutputBufferSize
Definition OutputCommon.hpp:81
virtual void BaseGetStatus(ArduinoJson::JsonObject &jsonStatus)
Definition OutputCommon.cpp:58
virtual void GetStatus(ArduinoJson::JsonObject &jsonStatus)=0
virtual uint32_t Poll()=0
Call from loop(), renders output data.
virtual uint32_t GetNumOutputBufferBytesNeeded()=0
virtual bool SetConfig(ArduinoJson::JsonObject &jsonConfig)
Set a new config in the driver.
Definition OutputCommon.cpp:84
virtual void GetConfig(ArduinoJson::JsonObject &jsonConfig)
Get the current config used by the driver.
Definition OutputCommon.cpp:101
e_OutputChannelIds
Definition OutputMgr.hpp:69
e_OutputType
Definition OutputMgr.hpp:128