Example for updating the MTi-1's firmware. Uses a platform independent, retargetable pure C implementation of the firmware updater protocol.

Dependencies:   mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers xbusmessage.h Source File

xbusmessage.h

Go to the documentation of this file.
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 XBUSMESSAGE_H
00018 #define XBUSMESSAGE_H
00019 #include <stdint.h>
00020 #include <stddef.h>
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 
00027 /*! \struct XbusMessage
00028     \brief Xbus message
00029 */
00030 struct XbusMessage
00031 {
00032     uint8_t m_mid;
00033 
00034     uint16_t m_length;
00035 
00036     uint8_t* m_data;
00037     
00038 #ifdef __cplusplus
00039     XbusMessage(uint8_t mid, uint16_t length = 0, uint8_t* data = NULL)
00040         : m_mid(mid)
00041         , m_length(length)
00042         , m_data(data)
00043     {}
00044 #endif
00045 };
00046 
00047 /*! \brief Low level bus format for transmitted Xbus messages
00048  */
00049 enum XbusBusFormat
00050 {
00051     /*! \brief Format for use with I2C interface. */
00052     XBF_I2c,
00053     /*! \brief Format for use with SPI interface. */
00054     XBF_Spi,
00055     /*! \brief Format for use with UART interface. */
00056     XBF_Uart
00057 };
00058 
00059 size_t XbusMessage_createRawMessage(uint8_t *raw, struct XbusMessage const *message, enum XbusBusFormat format);
00060 
00061 #ifdef __cplusplus
00062 }
00063 //}
00064 #endif // extern "C"
00065 
00066 
00067 #endif // XBUSMESSAGE_H