AdiSense1000_V21 MBED API

Fork of AdiSense1000 by PoC_Team

Committer:
Dan O'Donovan
Date:
Mon Mar 26 20:28:05 2018 +0100
Branch:
v2.0
Revision:
27:567abf893938
Child:
29:57edca10d78c
Adding host library and example code for v1.1 release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Dan O'Donovan 27:567abf893938 1 /*
Dan O'Donovan 27:567abf893938 2 CONFIDENTIAL AND PROPRIETARY INFORMATION
Dan O'Donovan 27:567abf893938 3
Dan O'Donovan 27:567abf893938 4 Copyright (c) 2018 Emutex Ltd. All rights reserved.
Dan O'Donovan 27:567abf893938 5 This software and documentation contain confidential and
Dan O'Donovan 27:567abf893938 6 proprietary information that is the property of
Dan O'Donovan 27:567abf893938 7 Emutex Ltd. The software and documentation are
Dan O'Donovan 27:567abf893938 8 furnished under a license agreement and may be used
Dan O'Donovan 27:567abf893938 9 or copied only in accordance with the terms of the license
Dan O'Donovan 27:567abf893938 10 agreement. No part of the software and documentation
Dan O'Donovan 27:567abf893938 11 may be reproduced, transmitted, or translated, in any
Dan O'Donovan 27:567abf893938 12 form or by any means, electronic, mechanical, manual,
Dan O'Donovan 27:567abf893938 13 optical, or otherwise, without prior written permission
Dan O'Donovan 27:567abf893938 14 of Emutex Ltd., or as expressly provided by the license agreement.
Dan O'Donovan 27:567abf893938 15 Reverse engineering is prohibited, and reproduction,
Dan O'Donovan 27:567abf893938 16 disclosure or use without specific written authorization
Dan O'Donovan 27:567abf893938 17 of Emutex Ltd. is strictly forbidden.
Dan O'Donovan 27:567abf893938 18 *
Dan O'Donovan 27:567abf893938 19 Copyright 2017 (c) Analog Devices, Inc.
Dan O'Donovan 27:567abf893938 20
Dan O'Donovan 27:567abf893938 21 All rights reserved.
Dan O'Donovan 27:567abf893938 22
Dan O'Donovan 27:567abf893938 23 Redistribution and use in source and binary forms, with or without
Dan O'Donovan 27:567abf893938 24 modification, are permitted provided that the following conditions are met:
Dan O'Donovan 27:567abf893938 25 - Redistributions of source code must retain the above copyright
Dan O'Donovan 27:567abf893938 26 notice, this list of conditions and the following disclaimer.
Dan O'Donovan 27:567abf893938 27 - Redistributions in binary form must reproduce the above copyright
Dan O'Donovan 27:567abf893938 28 notice, this list of conditions and the following disclaimer in
Dan O'Donovan 27:567abf893938 29 the documentation and/or other materials provided with the
Dan O'Donovan 27:567abf893938 30 distribution.
Dan O'Donovan 27:567abf893938 31 - Neither the name of Analog Devices, Inc. nor the names of its
Dan O'Donovan 27:567abf893938 32 contributors may be used to endorse or promote products derived
Dan O'Donovan 27:567abf893938 33 from this software without specific prior written permission.
Dan O'Donovan 27:567abf893938 34 - The use of this software may or may not infringe the patent rights
Dan O'Donovan 27:567abf893938 35 of one or more patent holders. This license does not release you
Dan O'Donovan 27:567abf893938 36 from the requirement that you obtain separate licenses from these
Dan O'Donovan 27:567abf893938 37 patent holders to use this software.
Dan O'Donovan 27:567abf893938 38 - Use of the software either in source or binary form, must be run
Dan O'Donovan 27:567abf893938 39 on or directly connected to an Analog Devices Inc. component.
Dan O'Donovan 27:567abf893938 40
Dan O'Donovan 27:567abf893938 41 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
Dan O'Donovan 27:567abf893938 42 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
Dan O'Donovan 27:567abf893938 43 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Dan O'Donovan 27:567abf893938 44 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
Dan O'Donovan 27:567abf893938 45 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Dan O'Donovan 27:567abf893938 46 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
Dan O'Donovan 27:567abf893938 47 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Dan O'Donovan 27:567abf893938 48 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Dan O'Donovan 27:567abf893938 49 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Dan O'Donovan 27:567abf893938 50 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Dan O'Donovan 27:567abf893938 51 *
Dan O'Donovan 27:567abf893938 52 *****************************************************************************/
Dan O'Donovan 27:567abf893938 53
Dan O'Donovan 27:567abf893938 54 /*!
Dan O'Donovan 27:567abf893938 55 ******************************************************************************
Dan O'Donovan 27:567abf893938 56 * @file:
Dan O'Donovan 27:567abf893938 57 * @brief:
Dan O'Donovan 27:567abf893938 58 *-----------------------------------------------------------------------------
Dan O'Donovan 27:567abf893938 59 */
Dan O'Donovan 27:567abf893938 60 #include "inc/adi_sense_config_types.h"
Dan O'Donovan 27:567abf893938 61
Dan O'Donovan 27:567abf893938 62 ADI_SENSE_CONFIG i2c0_onsemiNOA1305_config = {
Dan O'Donovan 27:567abf893938 63 .versionId = { .major = 1, .minor = 4 },
Dan O'Donovan 27:567abf893938 64 .productId = ADI_SENSE_PRODUCT_ID_ADSNS1000,
Dan O'Donovan 27:567abf893938 65 .adisense1000 = {
Dan O'Donovan 27:567abf893938 66 .power = {
Dan O'Donovan 27:567abf893938 67 .powerMode = ADI_SENSE_1000_POWER_MODE_FULL,
Dan O'Donovan 27:567abf893938 68 },
Dan O'Donovan 27:567abf893938 69 .measurement = {
Dan O'Donovan 27:567abf893938 70 .operatingMode = ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE,
Dan O'Donovan 27:567abf893938 71 .dataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CYCLE,
Dan O'Donovan 27:567abf893938 72 },
Dan O'Donovan 27:567abf893938 73 .channels = {
Dan O'Donovan 27:567abf893938 74 [ADI_SENSE_1000_CHANNEL_ID_CJC_0] = {
Dan O'Donovan 27:567abf893938 75 .enableChannel = false,
Dan O'Donovan 27:567abf893938 76 },
Dan O'Donovan 27:567abf893938 77 [ADI_SENSE_1000_CHANNEL_ID_CJC_1] = {
Dan O'Donovan 27:567abf893938 78 .enableChannel = false,
Dan O'Donovan 27:567abf893938 79 },
Dan O'Donovan 27:567abf893938 80 [ADI_SENSE_1000_CHANNEL_ID_SENSOR_0] = {
Dan O'Donovan 27:567abf893938 81 .enableChannel = false,
Dan O'Donovan 27:567abf893938 82 },
Dan O'Donovan 27:567abf893938 83 [ADI_SENSE_1000_CHANNEL_ID_SENSOR_1] = {
Dan O'Donovan 27:567abf893938 84 .enableChannel = false,
Dan O'Donovan 27:567abf893938 85 },
Dan O'Donovan 27:567abf893938 86 [ADI_SENSE_1000_CHANNEL_ID_SENSOR_2] = {
Dan O'Donovan 27:567abf893938 87 .enableChannel = false,
Dan O'Donovan 27:567abf893938 88 },
Dan O'Donovan 27:567abf893938 89 [ADI_SENSE_1000_CHANNEL_ID_SENSOR_3] = {
Dan O'Donovan 27:567abf893938 90 .enableChannel = false,
Dan O'Donovan 27:567abf893938 91 },
Dan O'Donovan 27:567abf893938 92 [ADI_SENSE_1000_CHANNEL_ID_VOLTAGE_0] = {
Dan O'Donovan 27:567abf893938 93 .enableChannel = false,
Dan O'Donovan 27:567abf893938 94 },
Dan O'Donovan 27:567abf893938 95 [ADI_SENSE_1000_CHANNEL_ID_CURRENT_0] = {
Dan O'Donovan 27:567abf893938 96 .enableChannel = false,
Dan O'Donovan 27:567abf893938 97 },
Dan O'Donovan 27:567abf893938 98 [ADI_SENSE_1000_CHANNEL_ID_I2C_0] = {
Dan O'Donovan 27:567abf893938 99 .enableChannel = true,
Dan O'Donovan 27:567abf893938 100 .disablePublishing = false,
Dan O'Donovan 27:567abf893938 101 .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE,
Dan O'Donovan 27:567abf893938 102 .measurementsPerCycle = 10,
Dan O'Donovan 27:567abf893938 103 .extraSettlingTime = 50000,
Dan O'Donovan 27:567abf893938 104 .i2cChannelConfig = {
Dan O'Donovan 27:567abf893938 105 .sensor = ADI_SENSE_1000_I2C_SENSOR_LIGHT_ONSEMI_NOA1305,
Dan O'Donovan 27:567abf893938 106 .deviceAddress = 0x39,
Dan O'Donovan 27:567abf893938 107 .configurationCommand = {
Dan O'Donovan 27:567abf893938 108 /*
Dan O'Donovan 27:567abf893938 109 * Optional configuration command, used here to change
Dan O'Donovan 27:567abf893938 110 * the integration time of the sensor from 200ms
Dan O'Donovan 27:567abf893938 111 * (default) to 50ms for increased sensitivity, setting
Dan O'Donovan 27:567abf893938 112 * INTEGRATION_TIME (register 0x02) to 50ms (value 0x04)
Dan O'Donovan 27:567abf893938 113 */
Dan O'Donovan 27:567abf893938 114 .command = { 0x02, 0x04 },
Dan O'Donovan 27:567abf893938 115 .commandLength = 2,
Dan O'Donovan 27:567abf893938 116 },
Dan O'Donovan 27:567abf893938 117 },
Dan O'Donovan 27:567abf893938 118 },
Dan O'Donovan 27:567abf893938 119 [ADI_SENSE_1000_CHANNEL_ID_I2C_1] = {
Dan O'Donovan 27:567abf893938 120 .enableChannel = false,
Dan O'Donovan 27:567abf893938 121 },
Dan O'Donovan 27:567abf893938 122 [ADI_SENSE_1000_CHANNEL_ID_SPI_0] = {
Dan O'Donovan 27:567abf893938 123 .enableChannel = false,
Dan O'Donovan 27:567abf893938 124 },
Dan O'Donovan 27:567abf893938 125 [ADI_SENSE_1000_CHANNEL_ID_SPI_1] = {
Dan O'Donovan 27:567abf893938 126 .enableChannel = false,
Dan O'Donovan 27:567abf893938 127 },
Dan O'Donovan 27:567abf893938 128 [ADI_SENSE_1000_CHANNEL_ID_SPI_2] = {
Dan O'Donovan 27:567abf893938 129 .enableChannel = false,
Dan O'Donovan 27:567abf893938 130 },
Dan O'Donovan 27:567abf893938 131 },
Dan O'Donovan 27:567abf893938 132 },
Dan O'Donovan 27:567abf893938 133 };