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.
Dependents: MTi-1_example_LPC1768 MTi-1_rikbeun MTi-1_example MTi-1_example ... more
xsdeviceid.c@1:c24f69a2eff4, 2015-10-02 (annotated)
- Committer:
- tjerkhofmeijer
- Date:
- Fri Oct 02 16:22:33 2015 +0200
- Revision:
- 1:c24f69a2eff4
- Parent:
- 0:eb25b1785ee4
Xbus library is updated to support MTi 1-series' I2C and SPI interfaces
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| alexandery | 0:eb25b1785ee4 | 1 | /*! |
| alexandery | 0:eb25b1785ee4 | 2 | * \file |
| alexandery | 0:eb25b1785ee4 | 3 | * \copyright Copyright (C) Xsens Technologies B.V., 2015. |
| alexandery | 0:eb25b1785ee4 | 4 | * |
| alexandery | 0:eb25b1785ee4 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| alexandery | 0:eb25b1785ee4 | 6 | * use this file except in compliance with the License. You may obtain a copy |
| alexandery | 0:eb25b1785ee4 | 7 | * of the License at |
| alexandery | 0:eb25b1785ee4 | 8 | * |
| alexandery | 0:eb25b1785ee4 | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| alexandery | 0:eb25b1785ee4 | 10 | * |
| alexandery | 0:eb25b1785ee4 | 11 | * Unless required by applicable law or agreed to in writing, software |
| alexandery | 0:eb25b1785ee4 | 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| alexandery | 0:eb25b1785ee4 | 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| alexandery | 0:eb25b1785ee4 | 14 | * License for the specific language governing permissions and limitations |
| alexandery | 0:eb25b1785ee4 | 15 | * under the License. |
| alexandery | 0:eb25b1785ee4 | 16 | */ |
| alexandery | 0:eb25b1785ee4 | 17 | |
| alexandery | 0:eb25b1785ee4 | 18 | #include "xsdeviceid.h" |
| alexandery | 0:eb25b1785ee4 | 19 | |
| alexandery | 0:eb25b1785ee4 | 20 | /*! |
| alexandery | 0:eb25b1785ee4 | 21 | * \brief Return true if device ID corresponds to a MTi-1 series device. |
| alexandery | 0:eb25b1785ee4 | 22 | */ |
| alexandery | 0:eb25b1785ee4 | 23 | bool XsDeviceId_isMtMk4_X(uint32_t deviceId) |
| alexandery | 0:eb25b1785ee4 | 24 | { |
| alexandery | 0:eb25b1785ee4 | 25 | uint8_t deviceSeries = (deviceId >> 20) & 0xF; |
| alexandery | 0:eb25b1785ee4 | 26 | return ((deviceSeries == 0x8) || (deviceSeries == 0xC)); |
| alexandery | 0:eb25b1785ee4 | 27 | } |
| alexandery | 0:eb25b1785ee4 | 28 | |
| alexandery | 0:eb25b1785ee4 | 29 | /*! |
| alexandery | 0:eb25b1785ee4 | 30 | * \brief Get a string describing the function of the MTi device. |
| alexandery | 0:eb25b1785ee4 | 31 | */ |
| alexandery | 0:eb25b1785ee4 | 32 | char const* XsDeviceId_functionDescription(enum DeviceFunction function) |
| alexandery | 0:eb25b1785ee4 | 33 | { |
| alexandery | 0:eb25b1785ee4 | 34 | switch (function) |
| alexandery | 0:eb25b1785ee4 | 35 | { |
| alexandery | 0:eb25b1785ee4 | 36 | case DF_IMU: |
| alexandery | 0:eb25b1785ee4 | 37 | return "Inertial Measurement Unit"; |
| alexandery | 0:eb25b1785ee4 | 38 | |
| alexandery | 0:eb25b1785ee4 | 39 | case DF_VRU: |
| alexandery | 0:eb25b1785ee4 | 40 | return "Vertical Reference Unit"; |
| alexandery | 0:eb25b1785ee4 | 41 | |
| alexandery | 0:eb25b1785ee4 | 42 | case DF_AHRS: |
| alexandery | 0:eb25b1785ee4 | 43 | return "Attitude Heading Reference System"; |
| alexandery | 0:eb25b1785ee4 | 44 | } |
| alexandery | 0:eb25b1785ee4 | 45 | |
| alexandery | 0:eb25b1785ee4 | 46 | return "Unknown device function"; |
| alexandery | 0:eb25b1785ee4 | 47 | } |
| alexandery | 0:eb25b1785ee4 | 48 |