Final Project files for mBed development.

Dependencies:   m3pi mbed

Files at this revision

API Documentation at this revision

Comitter:
lsaristo
Date:
Thu Nov 13 07:12:31 2014 +0000
Parent:
7:6e5cc24e1ce7
Child:
9:3a0433c391cb
Commit message:
Removed unneeded c source file

Changed in this revision

control.c Show diff for this revision Revisions of this file
main.c Show annotated file Show diff for this revision Revisions of this file
main.h Show annotated file Show diff for this revision Revisions of this file
project.h Show diff for this revision Revisions of this file
--- a/control.c	Thu Nov 13 05:02:37 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/**
- * @file    control.c
- * @brief   Motor control functions implemented from project.h
- * @author  John Wilkey
- */
-
-#include "project.h"
-extern m3pi pi;
-
-int forward(float amt, float spd)
-{
-    if(amt > 1) { spd = 1; }
-    pi.forward(spd);
-    wait(amt);
-    return EXIT_SUCCESS;
-}
-
-int backward(float amt, float spd)
-{
-    if(amt > 1) { spd = 1; }
-    pi.backward(spd);
-    wait(amt);
-    return EXIT_SUCCESS;
-}
-
-int right(float deg)
-{
-    pi.right(TURN_SPEED);
-    wait(deg/360);
-    return EXIT_SUCCESS;
-}
-
-int left(float deg)
-{
-    pi.left(TURN_SPEED);
-    wait(deg/360);
-    return EXIT_SUCCESS;
-}
-
-void pretty_print(char* msg)
-{
-    pi.locate(0,1);
-    pi.printf(msg);
-}
--- a/main.c	Thu Nov 13 05:02:37 2014 +0000
+++ b/main.c	Thu Nov 13 07:12:31 2014 +0000
@@ -20,7 +20,6 @@
 DigitalOut  pin19(p19);
 DigitalOut  pin20(p20);
 
-
 /**
  * @brief Entry point. Main loop.
  */
@@ -39,3 +38,40 @@
     // Our code should NEVER reach this point. 
     return EXIT_FAILURE;
 }
+
+int forward(float amt, float spd)
+{
+    if(amt > 1) { spd = 1; }
+    pi.forward(spd);
+    wait(amt);
+    return EXIT_SUCCESS;
+}
+
+int backward(float amt, float spd)
+{
+    if(amt > 1) { spd = 1; }
+    pi.backward(spd);
+    wait(amt);
+    return EXIT_SUCCESS;
+}
+
+int right(float deg)
+{
+    pi.right(TURN_SPEED);
+    wait(deg/360);
+    return EXIT_SUCCESS;
+}
+
+int left(float deg)
+{
+    pi.left(TURN_SPEED);
+    wait(deg/360);
+    return EXIT_SUCCESS;
+}
+
+void pretty_print(char* msg)
+{
+    pi.locate(0,1);
+    pi.printf(msg);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.h	Thu Nov 13 07:12:31 2014 +0000
@@ -0,0 +1,71 @@
+/**
+ * @file    project.h
+ * @brief   Main header file for includes and whatnot 
+ *          for the other project files.
+ * @author  John Wilkey
+ */
+ 
+#ifndef _PROJECT_H
+#define _PROJECT_H
+
+#include <stdio.h>
+#include "mbed.h"
+#include "m3pi.h"
+#define TURN_SPEED 0.25
+#define DRIVE_SPEED 0.5
+#define ERR_SUCCESS 0
+#define ERR_FAILURE 1
+
+
+/**
+ * @brief Driver forward.
+ *
+ * @param[in]   amt     Amount to drive forward.
+ * @param[in]   spd     Drive speed.
+ * @return              Success or failure. 
+ */
+int forward(float amt, float spd);
+
+/**
+ * @brief Drive backward.
+ *
+ * @param[in]   amt     Amount to drive backward.
+ * @param[in]   spd     Drive speed.
+ * @return              Success or failure. 
+ */
+int backward(float amt, float spd);
+
+/**
+ * @brief Turn right.
+ *
+ * @param[in]   deg     Desired final turn angle from starting position.
+ * @param[in]   spd     Desired turning speed.
+ * @return              Success or failure. 
+ */
+int right(float deg);
+
+/**
+ * @brief Turn left.
+ *
+ * @param[in]   deg     Desired final turn angle from starting position.
+ * @param[in]   spd     Desired turning speed.
+ * @return              Success or failure. 
+ */
+int left (float deg);
+
+/**
+ * @brief Controller decision logic.
+ *
+ * Decide what to do next based on the status of the drawing so far.
+ *
+ */
+void next_action();
+
+/**
+ * @brief Print a formatted message to the LCD
+ */
+void pretty_print(char* msg);
+
+
+
+#endif
--- a/project.h	Thu Nov 13 05:02:37 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/**
- * @file    project.h
- * @brief   Main header file for includes and whatnot 
- *          for the other project files.
- * @author  John Wilkey
- */
- 
-#ifndef _PROJECT_H
-#define _PROJECT_H
-
-#include <stdio.h>
-#include "mbed.h"
-#include "m3pi.h"
-#define TURN_SPEED 0.25
-#define DRIVE_SPEED 0.5
-#define ERR_SUCCESS 0
-#define ERR_FAILURE 1
-
-/**
- * @brief   Provides access to the digital outputs on the mbed controller.
- *
- * Note that by default these output pins are hardwired to the 6 LEDs that 
- * stripe the development extension board. 
- */
- 
-
-
-/**
- * @brief Driver forward.
- *
- * @param[in]   amt     Amount to drive forward.
- * @param[in]   spd     Drive speed.
- * @return              Success or failure. 
- */
-int forward(float amt, float spd);
-
-/**
- * @brief Drive backward.
- *
- * @param[in]   amt     Amount to drive backward.
- * @param[in]   spd     Drive speed.
- * @return              Success or failure. 
- */
-int backward(float amt, float spd);
-
-/**
- * @brief Turn right.
- *
- * @param[in]   deg     Desired final turn angle from starting position.
- * @param[in]   spd     Desired turning speed.
- * @return              Success or failure. 
- */
-int right(float deg);
-
-/**
- * @brief Turn left.
- *
- * @param[in]   deg     Desired final turn angle from starting position.
- * @param[in]   spd     Desired turning speed.
- * @return              Success or failure. 
- */
-int left (float deg);
-
-/**
- * @brief Controller decision logic.
- *
- * Decide what to do next based on the status of the drawing so far.
- *
- */
-void next_action();
-
-/**
- * @brief Print a formatted message to the LCD
- */
-void pretty_print(char* msg);
-
-
-
-#endif