MBED Application board used to control frequency and duty cycle of injector valves

Dependencies:   mbed-rtos mbed

Revision:
0:9b2c760c8e5c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coil-driver.h	Tue Jul 25 14:29:20 2017 +0000
@@ -0,0 +1,22 @@
+#ifndef COIL_DRIVER_H
+#define COIL_DRIVER_H
+
+#include "mbed.h"
+#include "rtos.h"
+
+// Coil driver class. Applies full power for given "spike" time
+// and then applies a PWM signal to keep the coil energized at a lower power.
+class Coil
+{
+public:
+    Coil(PinName _controlPin, uint16_t _spikeus, uint16_t _holdperiod_us, uint16_t _holdpulse_us);
+
+    //InterruptIn controlIn; // Input for external coil "ON" signal
+    PwmOut controlOut; // PWM output pin driving coil
+    uint16_t spikeus, holdperiod_us, holdpulse_us, pwmFrequency;
+
+    void on();
+    void off();
+};
+
+#endif
\ No newline at end of file