Skip to content

Commit

Permalink
Merge pull request #2 from ponoor/develop
Browse files Browse the repository at this point in the history
Added EL_POS functions
  • Loading branch information
kanta authored Aug 31, 2021
2 parents 1b4668e + 7ca4153 commit 27c711c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Ponoor_L6470Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ long AutoDriver::getPos()
return temp;
}

// Returns the content of the EL_POS register, which is a 9-bit indicates the current
// electrical position of the motor.
unsigned int AutoDriver::getElPos()
{
unsigned int temp = getParam(EL_POS);
return temp;
}

// Just like getPos(), but for MARK.
long AutoDriver::getMark()
{
Expand Down Expand Up @@ -195,6 +203,12 @@ void AutoDriver::setPos(long newPos)
setParam(ABS_POS, newPos);
}

void AutoDriver::setElPos(unsigned int newElPos)
{
setParam(EL_POS, newElPos);
}


// Sets the ABS_POS register to 0, effectively declaring the current
// position to be "HOME".
void AutoDriver::resetPos()
Expand Down
2 changes: 2 additions & 0 deletions src/Ponoor_L6470Library.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class AutoDriver

// ...and now, operational commands.
long getPos();
unsigned int getElPos();
long getMark();
void run(byte dir, float stepsPerSec);
void runRaw(byte dir, unsigned long integerSpeed);
Expand All @@ -98,6 +99,7 @@ class AutoDriver
void goMark();
void setMark(long newMark);
void setPos(long newPos);
void setElPos(unsigned int newElPos);
void resetPos();
void resetDev();
void softStop();
Expand Down

0 comments on commit 27c711c

Please sign in to comment.