Lab 6 code.

Dependencies:   mbed

Fork of WaG by GroupA

stepper.cpp

Committer:
spm71
Date:
2018-03-02
Revision:
18:0e281922212c
Child:
20:d23bcd97f2c5

File content as of revision 18:0e281922212c:

/******************************************************************************
* 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) {
    
}