Lab 6 code.

Dependencies:   mbed

Fork of WaG by GroupA

Revision:
18:0e281922212c
Child:
20:d23bcd97f2c5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stepper.cpp	Fri Mar 02 22:18:47 2018 +0000
@@ -0,0 +1,64 @@
+/******************************************************************************
+* EECS 397
+*
+* Assignment Name: Lab 5: WaG
+* 
+* Authors: Sam Morrison and Phong Nguyen 
+* File name: stepper.cpp
+* Purpose: Driver for stepper motor
+*
+* Created: 03/02/2018
+* Last Modified: 03/02/2018
+*
+******************************************************************************/
+
+#include "mbed.h"
+#include "io_pins.h"
+#include "spi.h"
+#include "stepper.h"
+
+DigitalOut stp_ncs(STP_DRV8806_NCS);
+
+extern spi_cfg drv8806 {
+    SPI_DRV8806_ID,
+    STP_DRV8806_NCS,
+    0,
+    1000000,
+    8,
+};
+int stp_cur_pos;
+int stp_sensor_pos[NUM_SENSORS + 1] 
+
+/*
+ * void stp_init();
+ * Description: initializes stepper values to unkown
+ *
+ * Inputs: 
+ *      Parameters: void
+ *      Globals:
+ *      
+ * Outputs:
+ *      Returns: void
+*/
+void stp_init() {
+    stp_cur_pos = STP_POS_UNKN
+    for (int i = 1; i <= NUM_SENSORS; i++) {
+        stp_sensor_pos[i] = STP_POS_UNKN;
+    }
+}
+
+/*
+ * void stp_step(int direction);
+ * Description: turns the stepper motor clockwise or counter-clockwise
+ *
+ * Inputs: 
+ *      Parameters:
+ *          int direction
+ *      Globals:
+ *      
+ * Outputs:
+ *      Returns: void
+*/
+void stp_step(int direction) {
+    
+}
\ No newline at end of file