rusefi-1/firmware/controllers/actuators/gppwm/gppwm_channel.h

30 lines
626 B
C
Raw Normal View History

#pragma once
#include "gppwm.h"
class OutputPin;
class SimplePwm;
class ValueProvider3D;
class GppwmChannel {
public:
DECLARE_ENGINE_PTR;
void init(bool usePwm, SimplePwm* pwm, OutputPin* outputPin, const ValueProvider3D* table, const gppwm_channel* config);
void update();
private:
float getOutput() const;
void setOutput(float result);
// Store the current state so we can apply hysteresis
bool m_state = false;
// Configuration fields
const gppwm_channel* m_config = nullptr;
bool m_usePwm = false;
SimplePwm* m_pwm = nullptr;
OutputPin* m_output = nullptr;
const ValueProvider3D* m_table = nullptr;
};