SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.

Dependencies:   TSI USBDevice mbed-dev

Fork of SmartWheels by haofan Zheng

Revision:
46:a5eb9bd3bb55
Parent:
44:15de535c4005
Child:
52:078b521c9edf
--- a/Hardwares/Motor.h	Thu Mar 30 03:50:23 2017 +0000
+++ b/Hardwares/Motor.h	Thu Mar 30 22:34:20 2017 +0000
@@ -2,45 +2,37 @@
 
 #include <mbed.h>
 
-#define MotorDir unsigned char
+#define MotorDir uint8_t
 #define MDIR_Forward  0
 #define MDIR_Backward 1
 
-namespace SW
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void motor_init();
+
+void motor_set_left_speed(const float speed);
+
+void motor_set_right_speed(const float speed);
+
+inline void motor_set_speeds(const float speed_left, const float speed_right)
 {
-    class Core;
+    motor_set_left_speed(speed_left);
+    motor_set_right_speed(speed_right);
 }
 
-class Motor{
+void motor_set_left_direction(MotorDir dir);
+
+void motor_set_right_direction(MotorDir dir);
 
-public:
-    Motor(SW::Core& core);
-    
-    ~Motor();
-    
-    void Update(float deltaTime);
-    
-    void setLeftSpeed(const float speed);
-    
-    void setRightSpeed(const float speed);
-    
-    void setSpeeds(const float speedLeft, const float speedRight);
-    
-    void setLeftDirection(MotorDir dir);
-    
-    void setRightDirection(MotorDir dir);
-    
-    void setDirections(MotorDir dirL, MotorDir dirR);
+inline void motor_set_direction(MotorDir dirL, MotorDir dirR)
+{
+    motor_set_left_direction(dirL);
+    motor_set_right_direction(dirR);
+}
 
-private:
-
-    SW::Core& m_core;
-    
-    DigitalOut m_dirL;
-    DigitalOut m_dirR;
-    
-    PwmOut m_pwmL;
-    PwmOut m_pwmR;
-    
-    Motor();
-};
\ No newline at end of file
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file