Arcadie Cracan / StepperController

Fork of StepperController by Viorel Stefan Savinescu

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers steppercontroller.h Source File

steppercontroller.h

00001 #ifndef STEPPERCONTROLLER_H
00002 #define STEPPERCONTROLLER_H
00003 #include "mbed.h"
00004 
00005 class StepperController {
00006     
00007 public:
00008     enum Direction {DirectionCW = 1, DirectionCCW = -1};
00009     enum SequenceType {Consecutive, Interleaved};
00010     StepperController(PinName phaseA,PinName enA, PinName phaseB, PinName enB );
00011     void advance();
00012     void setPeriod(float period);
00013     void setPulseWidth(float width);
00014     void setDirection(Direction dir);
00015     void setSequenceType(SequenceType seq);
00016     
00017 private:
00018     int state;
00019     float pulseWidth;
00020     DigitalOut phaseA, phaseB;
00021     PwmOut enA, enB;
00022     Direction dir;
00023     SequenceType seq;
00024     void updateOutputs();
00025    
00026    
00027 };
00028     
00029 #endif