ADMW1001_Beta_Release
/
EV-PRO-MW1001_initialCommit
initial commit
Diff: main.cpp
- Revision:
- 54:31921ad29828
- Parent:
- 53:644c5f6300da
- Child:
- 55:215da406282b
--- a/main.cpp Wed Feb 19 09:09:59 2020 +0000 +++ b/main.cpp Wed Feb 19 10:08:13 2020 +0000 @@ -45,7 +45,10 @@ #include "admw_log.h" #include "common/utils.h" #include "common/platform.h" +#include "admw1001/ADMW1001_REGISTERS_typedefs.h" #include "admw1001/ADMW1001_REGISTERS.h" +#include "admw1001/admw1001_lut_data.h" +#include "admw1001/admw1001_host_comms.h" extern ADMW_CONFIG thermocouple_typeK_cjc0_config; extern ADMW_CONFIG thermocouple_typeT_cjc0_config; @@ -60,7 +63,12 @@ extern ADMW_CONFIG measureware_config; /* Change the following pointer to load or change the configurations */ -static ADMW_CONFIG *pSelectedConfig = &thermocouple_typeK_cjc0_config; +static ADMW_CONFIG *pSelectedConfig = &bridge_4w_load_cell_config; + +/* use the following to load LUT */ +extern ADMW1001_LUT_DESCRIPTOR *lut_desc_list[]; +extern ADMW1001_LUT_TABLE_DATA *lut_data_list[]; +extern unsigned lut_num_tables; static ADMW_CONNECTION connectionInfo = PLATFORM_CONNECTION_INFO; @@ -114,6 +122,28 @@ ADMW_LOG_ERROR("Failed to set device configuration"); return res; } + unsigned lutBufferSize = ADMW_LUT_MAX_SIZE; + ADMW1001_LUT *pLutBuffer = (ADMW1001_LUT *) malloc(lutBufferSize); + if (pLutBuffer == NULL) { + return 1; + } + + res=admw1001_AssembleLutData(pLutBuffer, lutBufferSize, + lut_num_tables, + lut_desc_list, + lut_data_list); + if( res != ADMW_SUCCESS ) { + ADMW_LOG_ERROR("Failed to assemble user-defined LUT data"); + return res; + } + + res=admw1001_SetLutData(hDevice, + pLutBuffer); + if( res != ADMW_SUCCESS ) { + ADMW_LOG_ERROR("Failed to set user-defined LUT data"); + } + + free( pLutBuffer ); res = admw_ApplyConfigUpdates(hDevice); if (res != ADMW_SUCCESS) { ADMW_LOG_ERROR("Failed to apply device configuration");