![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
AdiSense1000_V21 MBED API
Fork of AdiSense1000 by
Diff: main.cpp
- Revision:
- 28:4eb837cd71df
- Parent:
- 23:2adb6216b001
- Child:
- 32:262fc8aeb486
--- a/main.cpp Mon Mar 26 14:50:05 2018 +0000 +++ b/main.cpp Thu May 17 10:34:45 2018 +0100 @@ -1,7 +1,20 @@ /* - ****************************************************************************** - * file: main.cpp - *----------------------------------------------------------------------------- +CONFIDENTIAL AND PROPRIETARY INFORMATION + +Copyright (c) 2018 Emutex Ltd. All rights reserved. +This software and documentation contain confidential and +proprietary information that is the property of +Emutex Ltd. The software and documentation are +furnished under a license agreement and may be used +or copied only in accordance with the terms of the license +agreement. No part of the software and documentation +may be reproduced, transmitted, or translated, in any +form or by any means, electronic, mechanical, manual, +optical, or otherwise, without prior written permission +of Emutex Ltd., or as expressly provided by the license agreement. +Reverse engineering is prohibited, and reproduction, +disclosure or use without specific written authorization +of Emutex Ltd. is strictly forbidden. * Copyright 2017 (c) Analog Devices, Inc. @@ -37,15 +50,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + *----------------------------------------------------------------------------- + * + */ #include "mbed.h" #include "inc/adi_sense_api.h" #include "inc/adi_sense_1000/adi_sense_1000_api.h" #include "inc/adi_sense_log.h" #include "common/utils.h" +extern ADI_SENSE_CONFIG cjc0_thermistor_10k_ntc_config; extern ADI_SENSE_CONFIG sensor0_rtd_2w_pt100_config; +extern ADI_SENSE_CONFIG sensor0_microphone_config; +extern ADI_SENSE_CONFIG sensor0_diode_2c_config; extern ADI_SENSE_CONFIG sensor1_typeK_cjc1_config; extern ADI_SENSE_CONFIG sensor1_rtd_3w_pt100_config; +extern ADI_SENSE_CONFIG sensor1_diode_3c_config; extern ADI_SENSE_CONFIG sensor2_typeT_cjc0_config; extern ADI_SENSE_CONFIG sensor2_bridge_6w_pressure_config; extern ADI_SENSE_CONFIG sensor3_typeJ_cjc0_config; @@ -54,8 +77,11 @@ extern ADI_SENSE_CONFIG current_honeywellPressure_config; extern ADI_SENSE_CONFIG i2c0_honeywellHumidicon_config; extern ADI_SENSE_CONFIG i2c0_sensirionSHT3X_config; +extern ADI_SENSE_CONFIG i2c0_onsemiNOA1305_config; extern ADI_SENSE_CONFIG spi0_honeywellTrustability_config; extern ADI_SENSE_CONFIG spi0_adiAdxl362_config; +extern ADI_SENSE_CONFIG spi0_adiAdxl355_config; +extern ADI_SENSE_CONFIG uart_cozirCO2_config; extern ADI_SENSE_CONFIG multichannel_continuous_config; extern ADI_SENSE_CONFIG multichannel_multicycle_config; extern ADI_SENSE_CONFIG multichannel_singlecycle_config; @@ -78,11 +104,18 @@ .alertPin = D4, .datareadyPin = D5, }, + .log = { + .txPin = PA_11, + .rxPin = PA_12, + .baudRate = 115200, + .disableLogs = false, + }, }; int main() { ADI_SENSE_RESULT res; + ADI_SENSE_STATUS status; ADI_SENSE_DEVICE_HANDLE hDevice; ADI_SENSE_MEASUREMENT_MODE eMeasurementMode = ADI_SENSE_MEASUREMENT_MODE_NORMAL; bool_t bDeviceReady; @@ -138,6 +171,20 @@ ADI_SENSE_LOG_ERROR("Failed to apply device configuration"); return res; } + /* + * Check device status after updating the configuration + */ + res = adi_sense_GetStatus(hDevice, &status); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to retrieve device status"); + return res; + } + if (status.deviceStatus & + (ADI_SENSE_DEVICE_STATUS_ERROR | ADI_SENSE_DEVICE_STATUS_ALERT)) + { + utils_printStatus(&status); + } /* * Kick off the measurement cycle here @@ -157,4 +204,3 @@ return 0; } -