| aMotion_GetEnc32 | Index |
Definition:
Parameters:
| stemRef | - | An opaque library reference representing the aStem library which manages the communication with the BrainStem modules. |
| module | - | The IIC address of the Moto module that will return the 32-bit encoder setting for one of its motion control channels. This need not be the router. |
| channel | - | The index of the motion control channel. |
| pbuff | - | Address of a 4-byte buffer where the network byte ordered value will be stored. |
Return Value:
Description:
This routine manages the BrainStem packets needed to request the 4-byte encoder count associated with a motion control channel and receive the reply.
See the cmdMO_ENC32 documentation for a discussion of how the 32-bit encoder works for various motion control modes.
Example:
/* include used for byte ordering, requires aUtil.c object */ #include "aUtil.h" /* the storage for our value, initialized to zero */ int encoderValue = 0; { aErr e; char buff[4]; /* storage to hold the value from the packet */ /* get the module 4, channel 0 encoder data */ e = aMotion_GetEnc32(stemLibRef, 4, 0, buff); if (e == aErrNone) { /* this call ensures that the byte-order on your platform is * resolved so the number makes sense to your machine that * comes from the BrainStem in network byte order. */ encoderValue = aUtil_RetrieveInt((const char*)buff); } } /* now, encoderValue is filled, provided there was no error */ |
Related: