Code clean up and handling FIFO errors

Committer:
Vkadaba
Date:
Mon Apr 20 06:23:42 2020 +0000
Revision:
69:4305ac772a66
Parent:
23:bb685f35b08b
Break if FIFO error is read

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vkadaba 15:b5d57daeb7c0 1 /*
Vkadaba 15:b5d57daeb7c0 2 Copyright 2019 (c) Analog Devices, Inc.
Vkadaba 15:b5d57daeb7c0 3
Vkadaba 15:b5d57daeb7c0 4 All rights reserved.
Vkadaba 15:b5d57daeb7c0 5
Vkadaba 15:b5d57daeb7c0 6 Redistribution and use in source and binary forms, with or without
Vkadaba 15:b5d57daeb7c0 7 modification, are permitted provided that the following conditions are met:
Vkadaba 15:b5d57daeb7c0 8 - Redistributions of source code must retain the above copyright
Vkadaba 15:b5d57daeb7c0 9 notice, this list of conditions and the following disclaimer.
Vkadaba 15:b5d57daeb7c0 10 - Redistributions in binary form must reproduce the above copyright
Vkadaba 15:b5d57daeb7c0 11 notice, this list of conditions and the following disclaimer in
Vkadaba 15:b5d57daeb7c0 12 the documentation and/or other materials provided with the
Vkadaba 15:b5d57daeb7c0 13 distribution.
Vkadaba 15:b5d57daeb7c0 14 - Neither the name of Analog Devices, Inc. nor the names of its
Vkadaba 15:b5d57daeb7c0 15 contributors may be used to endorse or promote products derived
Vkadaba 15:b5d57daeb7c0 16 from this software without specific prior written permission.
Vkadaba 15:b5d57daeb7c0 17 - The use of this software may or may not infringe the patent rights
Vkadaba 15:b5d57daeb7c0 18 of one or more patent holders. This license does not release you
Vkadaba 15:b5d57daeb7c0 19 from the requirement that you obtain separate licenses from these
Vkadaba 15:b5d57daeb7c0 20 patent holders to use this software.
Vkadaba 15:b5d57daeb7c0 21 - Use of the software either in source or binary form, must be run
Vkadaba 15:b5d57daeb7c0 22 on or directly connected to an Analog Devices Inc. component.
Vkadaba 15:b5d57daeb7c0 23
Vkadaba 15:b5d57daeb7c0 24 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
Vkadaba 15:b5d57daeb7c0 25 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
Vkadaba 15:b5d57daeb7c0 26 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Vkadaba 15:b5d57daeb7c0 27 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
Vkadaba 15:b5d57daeb7c0 28 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Vkadaba 15:b5d57daeb7c0 29 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
Vkadaba 15:b5d57daeb7c0 30 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Vkadaba 15:b5d57daeb7c0 31 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Vkadaba 15:b5d57daeb7c0 32 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Vkadaba 15:b5d57daeb7c0 33 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Vkadaba 15:b5d57daeb7c0 34 */
Vkadaba 15:b5d57daeb7c0 35
Vkadaba 15:b5d57daeb7c0 36 /*!
Vkadaba 15:b5d57daeb7c0 37 ******************************************************************************
Vkadaba 15:b5d57daeb7c0 38 * @file: utils.h
Vkadaba 15:b5d57daeb7c0 39 * @brief: Interface Utilities for ADMW1001
Vkadaba 15:b5d57daeb7c0 40 *-----------------------------------------------------------------------------
Vkadaba 15:b5d57daeb7c0 41 */
ADIJake 0:85855ecd3257 42 #ifndef __UTILS_H__
ADIJake 0:85855ecd3257 43 #define __UTILS_H__
ADIJake 0:85855ecd3257 44
Vkadaba 5:0728bde67bdb 45 #include "admw_api.h"
Vkadaba 5:0728bde67bdb 46 #include "admw1001/admw1001_api.h"
ADIJake 0:85855ecd3257 47
ADIJake 0:85855ecd3257 48 #ifdef __cplusplus
ADIJake 0:85855ecd3257 49 extern "C" {
ADIJake 0:85855ecd3257 50 #endif
ADIJake 0:85855ecd3257 51
Vkadaba 19:09d58952b65d 52 /* Utility function to print the status read from the ADMW1001 device */
ADIJake 0:85855ecd3257 53 void utils_printStatus(
Vkadaba 5:0728bde67bdb 54 ADMW_STATUS *pStatus);
ADIJake 0:85855ecd3257 55
Vkadaba 19:09d58952b65d 56 /* Utility function to print data samples read from the ADMW1001 device */
ADIJake 0:85855ecd3257 57 void utils_printSamples(
Vkadaba 5:0728bde67bdb 58 ADMW_DATA_SAMPLE *pSampleBuffer,
ADIJake 0:85855ecd3257 59 uint32_t nNumSamples,
Vkadaba 5:0728bde67bdb 60 ADMW_MEASUREMENT_MODE eMeasurementMode);
ADIJake 0:85855ecd3257 61
Vkadaba 19:09d58952b65d 62 /* Utility function to register callbacks for ADMW1001 device notification signals */
Vkadaba 5:0728bde67bdb 63 ADMW_RESULT utils_registerCallbacks(
Vkadaba 5:0728bde67bdb 64 ADMW_DEVICE_HANDLE hDevice,
ADIJake 0:85855ecd3257 65 volatile bool *pbDataReady,
ADIJake 0:85855ecd3257 66 volatile bool *pbError,
ADIJake 0:85855ecd3257 67 volatile bool *pbAlert);
ADIJake 0:85855ecd3257 68
Vkadaba 19:09d58952b65d 69 /* Utility function to de-register callbacks for ADMW1001 device notification signals */
Vkadaba 5:0728bde67bdb 70 ADMW_RESULT utils_deregisterCallbacks(
Vkadaba 5:0728bde67bdb 71 ADMW_DEVICE_HANDLE hDevice);
ADIJake 0:85855ecd3257 72
Vkadaba 19:09d58952b65d 73 /* Utility function to run measurements on ADMW1001 device, according to its current
ADIJake 0:85855ecd3257 74 * configuration, and display data samples and device status following each cycle */
Vkadaba 5:0728bde67bdb 75 ADMW_RESULT utils_runMeasurement(
Vkadaba 5:0728bde67bdb 76 ADMW_DEVICE_HANDLE hDevice,
Vkadaba 5:0728bde67bdb 77 ADMW_MEASUREMENT_MODE eMeasurementMode);
Vkadaba 23:bb685f35b08b 78
Vkadaba 19:09d58952b65d 79 /* Utility function to retrieve and print the factory calibration coefficients table from the ADMW1001 device */
Vkadaba 5:0728bde67bdb 80 ADMW_RESULT utils_printCalTable(
Vkadaba 5:0728bde67bdb 81 ADMW_DEVICE_HANDLE hDevice);
ADIJake 0:85855ecd3257 82
ADIJake 0:85855ecd3257 83 #ifdef __cplusplus
ADIJake 0:85855ecd3257 84 }
ADIJake 0:85855ecd3257 85 #endif
ADIJake 0:85855ecd3257 86
ADIJake 0:85855ecd3257 87 #endif /* __UTILS_H__ */
ADIJake 0:85855ecd3257 88