Example program for EVAL-ADMX2001
Dependencies: ADMX2001
Diff: main.cpp
- Revision:
- 5:746e78113d7d
- Parent:
- 4:e7e194f58f65
- Child:
- 8:bd0b93e35392
--- a/main.cpp Thu Oct 07 09:37:15 2021 +0000 +++ b/main.cpp Wed Oct 27 06:58:57 2021 +0000 @@ -1,4 +1,4 @@ -/* Copyright (c) 2019 Analog Devices, Inc. All rights reserved. +/* Copyright (c) 2021 Analog Devices, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -32,14 +32,20 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -2019-01-10-7CBSD SLA +2021-01-10-7CBSD SLA +*/ /*============= I N C L U D E S =============*/ #include "ADMX2001.h" +#include "ADMX2001_commands.h" #include "platform_drivers.h" #include "app_config.h" #include "spi_extra.h" +#include "message.h" +#include "gpio_config.h" +#include "measure.h" +#include "calibrate.h" #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -73,10 +79,33 @@ return status; } +/** + * @brief Measures Impedance + * \ref CmdZ + */ +int32_t CmdZ() +{ + int32_t status = ADMX_STATUS_SUCCESS; + + status = TriggerAndMeasure(); + + PrintMeasureStatusMessage(status); + + if (status != ADMX_STATUS_SUCCESS) + { + status = ADMX_STATUS_FAILED; + } + + return status; +} + int main() { int32_t status = 0; static spi_desc spiDesc; + float stdLoad = 51; + float Xt = 0; + CAL_TYPE calType; spi_desc *pSpi = &spiDesc; Admx200xDev *pADmx2001 = &admx200xDev; status |= SPIInit(&pSpi); @@ -91,6 +120,17 @@ } else { + printf("Setting test load to 1k ohms\r\n"); + EnableMuxLine(2); + printf("Starting measurement commands\r\n"); + CmdZ(); + printf("Measurement completed\r\n"); + printf("Setting test load to short\r\n"); + EnableMuxLine(0); + printf("Starting Calibration\r\n"); + calType = CAL_TYPE_OPEN; + status = Calibrate(calType, stdLoad, Xt); + printf("Calibration completed\r\n"); } status = spi_remove(pSpi);