Nathaniel Honka / Mbed 2 deprecated Motion-Control

Dependencies:   FiniteStateMachine HipControl Knee LinearBlend1 LocalFileSystem_Read dataComm hapticFeedback initExoVars mbed Blend_Generator Brad_poly_gait Gait_Generator MM_gait Encoders IMUdriver

Fork of Motion Control by HEL's Angels

Knee/knee.h

Committer:
cashdollar
Date:
2015-02-25
Revision:
5:498c9bfc56f0
Parent:
1:6f18fad9984e

File content as of revision 5:498c9bfc56f0:

/** Knee class.
* Used to control knee mechanism in conjunction with StepperDriver.h.
* L6482 Stepper Driver code communicated via SPI.
* 02/25/2015 Edited by Hayley Cashdollar
*/

#ifndef KNEE_H
#define KNEE_H

#include "mbed.h"
#include "StepperDriver.h"

class Knee
{
public:
    // Constructor
    Knee(PinName CSPin, PinName mosi, PinName miso, PinName sck);

    void lock();
    void unlock();
    void init();
    
    /** Create status instance
    * status() gathers the current status from the knee stepper.
    * @returns
    *    2 byte status from Stepper. See page 58 of L6482 Stepper Spec for detail.
    *
    */
    int status();

    /** Create knee_status instance.
    * knee_status() compares stepper status to safe status.
    * @ returns
    *    0 for safe
    *    1 for unsafe
    */
    int knee_status();

    /** Create knee_error instance.
    * knee_error is the output of knee_status.
    * knee_error = 0 is safe
    * knee_error = 1 is unsafe.
    */
    int knee_error;

    /** Create knee_flag instance.
    * knee_flag is an intermediate integer in computation of knee_status
    */
    int knee_flag;
    
    void debug();

private:
    StepperDriver stepper;

};

#endif