Libary for Strpper motor controller, eg: Rep-Rap smart stick Catering for both, Phisical 'PIN' endstops, and PORT Expander end stops . ** BOTH IN TEST ** ** Phisical PIN tested (minimal) **** PORT PIN NOT TESTED ****
Stepper.h@3:57d3774612fc, 2013-08-08 (annotated)
- Committer:
- ceri
- Date:
- Thu Aug 08 09:36:39 2013 +0000
- Revision:
- 3:57d3774612fc
- Parent:
- 1:66e95666c3b5
before publish
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ceri | 0:a509cc91f7c2 | 1 | |
ceri | 0:a509cc91f7c2 | 2 | |
ceri | 0:a509cc91f7c2 | 3 | #ifndef _stepper_h_ |
ceri | 0:a509cc91f7c2 | 4 | #define _stepper_h_ |
ceri | 0:a509cc91f7c2 | 5 | |
ceri | 0:a509cc91f7c2 | 6 | #include "mbed.h" |
ceri | 0:a509cc91f7c2 | 7 | |
ceri | 0:a509cc91f7c2 | 8 | class Stepper { |
ceri | 0:a509cc91f7c2 | 9 | |
ceri | 0:a509cc91f7c2 | 10 | public: |
ceri | 0:a509cc91f7c2 | 11 | |
ceri | 0:a509cc91f7c2 | 12 | Stepper(PinName Step, PinName Dir, PinName En, PinName Endstop_Left, PinName Endstop_Right, bool Invert_Dir, bool Invert_ESL, bool Invert_ESR); |
ceri | 0:a509cc91f7c2 | 13 | |
ceri | 0:a509cc91f7c2 | 14 | bool Pulse(); |
ceri | 0:a509cc91f7c2 | 15 | bool Set_Dir (bool Dir2Set); |
ceri | 0:a509cc91f7c2 | 16 | bool ESL_Activeated(); |
ceri | 0:a509cc91f7c2 | 17 | bool ESR_Activeated(); |
ceri | 0:a509cc91f7c2 | 18 | bool ESL_Fitted(); |
ceri | 0:a509cc91f7c2 | 19 | bool ESR_Fitted(); |
ceri | 1:66e95666c3b5 | 20 | |
ceri | 3:57d3774612fc | 21 | void Enable (bool OnOff); |
ceri | 3:57d3774612fc | 22 | |
ceri | 3:57d3774612fc | 23 | bool ESL_Port(int PORT_In); // bit MASK testing of non zero port bits |
ceri | 3:57d3774612fc | 24 | |
ceri | 3:57d3774612fc | 25 | void ESL_Set_MASK (int Port_MASK_L_in); |
ceri | 3:57d3774612fc | 26 | void ESL_Set_INV_MASK (int Port_INV_MASK_L_in); |
ceri | 3:57d3774612fc | 27 | |
ceri | 3:57d3774612fc | 28 | |
ceri | 0:a509cc91f7c2 | 29 | |
ceri | 0:a509cc91f7c2 | 30 | protected: |
ceri | 0:a509cc91f7c2 | 31 | DigitalOut _Step; |
ceri | 0:a509cc91f7c2 | 32 | DigitalOut _Dir; |
ceri | 0:a509cc91f7c2 | 33 | DigitalOut _En; |
ceri | 0:a509cc91f7c2 | 34 | |
ceri | 0:a509cc91f7c2 | 35 | DigitalIn _Endstop_Left; |
ceri | 0:a509cc91f7c2 | 36 | DigitalIn _Endstop_Right; |
ceri | 0:a509cc91f7c2 | 37 | |
ceri | 0:a509cc91f7c2 | 38 | |
ceri | 0:a509cc91f7c2 | 39 | bool _Invert_Dir; |
ceri | 0:a509cc91f7c2 | 40 | bool _Invert_ESL; |
ceri | 0:a509cc91f7c2 | 41 | bool _Invert_ESR; |
ceri | 0:a509cc91f7c2 | 42 | bool _g4; |
ceri | 0:a509cc91f7c2 | 43 | |
ceri | 0:a509cc91f7c2 | 44 | bool ESL; |
ceri | 3:57d3774612fc | 45 | int Port_MASK_L; |
ceri | 3:57d3774612fc | 46 | |
ceri | 0:a509cc91f7c2 | 47 | |
ceri | 0:a509cc91f7c2 | 48 | private: |
ceri | 0:a509cc91f7c2 | 49 | |
ceri | 0:a509cc91f7c2 | 50 | int ESR; |
ceri | 0:a509cc91f7c2 | 51 | int Set; |
ceri | 0:a509cc91f7c2 | 52 | |
ceri | 3:57d3774612fc | 53 | |
ceri | 3:57d3774612fc | 54 | int Port_INV_MASK_L; |
ceri | 3:57d3774612fc | 55 | |
ceri | 0:a509cc91f7c2 | 56 | }; |
ceri | 0:a509cc91f7c2 | 57 | |
ceri | 0:a509cc91f7c2 | 58 | #endif // _stepper_h_ |