Example for updating the MTi-1's firmware. Uses a platform independent, retargetable pure C implementation of the firmware updater protocol.
MtInterfaceMtssp Class Reference
Implementation of MtInterface for the MTSSP protocol. More...
Inherits MtInterface.
Public Member Functions | |
MtInterfaceMtssp (MtsspDriver *driver) | |
Constructor. | |
virtual | ~MtInterfaceMtssp () |
Destructor. | |
virtual void | process () |
Must be polled in the main application loop. | |
virtual void | sendXbusMessage (XbusMessage const *xbusMessage) |
Sends an xbus message to the motion tracker. | |
virtual XbusBusFormat | busFormat () |
Returns the low level bus format used. | |
XbusMessage * | getXbusMessage () |
Returns the next message from the rx queue or NULL if the queue is empty. | |
void | releaseXbusMessage (XbusMessage *xbusMessage) |
Releases an xbus message previously obtained by a call to getXbusMessage() | |
XbusMessage * | sendAndWait (XbusMessage const *xbusMessage) |
Sends an Xbus message and waits for the related acknowledge. | |
Protected Member Functions | |
void | handleDataReady () |
Should be called if the data ready line from the motion tracker signals that there is data pending. | |
void | readProtocolInfo (uint8_t *version, uint8_t *dataReadyConfig) |
Read MTSSP protocol info. | |
void | configureProtocol (uint8_t dataReadyConfig) |
Write MTSSP protocol settings. | |
void | readPipeStatus (uint16_t *notificationMessageSize, uint16_t *measurementMessageSize) |
Read the pipe status. | |
void | readFromPipe (uint8_t *buffer, uint16_t size, uint8_t pipe) |
Read from notification or measurement data pipe. | |
void * | allocateMessageData (size_t bufferSize) |
Callback function for XbusParserCallback to allocate a block of memory. | |
void | deallocateMessageData (void const *buffer) |
Callback function for XbusParserCallback to deallocate a block of memory. | |
void | xbusParserCallbackFunction (struct XbusMessage const *message) |
Callback function for XbusParserCallback that handles a completely received xbus message from the motion tracker. | |
Friends | |
void * | allocateMessageDataWrapper (size_t bufferSize) |
Callback function for XbusParserCallback for allocating a block of memory. | |
void | deallocateMessageDataWrapper (void const *buffer) |
Callback function for XbusParserCallback for deallocating a block of memory. | |
void | xbusParserCallbackFunctionWrapper (struct XbusMessage const *message) |
Callback function for XbusParserCallback that handles completely received xbus messages from the motion tracker. |
Detailed Description
Implementation of MtInterface for the MTSSP protocol.
MTSSP is the protocol used for communicating with an Xsens motion tracker over I2C or SPI.
Definition at line 64 of file mtinterface_mtssp.h.
Constructor & Destructor Documentation
MtInterfaceMtssp | ( | MtsspDriver * | driver ) |
Constructor.
- Parameters:
-
driver Pointer to an MtsspDriver
Definition at line 37 of file mtinterface_mtssp.cpp.
~MtInterfaceMtssp | ( | ) | [virtual] |
Destructor.
Definition at line 46 of file mtinterface_mtssp.cpp.
Member Function Documentation
void * allocateMessageData | ( | size_t | bufferSize ) | [protected, inherited] |
Callback function for XbusParserCallback to allocate a block of memory.
- Parameters:
-
bufferSize buffer size
Definition at line 117 of file mtinterface.cpp.
XbusBusFormat busFormat | ( | ) | [virtual] |
Returns the low level bus format used.
Implements MtInterface.
Definition at line 77 of file mtinterface_mtssp.cpp.
void configureProtocol | ( | uint8_t | dataReadyConfig ) | [protected] |
Write MTSSP protocol settings.
- Parameters:
-
dataReadyConfig The data ready configuration which must be set
Bit 7:4 Reserved
Bit 3 Measurement pipe DRDY event enable: 0 = disabled, 1 = enabled
Bit 2 Notification pipe DRDY event enable: 0 = disabled, 1 = enabled
Bit 1 Output type of DRDY pin: = 0 Push/pull, 1 = open drain
Bit 0 Polarity of DRDY signal: 0 = Idle low, 1 = Idle high
- See also:
- readProtocolInfo
Definition at line 141 of file mtinterface_mtssp.cpp.
void deallocateMessageData | ( | void const * | buffer ) | [protected, inherited] |
Callback function for XbusParserCallback to deallocate a block of memory.
- Parameters:
-
buffer Pointer to the buffer that should be deallocated
Definition at line 129 of file mtinterface.cpp.
XbusMessage * getXbusMessage | ( | ) | [inherited] |
Returns the next message from the rx queue or NULL if the queue is empty.
- Note:
- The caller must dealocate the message with releaseXbusMessage() after use.
Definition at line 89 of file mtinterface.cpp.
void handleDataReady | ( | ) | [protected] |
Should be called if the data ready line from the motion tracker signals that there is data pending.
Definition at line 85 of file mtinterface_mtssp.cpp.
void process | ( | ) | [virtual] |
Must be polled in the main application loop.
Implements MtInterface.
Definition at line 54 of file mtinterface_mtssp.cpp.
void readFromPipe | ( | uint8_t * | buffer, |
uint16_t | size, | ||
uint8_t | pipe | ||
) | [protected] |
Read from notification or measurement data pipe.
- Parameters:
-
buffer Result buffer size Number of bytes to read pipe Pipe from which to read, XBUS_NOTIFICATION_PIPE or XBUS_MEASUREMENT_PIPE
Definition at line 165 of file mtinterface_mtssp.cpp.
void readPipeStatus | ( | uint16_t * | notificationMessageSize, |
uint16_t * | measurementMessageSize | ||
) | [protected] |
Read the pipe status.
- Parameters:
-
[out] notificationMessageSize Pointer for returning the number of pending notification bytes [out] measurementMessageSize Pointer for returning the number of pending measurement bytes
Definition at line 151 of file mtinterface_mtssp.cpp.
void readProtocolInfo | ( | uint8_t * | version, |
uint8_t * | dataReadyConfig | ||
) | [protected] |
Read MTSSP protocol info.
- Parameters:
-
[out] version Pointer to receive the version byte [out] dataReadyConfig Pointer to receive the data ready configuration byte
- See also:
- configureProtocol
Definition at line 122 of file mtinterface_mtssp.cpp.
void releaseXbusMessage | ( | XbusMessage * | xbusMessage ) | [inherited] |
Releases an xbus message previously obtained by a call to getXbusMessage()
- Parameters:
-
xbusMessage that should be released
Definition at line 104 of file mtinterface.cpp.
XbusMessage * sendAndWait | ( | XbusMessage const * | xbusMessage ) | [inherited] |
Sends an Xbus message and waits for the related acknowledge.
- Returns:
- 0 if no related message was received. Pointer to the message otherwise. This message can also be an error message.
Definition at line 149 of file mtinterface.cpp.
void sendXbusMessage | ( | XbusMessage const * | xbusMessage ) | [virtual] |
Sends an xbus message to the motion tracker.
- Parameters:
-
xbusMessage Pointer to xbus message which should be send
Implements MtInterface.
Definition at line 66 of file mtinterface_mtssp.cpp.
void xbusParserCallbackFunction | ( | struct XbusMessage const * | message ) | [protected, inherited] |
Callback function for XbusParserCallback that handles a completely received xbus message from the motion tracker.
- Parameters:
-
message Pointer to the received xbus message
Definition at line 138 of file mtinterface.cpp.
Friends And Related Function Documentation
void* allocateMessageDataWrapper | ( | size_t | bufferSize ) | [friend, inherited] |
Callback function for XbusParserCallback for allocating a block of memory.
- Parameters:
-
bufferSize buffer size
Definition at line 37 of file mtinterface.cpp.
void deallocateMessageDataWrapper | ( | void const * | buffer ) | [friend, inherited] |
Callback function for XbusParserCallback for deallocating a block of memory.
- Parameters:
-
buffer Pointer to the buffer that should be deallocated
Definition at line 46 of file mtinterface.cpp.
void xbusParserCallbackFunctionWrapper | ( | struct XbusMessage const * | message ) | [friend, inherited] |
Callback function for XbusParserCallback that handles completely received xbus messages from the motion tracker.
- Parameters:
-
Pointer to the received xbus message
Definition at line 55 of file mtinterface.cpp.
Generated on Wed Jul 13 2022 07:56:16 by 1.7.2