35 #define DEFAULT_VALUE 0 36 #define PI_PWM_RESOLUTION 1024 54 LOG(VB_GENERAL, LOG_WARNING, QStringLiteral(
"Ignoring user defined resolution for hardware PWM - defaulting to %1").arg(
m_maxResolution));
61 pinMode(m_pin, PWM_OUTPUT);
62 pwmWrite(m_pin, value);
66 if (softPwmCreate(m_pin, value, m_resolution) == 0)
68 LOG(VB_GENERAL, LOG_WARNING, QStringLiteral(
"Using software PWM on pin %1: It MIGHT flicker...").arg(m_pin));
72 LOG(VB_GENERAL, LOG_ERR, QStringLiteral(
"Failed to setup software PWM on pin %1").arg(m_pin));
91 return QStringList() << tr(
"Pin %1 PWM").arg(m_pin) << tr(
"Resolution %1").arg(
m_resolution);
96 QMutexLocker locker(&
lock);
98 double newdouble = Value;
102 int newvalue = lround(newdouble * (
double)
m_resolution);
105 pwmWrite(m_pin, newvalue);
107 softPwmWrite(m_pin, newvalue);
bool ValueIsDifferent(double &NewValue)
QStringList GetDescription(void)
#define PI_PWM_RESOLUTION
virtual void SetValue(double Value)
TorcPiPWMOutput(int Pin, const QVariantMap &Details)
#define LOG(_MASK_, _LEVEL_, _STRING_)
void SetValue(double Value)