Example for updating the MTi-1's firmware. Uses a platform independent, retargetable pure C implementation of the firmware updater protocol.
mtinterface_mtssp.h
00001 /*! 00002 * \file 00003 * \copyright Copyright (C) Xsens Technologies B.V., 2015. 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 00006 * use this file except in compliance with the License. You may obtain a copy 00007 * of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 00014 * License for the specific language governing permissions and limitations 00015 * under the License. 00016 */ 00017 #ifndef MTINTERFACE_MTSSP_H 00018 #define MTINTERFACE_MTSSP_H 00019 00020 #include "xbusmessage.h " 00021 #include "xbusparser.h " 00022 #include "mtinterface.h " 00023 #include "mbed.h" 00024 00025 00026 /*! \class MtsspDriver 00027 \brief Abstract interface providing the MTSSP interface with a abstraction layer to the underlying hardware bus 00028 00029 */ 00030 class MtsspDriver 00031 { 00032 public: 00033 00034 /*! \brief Perform a blocking write transfer 00035 \param opcode Opcode to use 00036 \param data Pointer to data to be written 00037 \param dataLength Number of data bytes to write 00038 */ 00039 virtual void write(uint8_t opcode, uint8_t const* data, int dataLength) = 0; 00040 00041 00042 /*! \brief Perform a blocking read transfer 00043 \param opcode Opcode to use 00044 \param data Pointer to result buffer 00045 \param dataLength Number of data bytes to read 00046 */ 00047 virtual void read(uint8_t opcode, uint8_t* data, int dataLength) = 0; 00048 00049 00050 /*! \brief Perform a blocking write transfer 00051 \param data Pointer to data to be written 00052 \param dataLength Number of data bytes to write 00053 */ 00054 virtual void writeRaw(uint8_t const* data, int dataLength) = 0; 00055 00056 00057 /*! \brief Returns the low level bus format that must be used for tranmitting messages over this hardware bus 00058 */ 00059 virtual XbusBusFormat busFormat() const = 0; 00060 }; 00061 00062 00063 00064 class MtInterfaceMtssp : public MtInterface 00065 { 00066 public: 00067 MtInterfaceMtssp(MtsspDriver* driver); 00068 virtual ~MtInterfaceMtssp(); 00069 00070 virtual void process(); 00071 virtual void sendXbusMessage(XbusMessage const* xbusMessage); 00072 virtual XbusBusFormat busFormat(); 00073 00074 protected: 00075 void handleDataReady(); 00076 void readProtocolInfo(uint8_t* version, uint8_t* dataReadyConfig); 00077 void configureProtocol(uint8_t dataReadyConfig); 00078 void readPipeStatus(uint16_t* notificationMessageSize, uint16_t* measurementMessageSize); 00079 void readFromPipe(uint8_t* buffer, uint16_t size, uint8_t pipe); 00080 00081 private: 00082 MtsspDriver* m_driver; 00083 DigitalIn* m_dataReady; 00084 }; 00085 00086 00087 #endif // MTINTERFACE_MTSSP_H
Generated on Wed Jul 13 2022 07:56:15 by 1.7.2