Vybhav Kadaba
/
EV-PRO-MW1001_Development_updateFW
Bumped Mbed FW version to 01.20.0080
inc/admw1001/admw1001_host_comms.h@70:420fac5132f5, 2020-04-23 (annotated)
- Committer:
- Vkadaba
- Date:
- Thu Apr 23 08:30:42 2020 +0000
- Revision:
- 70:420fac5132f5
- Parent:
- 50:d84305e5e1c0
sensor result structure modified
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Vkadaba | 5:0728bde67bdb | 1 | /* |
Vkadaba | 6:9d393a9677f4 | 2 | Copyright 2019 (c) Analog Devices, Inc. |
Vkadaba | 6:9d393a9677f4 | 3 | |
Vkadaba | 6:9d393a9677f4 | 4 | All rights reserved. |
Vkadaba | 6:9d393a9677f4 | 5 | |
Vkadaba | 6:9d393a9677f4 | 6 | Redistribution and use in source and binary forms, with or without |
Vkadaba | 6:9d393a9677f4 | 7 | modification, are permitted provided that the following conditions are met: |
Vkadaba | 6:9d393a9677f4 | 8 | - Redistributions of source code must retain the above copyright |
Vkadaba | 6:9d393a9677f4 | 9 | notice, this list of conditions and the following disclaimer. |
Vkadaba | 6:9d393a9677f4 | 10 | - Redistributions in binary form must reproduce the above copyright |
Vkadaba | 6:9d393a9677f4 | 11 | notice, this list of conditions and the following disclaimer in |
Vkadaba | 6:9d393a9677f4 | 12 | the documentation and/or other materials provided with the |
Vkadaba | 6:9d393a9677f4 | 13 | distribution. |
Vkadaba | 6:9d393a9677f4 | 14 | - Neither the name of Analog Devices, Inc. nor the names of its |
Vkadaba | 6:9d393a9677f4 | 15 | contributors may be used to endorse or promote products derived |
Vkadaba | 6:9d393a9677f4 | 16 | from this software without specific prior written permission. |
Vkadaba | 6:9d393a9677f4 | 17 | - The use of this software may or may not infringe the patent rights |
Vkadaba | 6:9d393a9677f4 | 18 | of one or more patent holders. This license does not release you |
Vkadaba | 6:9d393a9677f4 | 19 | from the requirement that you obtain separate licenses from these |
Vkadaba | 6:9d393a9677f4 | 20 | patent holders to use this software. |
Vkadaba | 6:9d393a9677f4 | 21 | - Use of the software either in source or binary form, must be run |
Vkadaba | 6:9d393a9677f4 | 22 | on or directly connected to an Analog Devices Inc. component. |
Vkadaba | 6:9d393a9677f4 | 23 | |
Vkadaba | 6:9d393a9677f4 | 24 | THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
Vkadaba | 6:9d393a9677f4 | 25 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
Vkadaba | 6:9d393a9677f4 | 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
Vkadaba | 6:9d393a9677f4 | 27 | IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
Vkadaba | 6:9d393a9677f4 | 28 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
Vkadaba | 6:9d393a9677f4 | 29 | LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
Vkadaba | 6:9d393a9677f4 | 30 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Vkadaba | 6:9d393a9677f4 | 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Vkadaba | 6:9d393a9677f4 | 32 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Vkadaba | 6:9d393a9677f4 | 33 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Vkadaba | 6:9d393a9677f4 | 34 | */ |
Vkadaba | 6:9d393a9677f4 | 35 | |
Vkadaba | 5:0728bde67bdb | 36 | #ifndef __ADMW1001_HOST_COMMS_H__ |
Vkadaba | 5:0728bde67bdb | 37 | #define __ADMW1001_HOST_COMMS_H__ |
Vkadaba | 5:0728bde67bdb | 38 | |
Vkadaba | 5:0728bde67bdb | 39 | #include "admw_types.h" |
Vkadaba | 70:420fac5132f5 | 40 | #include "ADMW1001_REGISTERS_typedefs.h" |
Vkadaba | 6:9d393a9677f4 | 41 | |
Vkadaba | 5:0728bde67bdb | 42 | /* |
Vkadaba | 5:0728bde67bdb | 43 | * The host is expected to transfer a 16-bit command, followed by data bytes, in 2 |
Vkadaba | 5:0728bde67bdb | 44 | * separate transfers delineated by the CS signal and a short delay in between. |
Vkadaba | 5:0728bde67bdb | 45 | * |
Vkadaba | 5:0728bde67bdb | 46 | * The 16-bit command contains a right-justified 11-bit register address (offset), |
Vkadaba | 5:0728bde67bdb | 47 | * and the remaining upper 5 bits are reserved as command bits assigned as follows: |
Vkadaba | 5:0728bde67bdb | 48 | * [15:11] 10000b = write command, 01000b = read command, anything else is invalid |
Vkadaba | 5:0728bde67bdb | 49 | * [10:0] register address (0-2047) |
Vkadaba | 5:0728bde67bdb | 50 | */ |
Vkadaba | 5:0728bde67bdb | 51 | |
Vkadaba | 5:0728bde67bdb | 52 | /* Register address space is limited to 2048 bytes (11 bit address) */ |
Vkadaba | 5:0728bde67bdb | 53 | #define ADMW1001_HOST_COMMS_CMD_MASK 0xF800 |
Vkadaba | 5:0728bde67bdb | 54 | #define ADMW1001_HOST_COMMS_ADR_MASK 0x07FF |
Vkadaba | 5:0728bde67bdb | 55 | |
Vkadaba | 5:0728bde67bdb | 56 | /* |
Vkadaba | 5:0728bde67bdb | 57 | * The following commands are currently supported, anything else is treated |
Vkadaba | 5:0728bde67bdb | 58 | * as an error |
Vkadaba | 5:0728bde67bdb | 59 | */ |
Vkadaba | 5:0728bde67bdb | 60 | #define ADMW1001_HOST_COMMS_WRITE_CMD 0x8000 |
Vkadaba | 5:0728bde67bdb | 61 | #define ADMW1001_HOST_COMMS_READ_CMD 0x4000 |
Vkadaba | 5:0728bde67bdb | 62 | |
Vkadaba | 6:9d393a9677f4 | 63 | #define ADMW1001_HOST_COMMS_DEBUG_WRITE_CMD 0x8800 |
Vkadaba | 6:9d393a9677f4 | 64 | #define ADMW1001_HOST_COMMS_DEBUG_READ_CMD 0x4800 |
Vkadaba | 6:9d393a9677f4 | 65 | |
Vkadaba | 5:0728bde67bdb | 66 | /* |
Vkadaba | 5:0728bde67bdb | 67 | * The following bytes are sent back to the host when a command is recieved, |
Vkadaba | 5:0728bde67bdb | 68 | * to be used by the host to verify that we were ready to receive the command. |
Vkadaba | 5:0728bde67bdb | 69 | */ |
Vkadaba | 5:0728bde67bdb | 70 | #define ADMW1001_HOST_COMMS_CMD_RESP_0 0xF0 |
Vkadaba | 5:0728bde67bdb | 71 | #define ADMW1001_HOST_COMMS_CMD_RESP_1 0xE1 |
Vkadaba | 5:0728bde67bdb | 72 | |
Vkadaba | 5:0728bde67bdb | 73 | /* |
Vkadaba | 5:0728bde67bdb | 74 | * The following minimum delay, in microseconds, must be inserted after each SPI |
Vkadaba | 5:0728bde67bdb | 75 | * transfer to allow time for it to be processed by the device |
Vkadaba | 5:0728bde67bdb | 76 | */ |
Vkadaba | 50:d84305e5e1c0 | 77 | #define ADMW1001_HOST_COMMS_XFER_DELAY (60) |
Vkadaba | 5:0728bde67bdb | 78 | |
Vkadaba | 32:52445bef314d | 79 | /* |
Vkadaba | 32:52445bef314d | 80 | * The following defines the maximum number of retries before aborting a transfer. |
Vkadaba | 32:52445bef314d | 81 | */ |
Vkadaba | 32:52445bef314d | 82 | #define ADMW1001_HOST_COMMS_MAX_RETRIES (10) |
Vkadaba | 32:52445bef314d | 83 | |
Vkadaba | 50:d84305e5e1c0 | 84 | /*! ADMW1001 Sensor Result bit field structure */ |
Vkadaba | 50:d84305e5e1c0 | 85 | typedef struct _ADMW1001_Sensor_Result_t |
Vkadaba | 50:d84305e5e1c0 | 86 | { |
Vkadaba | 70:420fac5132f5 | 87 | float32_t Sensor_Result; /**< Linearized and compensated sensor result */ |
Vkadaba | 70:420fac5132f5 | 88 | uint16_t Channel_ID : 4; /**< Indicates which channel this result corresponds to */ |
Vkadaba | 70:420fac5132f5 | 89 | uint16_t Ch_Error : 1; /**< Indicates Error on channel */ |
Vkadaba | 70:420fac5132f5 | 90 | uint16_t Ch_Alert : 1; /**< Indicates Alert on channel */ |
Vkadaba | 70:420fac5132f5 | 91 | uint16_t Ch_Raw : 1; /**< Indicates if Raw sensor data field is valid */ |
Vkadaba | 70:420fac5132f5 | 92 | uint16_t Ch_Valid : 1; /**< Indicates if this Result structure is valid */ |
Vkadaba | 70:420fac5132f5 | 93 | uint16_t Reserved : 8; /**< Reserved for future use */ |
Vkadaba | 70:420fac5132f5 | 94 | ADMW_CORE_Alert_Detail_Ch_t Status; /**< Indicates Status of this measurement */ |
Vkadaba | 70:420fac5132f5 | 95 | float32_t Raw_Sample; /**< Raw sensor data value */ |
Vkadaba | 32:52445bef314d | 96 | |
Vkadaba | 50:d84305e5e1c0 | 97 | } ADMW1001_Sensor_Result_t; |
Vkadaba | 5:0728bde67bdb | 98 | |
Vkadaba | 70:420fac5132f5 | 99 | |
Vkadaba | 5:0728bde67bdb | 100 | #endif /* __ADMW1001_HOST_COMMS_H__ */ |