Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos mbed Xbus
Fork of MTi-1_example by
xbus/xbusparser.h@14:155f9a55ec51, 2015-05-19 (annotated)
- Committer:
- Alex Young
- Date:
- Tue May 19 13:29:34 2015 +0200
- Revision:
- 14:155f9a55ec51
- Parent:
- 3:abc451d82b88
- Child:
- 25:01356fb59467
Use XbusMessage struct in parser.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Alex Young |
3:abc451d82b88 | 1 | /*! |
| Alex Young |
3:abc451d82b88 | 2 | * \file |
| Alex Young |
3:abc451d82b88 | 3 | * \copyright |
| Alex Young |
3:abc451d82b88 | 4 | * Copyright (C) Xsens Technologies B.V., 2015. All rights reserved. |
| Alex Young |
3:abc451d82b88 | 5 | * |
| Alex Young |
3:abc451d82b88 | 6 | * This source code is intended for use only by Xsens Technologies BV and |
| Alex Young |
3:abc451d82b88 | 7 | * those that have explicit written permission to use it from |
| Alex Young |
3:abc451d82b88 | 8 | * Xsens Technologies BV. |
| Alex Young |
3:abc451d82b88 | 9 | * |
| Alex Young |
3:abc451d82b88 | 10 | * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY |
| Alex Young |
3:abc451d82b88 | 11 | * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
| Alex Young |
3:abc451d82b88 | 12 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A |
| Alex Young |
3:abc451d82b88 | 13 | * PARTICULAR PURPOSE. |
| Alex Young |
3:abc451d82b88 | 14 | */ |
| Alex Young |
3:abc451d82b88 | 15 | |
| Alex Young |
3:abc451d82b88 | 16 | #ifndef __XBUSPARSER_H |
| Alex Young |
3:abc451d82b88 | 17 | #define __XBUSPARSER_H |
| Alex Young |
3:abc451d82b88 | 18 | |
| Alex Young |
3:abc451d82b88 | 19 | #include <stddef.h> |
| Alex Young |
3:abc451d82b88 | 20 | #include <stdint.h> |
| Alex Young |
14:155f9a55ec51 | 21 | #include "xbusmessage.h" |
| Alex Young |
3:abc451d82b88 | 22 | |
| Alex Young |
3:abc451d82b88 | 23 | #ifdef __cplusplus |
| Alex Young |
3:abc451d82b88 | 24 | extern "C" { |
| Alex Young |
3:abc451d82b88 | 25 | #endif |
| Alex Young |
3:abc451d82b88 | 26 | |
| Alex Young |
3:abc451d82b88 | 27 | struct XbusParser; |
| Alex Young |
3:abc451d82b88 | 28 | |
| Alex Young |
3:abc451d82b88 | 29 | struct XbusParserCallback |
| Alex Young |
3:abc451d82b88 | 30 | { |
| Alex Young |
3:abc451d82b88 | 31 | /*! |
| Alex Young |
3:abc451d82b88 | 32 | * \brief Allocate a buffer for message reception. |
| Alex Young |
3:abc451d82b88 | 33 | * \param bufSize The size of the buffer to allocate. |
| Alex Young |
3:abc451d82b88 | 34 | * \returns Pointer to buffer to use for message reception, or NULL if |
| Alex Young |
3:abc451d82b88 | 35 | * a buffer cannot be allocated. |
| Alex Young |
3:abc451d82b88 | 36 | * |
| Alex Young |
3:abc451d82b88 | 37 | * \note It is the resposibility of the callback to deallocate the buffer |
| Alex Young |
3:abc451d82b88 | 38 | * once it is done with processing the message. |
| Alex Young |
3:abc451d82b88 | 39 | */ |
| Alex Young |
3:abc451d82b88 | 40 | void* (*allocateBuffer)(size_t bufSize); |
| Alex Young |
3:abc451d82b88 | 41 | |
| Alex Young |
3:abc451d82b88 | 42 | /*! |
| Alex Young |
3:abc451d82b88 | 43 | * \brief Handle a received message. |
| Alex Young |
3:abc451d82b88 | 44 | */ |
| Alex Young |
14:155f9a55ec51 | 45 | void (*handleMessage)(struct XbusMessage const* message); |
| Alex Young |
3:abc451d82b88 | 46 | }; |
| Alex Young |
3:abc451d82b88 | 47 | |
| Alex Young |
3:abc451d82b88 | 48 | size_t XbusParser_mem(void); |
| Alex Young |
3:abc451d82b88 | 49 | struct XbusParser* XbusParser_create(struct XbusParserCallback const* callback); |
| Alex Young |
3:abc451d82b88 | 50 | void XbusParser_destroy(struct XbusParser* parser); |
| Alex Young |
3:abc451d82b88 | 51 | struct XbusParser* XbusParser_init(void* parserMem, struct XbusParserCallback const* callback); |
| Alex Young |
3:abc451d82b88 | 52 | |
| Alex Young |
3:abc451d82b88 | 53 | void XbusParser_parseByte(struct XbusParser* parser, uint8_t byte); |
| Alex Young |
3:abc451d82b88 | 54 | void XbusParser_parseBuffer(struct XbusParser* parser, uint8_t const* buf, size_t bufSize); |
| Alex Young |
3:abc451d82b88 | 55 | |
| Alex Young |
3:abc451d82b88 | 56 | #ifdef __cplusplus |
| Alex Young |
3:abc451d82b88 | 57 | } |
| Alex Young |
3:abc451d82b88 | 58 | #endif // extern "C" |
| Alex Young |
3:abc451d82b88 | 59 | |
| Alex Young |
3:abc451d82b88 | 60 | #endif // __XBUSPARSER_H |

Xsens MTi 1-series