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 ****
Revision 3:57d3774612fc, committed 2013-08-08
- Comitter:
- ceri
- Date:
- Thu Aug 08 09:36:39 2013 +0000
- Parent:
- 2:4102dd9293a6
- Commit message:
- before publish
Changed in this revision
Stepper.cpp | Show annotated file Show diff for this revision Revisions of this file |
Stepper.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4102dd9293a6 -r 57d3774612fc Stepper.cpp --- a/Stepper.cpp Fri Aug 02 13:59:28 2013 +0000 +++ b/Stepper.cpp Thu Aug 08 09:36:39 2013 +0000 @@ -36,7 +36,7 @@ _Invert_ESL = Invert_ESL, _Invert_ESR = Invert_ESR; - { +{ // bool read_1(); if (Endstop_Left != NC) { @@ -56,7 +56,11 @@ { ESR = false; } - + + // Set default val;ues .. no potr Endstops + //Port_MASK_L = 0; + //Port_INV_MASK_L = 0; + } } @@ -92,7 +96,7 @@ // ------------------------------------------------------------------------------------ -bool Stepper::Enable (bool OnOff) +void Stepper::Enable (bool OnOff) { _En = !OnOff; } @@ -189,10 +193,41 @@ +bool Stepper::ESL_Port(int PORT_In) +{ + bool Ret = false; + + if (!Port_MASK_L) + { + Ret = false; + } + else + { + if (PORT_In && Port_MASK_L) + { + (Port_INV_MASK_L) ? Ret = true : Ret = false; + } + else + { + (Port_INV_MASK_L) ? Ret = false : Ret = true; + } + } + + return (Ret); +} +// ............................. - + void Stepper::ESL_Set_MASK (int Port_MASK_L_in) + { + Port_MASK_L = Port_MASK_L_in; + } + + void Stepper::ESL_Set_INV_MASK (int Port_INV_MASK_L_in) + { + Port_INV_MASK_L = Port_INV_MASK_L_in; + }
diff -r 4102dd9293a6 -r 57d3774612fc Stepper.h --- a/Stepper.h Fri Aug 02 13:59:28 2013 +0000 +++ b/Stepper.h Thu Aug 08 09:36:39 2013 +0000 @@ -18,7 +18,14 @@ bool ESL_Fitted(); bool ESR_Fitted(); - bool Enable (bool OnOff); + void Enable (bool OnOff); + + bool ESL_Port(int PORT_In); // bit MASK testing of non zero port bits + + void ESL_Set_MASK (int Port_MASK_L_in); + void ESL_Set_INV_MASK (int Port_INV_MASK_L_in); + + protected: DigitalOut _Step; @@ -35,12 +42,17 @@ bool _g4; bool ESL; + int Port_MASK_L; + private: int ESR; int Set; + + int Port_INV_MASK_L; + }; #endif // _stepper_h_ \ No newline at end of file