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.
inc/admw1001/admw1001_host_comms.h
- Committer:
- Vkadaba
- Date:
- 2019-06-05
- Revision:
- 5:0728bde67bdb
- Child:
- 6:9d393a9677f4
File content as of revision 5:0728bde67bdb:
/*
Copyright (c) 2018 by ADI. This model is the confidential and
proprietary property of ADI and the possession or use of this
file requires a written license.
*/
#ifndef __ADMW1001_HOST_COMMS_H__
#define __ADMW1001_HOST_COMMS_H__
#include "admw_types.h"
/*
* The host is expected to transfer a 16-bit command, followed by data bytes, in 2
* separate transfers delineated by the CS signal and a short delay in between.
*
* The 16-bit command contains a right-justified 11-bit register address (offset),
* and the remaining upper 5 bits are reserved as command bits assigned as follows:
* [15:11] 10000b = write command, 01000b = read command, anything else is invalid
* [10:0] register address (0-2047)
*/
/* Register address space is limited to 2048 bytes (11 bit address) */
#define ADMW1001_HOST_COMMS_CMD_MASK 0xF800
#define ADMW1001_HOST_COMMS_ADR_MASK 0x07FF
/*
* The following commands are currently supported, anything else is treated
* as an error
*/
#define ADMW1001_HOST_COMMS_WRITE_CMD 0x8000
#define ADMW1001_HOST_COMMS_READ_CMD 0x4000
/*
* The following bytes are sent back to the host when a command is recieved,
* to be used by the host to verify that we were ready to receive the command.
*/
#define ADMW1001_HOST_COMMS_CMD_RESP_0 0xF0
#define ADMW1001_HOST_COMMS_CMD_RESP_1 0xE1
/*
* The following minimum delay, in microseconds, must be inserted after each SPI
* transfer to allow time for it to be processed by the device
*/
#define ADMW1001_HOST_COMMS_XFER_DELAY (60)
/*! ADMW1001 Sensor Result bit field structure */
typedef struct _ADMW1001_Sensor_Result_t {
union {
struct {
float32_t Sensor_Result; /**< Linearized and compensated sensor result */
uint32_t Channel_ID : 4; /**< Indicates which channel this result corresponds to */
uint32_t Ch_Error : 1; /**< Indicates Error on channel */
uint32_t Ch_Alert : 1; /**< Indicates Alert on channel */
uint32_t Ch_Raw : 1; /**< Indicates if Raw sensor data field is valid */
uint32_t Ch_Valid : 1; /**< Indicates if this Result structure is valid */
uint32_t Raw_Sample : 24; /**< Raw sensor data value */
};
uint64_t VALUE64;
};
} ADMW1001_Sensor_Result_t;
#endif /* __ADMW1001_HOST_COMMS_H__ */