Add stepwise controller

This adds the ability to use stepwise curves alongside
pid control. This creates a base controller class that
pidcontroller and stepwise controller inherit from.

Note: Hysteresis to come in follow-on patch

Tested-by:
Created a stepwise controller and noticed that when it
crossed a threshold that it contributed to the pwm setting.

Change-Id: I6cf842f80eaccafc905d620970afe91e2092d568
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/pid/pidcontroller.hpp b/pid/pidcontroller.hpp
new file mode 100644
index 0000000..18a448e
--- /dev/null
+++ b/pid/pidcontroller.hpp
@@ -0,0 +1,60 @@
+#pragma once
+
+#include "controller.hpp"
+#include "ec/pid.hpp"
+#include "fan.hpp"
+
+#include <memory>
+#include <vector>
+
+class ZoneInterface;
+
+/*
+ * Base class for PID controllers.  Each PID that implements this needs to
+ * provide an input_proc, setpt_proc, and output_proc.
+ */
+class PIDController : public Controller
+{
+  public:
+    PIDController(const std::string& id, ZoneInterface* owner) :
+        Controller(), _owner(owner), _setpoint(0), _id(id)
+    {
+    }
+
+    virtual ~PIDController()
+    {
+    }
+
+    virtual float input_proc(void) = 0;
+    virtual float setpt_proc(void) = 0;
+    virtual void output_proc(float value) = 0;
+
+    void process(void);
+
+    std::string get_id(void)
+    {
+        return _id;
+    }
+    float get_setpoint(void)
+    {
+        return _setpoint;
+    }
+    void set_setpoint(float setpoint)
+    {
+        _setpoint = setpoint;
+    }
+
+    ec::pid_info_t* get_pid_info(void)
+    {
+        return &_pid_info;
+    }
+
+  protected:
+    ZoneInterface* _owner;
+
+  private:
+    // parameters
+    ec::pid_info_t _pid_info;
+    float _setpoint;
+    std::string _id;
+};