SEDO subject project

Dependencies:   ds3231 mbed-rtos mbed DHT

Revision:
10:f14f47225091
Child:
12:1d544cdab2cf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/motor_cnt.cpp	Mon May 08 17:13:57 2017 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "motor_cnt.h"
+
+static PwmOut m_speed(D5);
+static DigitalOut m_direction(D4);
+static uint8_t speed_current = 0;
+static uint8_t direction_current = 0;
+
+int set_motor_speed(uint8_t speed)
+{
+    m_speed = speed;
+    speed_current = speed;
+    return 0;
+}
+int set_motor_direction(uint8_t direction)
+{
+    if(direction != 0) {
+        m_direction=1;
+        direction_current=1;
+    } else {
+        m_direction=0;
+        direction_current=0;
+    }
+    return 0;
+}
+int get_motor_speed(void)
+{
+    return speed_current;
+}
+int get_motor_direction(void)
+{
+    return direction_current;
+}