Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 36:54e2418e7620, committed 2019-11-19
- Comitter:
- Vkadaba
- Date:
- Tue Nov 19 12:10:45 2019 +0000
- Parent:
- 35:cf6a5a005a58
- Commit message:
- Added open circuit detection support to host ; Added VOUT sensor support to host
Changed in this revision
diff -r cf6a5a005a58 -r 54e2418e7620 inc/admw1001/ADMW1001_REGISTERS.h --- a/inc/admw1001/ADMW1001_REGISTERS.h Tue Nov 19 11:28:40 2019 +0000 +++ b/inc/admw1001/ADMW1001_REGISTERS.h Tue Nov 19 12:10:45 2019 +0000 @@ -260,6 +260,8 @@ #define REG_CORE_ERROR_CODE 0x0000004C /* CORE Code Indicating Source of Error */ #define REG_CORE_EXTERNAL_REFERENCE_RESISTOR_RESET 0x447A0000 /* Reset Value for External_Reference_Resistor */ #define REG_CORE_EXTERNAL_REFERENCE_RESISTOR 0x00000050 /* CORE External Reference Resistor Value */ +#define REG_CORE_EXTERNAL_VOLTAGE_REFERENCE_RESET 0x3F99999A /* Reset Value for External_Voltage_Reference */ +#define REG_CORE_EXTERNAL_VOLTAGE_REFERENCE 0x00000054 /* CORE External Reference Information */ #define REG_CORE_DIAGNOSTICS_CONTROL_RESET 0x00000000 /* Reset Value for Diagnostics_Control */ #define REG_CORE_DIAGNOSTICS_CONTROL 0x0000005C /* CORE Diagnostic Control */ #define REG_CORE_DATA_FIFO_RESET 0x00000000 /* Reset Value for Data_FIFO */ @@ -853,6 +855,12 @@ #define BITM_CORE_EXTERNAL_REFERENCE_RESISTOR_EXT_REFIN1_VALUE 0xFFFFFFFF /* External Reference Resistor Value */ /* ------------------------------------------------------------------------------------------------------------------------- + CORE_EXTERNAL_VOLTAGE_REFERENCE Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_CORE_EXTERNAL_VOLTAGE_REFERENCE_EXT_REFIN2_VALUE 0 /* Reference Input Value */ +#define BITM_CORE_EXTERNAL_VOLTAGE_REFERENCE_EXT_REFIN2_VALUE 0xFFFFFFFF /* Reference Input Value */ + +/* ------------------------------------------------------------------------------------------------------------------------- CORE_DIAGNOSTICS_CONTROL Pos/Masks Description ------------------------------------------------------------------------------------------------------------------------- */ #define BITP_CORE_DIAGNOSTICS_CONTROL_DIAG_OSD_FREQ 1 /* Diagnostics Open Sensor Detect Frequency */
diff -r cf6a5a005a58 -r 54e2418e7620 inc/admw1001/ADMW1001_REGISTERS_typedefs.h --- a/inc/admw1001/ADMW1001_REGISTERS_typedefs.h Tue Nov 19 11:28:40 2019 +0000 +++ b/inc/admw1001/ADMW1001_REGISTERS_typedefs.h Tue Nov 19 12:10:45 2019 +0000 @@ -722,6 +722,25 @@ /*@}*/ +/** @defgroup External_Voltage_Reference External Reference Information (External_Voltage_Reference) Register + * External Reference Information (External_Voltage_Reference) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADMW_CORE_External_Voltage_Reference_Struct + *! \brief External Reference Information Register bit field structure + * ========================================================================== */ +typedef struct _ADMW_CORE_External_Voltage_Reference_t { + union { + struct { + float Ext_Refin2_Value; /**< Reference Input Value */ + }; + float VALUE32; + }; +} ADMW_CORE_External_Voltage_Reference_t; + +/*@}*/ /** @defgroup Diagnostics_Control Diagnostic Control (Diagnostics_Control) Register * Diagnostic Control (Diagnostics_Control) Register. * @{
diff -r cf6a5a005a58 -r 54e2418e7620 inc/admw1001/admw1001_sensor_types.h --- a/inc/admw1001/admw1001_sensor_types.h Tue Nov 19 11:28:40 2019 +0000 +++ b/inc/admw1001/admw1001_sensor_types.h Tue Nov 19 12:10:45 2019 +0000 @@ -60,12 +60,12 @@ ADMW1001_CH_ID_ANLG_1_UNIVERSAL = 0, /*!< Universal channel 1 universal channel */ ADMW1001_CH_ID_ANLG_2_UNIVERSAL, - /*!< Universal channel 2 universal channel */ + /*!< Universal channel 2 universal channel */ ADMW1001_CH_ID_ANLG_1_DIFFERENTIAL, /*!< Universal channel 1 differential channel */ ADMW1001_CH_ID_ANLG_2_DIFFERENTIAL, - /*!< Universal channel 2 differential channel */ - + /*!< Universal channel 2 differential channel */ + ADMW1001_CH_ID_DIG_I2C_0, /*!< Digital I2C Sensor channel #0 */ ADMW1001_CH_ID_DIG_I2C_1, @@ -78,7 +78,7 @@ /*!< Digital I2C Sensor channel #4 */ ADMW1001_CH_ID_DIG_I2C_5, /*!< Digital I2C Sensor channel #5 */ - + ADMW1001_CH_ID_DIG_SPI_0, /*!< Digital SPI Sensor channel #0 */ ADMW1001_CH_ID_DIG_SPI_1, @@ -88,7 +88,7 @@ ADMW1001_MAX_CHANNELS, /*!< Maximum number of measurement channels on ADMW1001 */ - + } ADMW1001_CH_ID; /*! ADMW1001 analog sensor type options @@ -103,133 +103,133 @@ typedef enum { ADMW1001_ADC_SENSOR_THERMOCOUPLE_T = 0, - /*!< Standard T-type Thermocouple temperature sensor + /*!< Standard T-type Thermocouple temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_THERMOCOUPLE_J = 1, - /*!< Standard J-type Thermocouple temperature sensor + /*!< Standard J-type Thermocouple temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_THERMOCOUPLE_K = 2, - /*!< Standard K-type Thermocouple temperature sensor + /*!< Standard K-type Thermocouple temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_THERMOCOUPLE_1 = 8, - /*!< Standard thermocouple temperature sensor + /*!< Standard thermocouple temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_THERMOCOUPLE_2 = 9, - /*!< Standard thermocouple temperature sensor + /*!< Standard thermocouple temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_THERMOCOUPLE_3 = 10, - /*!< Standard thermocouple temperature sensor + /*!< Standard thermocouple temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_THERMOCOUPLE_4 = 11, - /*!< Standard thermocouple temperature sensor + /*!< Standard thermocouple temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_2WIRE_PT100 = 32, - /*!< Standard 2-wire PT100 RTD temperature sensor + /*!< Standard 2-wire PT100 RTD temperature sensor * * @note For use with Cold-Juction Compensation and Analog Sensor channels * only */ ADMW1001_ADC_SENSOR_RTD_2WIRE_PT1000 = 33, - /*!< Standard 2-wire PT1000 RTD temperature + /*!< Standard 2-wire PT1000 RTD temperature * * @note For use with Cold-Juction Compensation and Analog Sensor channels * only */ ADMW1001_ADC_SENSOR_RTD_2WIRE_1 = 40, - /*!< 2-wire RTD temperature sensor + /*!< 2-wire RTD temperature sensor * * @note For use with Cold-Juction Compensation and Analog Sensor channels * only */ ADMW1001_ADC_SENSOR_RTD_2WIRE_2 = 41, - /*!< 2-wire RTD temperature sensor + /*!< 2-wire RTD temperature sensor * * @note For use with Cold-Juction Compensation and Analog Sensor channels * only */ ADMW1001_ADC_SENSOR_RTD_2WIRE_3 = 42, - /*!< 2-wire RTD temperature sensor + /*!< 2-wire RTD temperature sensor * * @note For use with Cold-Juction Compensation and Analog Sensor channels * only */ ADMW1001_ADC_SENSOR_RTD_2WIRE_4 = 43, - /*!< 2-wire RTD temperature sensor + /*!< 2-wire RTD temperature sensor * * @note For use with Cold-Juction Compensation and Analog Sensor channels * only */ ADMW1001_ADC_SENSOR_RTD_3WIRE_PT100 = 64, - /*!< Standard 3-wire PT100 RTD temperature sensor + /*!< Standard 3-wire PT100 RTD temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_3WIRE_PT1000 = 65, - /*!< Standard 3-wire PT1000 RTD temperature sensor + /*!< Standard 3-wire PT1000 RTD temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_3WIRE_1 = 72, - /*!< 3-wire RTD temperature sensor + /*!< 3-wire RTD temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_3WIRE_2 = 73, - /*!< 3-wire RTD temperature sensor + /*!< 3-wire RTD temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_3WIRE_3 = 74, - /*!< 3-wire RTD temperature sensor + /*!< 3-wire RTD temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_3WIRE_4 = 75, - /*!< 3-wire RTD temperature sensor + /*!< 3-wire RTD temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_4WIRE_PT100 = 96, - /*!< Standard 4-wire PT100 RTD temperature sensor + /*!< Standard 4-wire PT100 RTD temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_4WIRE_PT1000 = 97, - /*!< Standard 4-wire PT1000 RTD temperature sensor + /*!< Standard 4-wire PT1000 RTD temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_4WIRE_1 = 104, - /*!< 4-wire RTD temperature sensor + /*!< 4-wire RTD temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_4WIRE_2 = 105, - /*!< 4-wire RTD temperature sensor + /*!< 4-wire RTD temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_4WIRE_3 = 106, - /*!< 4-wire RTD temperature sensor + /*!< 4-wire RTD temperature sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_RTD_4WIRE_4 = 107, - /*!< 4-wire RTD temperature sensor + /*!< 4-wire RTD temperature sensor * * @note For use with Analog Sensor channels only */ @@ -239,12 +239,12 @@ * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_THERMISTOR_B_10K = 129, - /*!< Standard 10kOhm NTC Thermistor + /*!< Standard 10kOhm NTC Thermistor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_THERMISTOR_1 = 136, - /*!< Thermistor sensor + /*!< Thermistor sensor * * @note For use with Analog Sensor channels only */ @@ -255,65 +255,65 @@ * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_THERMISTOR_3 = 138, - /*!< Thermistor sensor + /*!< Thermistor sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_THERMISTOR_4 = 139, - /*!< Thermistor sensor + /*!< Thermistor sensor * * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_BRIDGE_4WIRE_1 = 168, - /*!< Standard 4-wire Bridge Transducer sensor + /*!< Standard 4-wire Bridge Transducer sensor * * @note For use with Analog Sensor channels only * @note Bridge Excitation Voltage must be selected as reference */ ADMW1001_ADC_SENSOR_BRIDGE_4WIRE_2 = 169, - /*!< Standard 4-wire Bridge Transducer sensor + /*!< Standard 4-wire Bridge Transducer sensor * * @note For use with Analog Sensor channels only * @note Bridge Excitation Voltage must be selected as reference */ ADMW1001_ADC_SENSOR_BRIDGE_4WIRE_3 = 170, - /*!< Standard 4-wire Bridge Transducer sensor + /*!< Standard 4-wire Bridge Transducer sensor * * @note For use with Analog Sensor channels only * @note Bridge Excitation Voltage must be selected as reference */ ADMW1001_ADC_SENSOR_BRIDGE_4WIRE_4 = 171, - /*!< Standard 4-wire Bridge Transducer sensor + /*!< Standard 4-wire Bridge Transducer sensor * * @note For use with Analog Sensor channels only * @note Bridge Excitation Voltage must be selected as reference */ ADMW1001_ADC_SENSOR_BRIDGE_6WIRE_1 = 200, - /*!< Standard 6-wire Bridge Transducer sensor + /*!< Standard 6-wire Bridge Transducer sensor * * @note For use with Analog Sensor channels only * @note Bridge Excitation Voltage must be selected as reference */ ADMW1001_ADC_SENSOR_BRIDGE_6WIRE_2 = 201, - /*!< Standard 6-wire Bridge Transducer sensor + /*!< Standard 6-wire Bridge Transducer sensor * * @note For use with Analog Sensor channels only * @note Bridge Excitation Voltage must be selected as reference */ ADMW1001_ADC_SENSOR_BRIDGE_6WIRE_3 = 202, - /*!< Standard 6-wire Bridge Transducer sensor + /*!< Standard 6-wire Bridge Transducer sensor * * @note For use with Analog Sensor channels only * @note Bridge Excitation Voltage must be selected as reference */ ADMW1001_ADC_SENSOR_BRIDGE_6WIRE_4 = 203, - /*!< Standard 6-wire Bridge Transducer sensor + /*!< Standard 6-wire Bridge Transducer sensor * * @note For use with Analog Sensor channels only * @note Bridge Excitation Voltage must be selected as reference */ ADMW1001_ADC_SENSOR_DIODE_2C_TYPEA = 224, - /*!< Standard Diode two current temperature sensor + /*!< Standard Diode two current temperature sensor * * @note For use with Analog Sensor channels only */ @@ -353,7 +353,7 @@ * @note For use with Analog Sensor channels only */ ADMW1001_ADC_SENSOR_VOLTAGE = 512, - /*!< Generic voltage sensor + /*!< Generic voltage sensor * * @note For use with Analog 0-10V Voltage Sensor channels only */ @@ -364,17 +364,17 @@ * @note For use with Analog 0-10V Voltage Sensor channels only */ ADMW1001_ADC_SENSOR_VOLTAGE_PRESSURE_B = 545, - /*!< Amphenol Pressure voltage sensor (NPA-300B-015A) + /*!< Amphenol Pressure voltage sensor (NPA-300B-015A) * * @note For use with Analog 0-10V Voltage Sensor channels only */ ADMW1001_ADC_SENSOR_VOLTAGE_PRESSURE_1 = 552, - /*!< Generic pressure voltage sensor + /*!< Generic pressure voltage sensor * * @note For use with Analog 0-10V Voltage Sensor channels only */ ADMW1001_ADC_SENSOR_VOLTAGE_PRESSURE_2 = 553, - /*!< Generic pressure voltage sensor + /*!< Generic pressure voltage sensor * * @note For use with Analog 0-10V Voltage Sensor channels only */ @@ -398,6 +398,31 @@ * * @note For use with Analog 4-20mA Current Sensor channels only */ + ADMW1001_ADC_SENSOR_CUSTOM_TEST = 576, + /*!< Test sensor for internal use + * + * @note For use with Analog 4-20mA Current Sensor channels only + */ + ADMW1001_ADC_SENSOR_SINGLE_ENDED_ABSOLUTE = 576, + /*!< Test sensor for internal use + * + * @note For use with Analog 4-20mA Current Sensor channels only + */ + ADMW1001_ADC_SENSOR_DIFFERENTIAL_ABSOLUTE = 640, + /*!< Test sensor for internal use + * + * @note For use with Analog 4-20mA Current Sensor channels only + */ + ADMW1001_ADC_SENSOR_SINGLE_ENDED_RATIO = 608, + /*!< Test sensor for internal use + * + * @note For use with Analog 4-20mA Current Sensor channels only + */ + ADMW1001_ADC_SENSOR_DIFFERENTIAL_RATIO = 672, + /*!< Test sensor for internal use + * + * @note For use with Analog 4-20mA Current Sensor channels only + */ } ADMW1001_ADC_SENSOR_TYPE; @@ -411,63 +436,63 @@ typedef enum { ADMW1001_I2C_SENSOR_HUMIDITY_A = 2112, - /*!< Honeywell HiH9000-series humidity sensor + /*!< Honeywell HiH9000-series humidity sensor * * @note For use with I2C Digital Sensor channels only */ ADMW1001_I2C_SENSOR_HUMIDITY_B = 2113, - /*!< Sensirion SHT35-DIS-B humidity sensor + /*!< Sensirion SHT35-DIS-B humidity sensor * * @note For use with I2C Digital Sensor channels only */ ADMW1001_I2C_SENSOR_HUMIDITY_C = 2114, - /*!< TE MS8607 humidity sensor + /*!< TE MS8607 humidity sensor * Note: the MS8607 is a combined Pressure & Temperature, Humidity sensor. * The humidity sensor is treated as a virtual device, i.e. standalone. * * @note For use with I2C Digital Sensor channels only */ ADMW1001_I2C_SENSOR_HUMIDITY_D = 2115, - /*!< Sensirion SCD30 humidity sensor + /*!< Sensirion SCD30 humidity sensor * Note: the SCD30 is a combined CO2, Humidity and Temperature sensor. * The humidity sensor is treated as a virtual device, i.e. standalone. * * @note For use with I2C Digital Sensor channels only */ ADMW1001_I2C_SENSOR_AMBIENTLIGHT_A = 2176, - /*!< ON-Semiconductor NOA1305 ambient light sensor + /*!< ON-Semiconductor NOA1305 ambient light sensor * * @note For use with I2C Digital Sensor channels only */ ADMW1001_I2C_SENSOR_PRESSURE_A = 2208, - /*!< TE MS8607 pressure sensor + /*!< TE MS8607 pressure sensor * Note: the MS8607 is a combined Pressure & Temperature, Humidity sensor. * The pressure sensor is treated as a virtual device, i.e. standalone. * * @note For use with I2C Digital Sensor channels only */ ADMW1001_I2C_SENSOR_TEMPERATURE_A = 2216, - /*!< TE MS8607 temperature sensor + /*!< TE MS8607 temperature sensor * Note: the MS8607 is a combined Pressure & Temperature, Humidity sensor. * The temperature sensor is treated as a virtual device, i.e. standalone. * * @note For use with I2C Digital Sensor channels only */ ADMW1001_I2C_SENSOR_TEMPERATURE_B = 2217, - /*!< Sensirion SCD30 temperature sensor + /*!< Sensirion SCD30 temperature sensor * Note: the SCD30 is a combined CO2, Humidity and Temperature sensor. * The temperature sensor is treated as a virtual device, i.e. standalone. * * @note For use with I2C Digital Sensor channels only */ ADMW1001_I2C_SENSOR_CO2_A = 2224, - /*!< Sensirion SCD30 C02 sensor + /*!< Sensirion SCD30 C02 sensor * Note: the SCD30 is a combined CO2, Humidity and Temperature sensor. * The CO2 sensor is treated as a virtual device, i.e. standalone. * * @note For use with I2C Digital Sensor channels only */ - + } ADMW1001_I2C_SENSOR_TYPE; /*! ADMW1001 SPI digital sensor type options @@ -480,7 +505,7 @@ typedef enum { ADMW1001_SPI_SENSOR_PRESSURE_A = 3072, - /*!< Honeywell HSCDRNN1.6BASA3 pressure sensor + /*!< Honeywell HSCDRNN1.6BASA3 pressure sensor * * @note For use with SPI Digital Sensor channels only */
diff -r cf6a5a005a58 -r 54e2418e7620 src/admw_1001.c --- a/src/admw_1001.c Tue Nov 19 11:28:40 2019 +0000 +++ b/src/admw_1001.c Tue Nov 19 12:10:45 2019 +0000 @@ -926,13 +926,12 @@ READ_REG_U8(hDevice, channelCountReg.VALUE8, CORE_CHANNEL_COUNTn(chId)); READ_REG_U32(hDevice, sensorDetailsReg.VALUE32, CORE_SENSOR_DETAILSn(chId)); - if (channelCountReg.Channel_Enable && !sensorDetailsReg.Do_Not_Publish) { - ADMW_CORE_Sensor_Type_t sensorTypeReg; + if (channelCountReg.Channel_Enable && !sensorDetailsReg.Do_Not_Publish) + { unsigned nActualChannels = 1; - READ_REG_U16(hDevice, sensorTypeReg.VALUE16, CORE_SENSOR_TYPEn(chId)); - - if (chId == ADMW1001_CH_ID_DIG_SPI_0) { + if (chId == ADMW1001_CH_ID_DIG_SPI_0) + { /* Some sensors automatically generate samples on additional * "virtual" channels so these channels must be counted as * active when those sensors are selected and we use the count @@ -941,10 +940,15 @@ #if 0 /* SPI sensors arent supported at present to be added back once there is * support for these sensors */ + ADMW_CORE_Sensor_Type_t sensorTypeReg; + + READ_REG_U16(hDevice, sensorTypeReg.VALUE16, CORE_SENSOR_TYPEn(chId)); + if ((sensorTypeReg.Sensor_Type >= - CORE_SENSOR_TYPE_SPI_ACCELEROMETER_A) && - (sensorTypeReg.Sensor_Type <= - CORE_SENSOR_TYPE_SPI_ACCELEROMETER_B)) { + CORE_SENSOR_TYPE_SPI_ACCELEROMETER_A) && + (sensorTypeReg.Sensor_Type <= + CORE_SENSOR_TYPE_SPI_ACCELEROMETER_B)) + { nActualChannels += 2; } #endif @@ -1102,6 +1106,14 @@ return ADMW_SUCCESS; } +static ADMW_RESULT admw_SetExternalReferenceVoltage( + ADMW_DEVICE_HANDLE hDevice, + float32_t externalRefVoltage) +{ + WRITE_REG_FLOAT(hDevice, externalRefVoltage, CORE_EXTERNAL_VOLTAGE_REFERENCE); + + return ADMW_SUCCESS; +} static ADMW_RESULT admw_SetExternalReferenceValues( ADMW_DEVICE_HANDLE hDevice, @@ -1149,10 +1161,54 @@ ADMW_LOG_ERROR("Failed to set RSenseValue"); return eRet; } + + eRet = admw_SetExternalReferenceVoltage(hDevice, pMeasConfig->externalRefVoltage); + if (eRet != ADMW_SUCCESS) + { + ADMW_LOG_ERROR("Failed to set External reference Voltage"); + return eRet; + } + return ADMW_SUCCESS; } +ADMW_RESULT admw1001_SetDiagnosticsConfig( + ADMW_DEVICE_HANDLE hDevice, + ADMW1001_DIAGNOSTICS_CONFIG *pDiagnosticsConfig) +{ + ADMW_CORE_Diagnostics_Control_t diagnosticsControlReg; + diagnosticsControlReg.VALUE8 = REG_RESET_VAL(CORE_DIAGNOSTICS_CONTROL); + + if (pDiagnosticsConfig->disableMeasurementDiag) + diagnosticsControlReg.Diag_Meas_En = 0; + else + diagnosticsControlReg.Diag_Meas_En = 1; + + switch (pDiagnosticsConfig->osdFrequency) + { + case ADMW1001_OPEN_SENSOR_DIAGNOSTICS_DISABLED: + diagnosticsControlReg.Diag_OSD_Freq = CORE_DIAGNOSTICS_CONTROL_OCD_OFF; + break; + case ADMW1001_OPEN_SENSOR_DIAGNOSTICS_PER_CYCLE: + diagnosticsControlReg.Diag_OSD_Freq = CORE_DIAGNOSTICS_CONTROL_OCD_PER_1_CYCLE; + break; + case ADMW1001_OPEN_SENSOR_DIAGNOSTICS_PER_100_CYCLES: + diagnosticsControlReg.Diag_OSD_Freq = CORE_DIAGNOSTICS_CONTROL_OCD_PER_10_CYCLES; + break; + case ADMW1001_OPEN_SENSOR_DIAGNOSTICS_PER_1000_CYCLES: + diagnosticsControlReg.Diag_OSD_Freq = CORE_DIAGNOSTICS_CONTROL_OCD_PER_100_CYCLES; + break; + default: + ADMW_LOG_ERROR("Invalid open-sensor diagnostic frequency %d specified", + pDiagnosticsConfig->osdFrequency); + return ADMW_INVALID_PARAM; + } + + WRITE_REG_U8(hDevice, diagnosticsControlReg.VALUE8, CORE_DIAGNOSTICS_CONTROL); + + return ADMW_SUCCESS; +} ADMW_RESULT admw1001_SetChannelCount( ADMW_DEVICE_HANDLE hDevice, @@ -1262,8 +1318,13 @@ case ADMW1001_ADC_SENSOR_THERMISTOR_2: case ADMW1001_ADC_SENSOR_THERMISTOR_3: case ADMW1001_ADC_SENSOR_THERMISTOR_4: + case ADMW1001_ADC_SENSOR_SINGLE_ENDED_ABSOLUTE: + case ADMW1001_ADC_SENSOR_DIFFERENTIAL_ABSOLUTE: + case ADMW1001_ADC_SENSOR_SINGLE_ENDED_RATIO: + case ADMW1001_ADC_SENSOR_DIFFERENTIAL_RATIO: if (! (ADMW1001_CHANNEL_IS_ADC_SENSOR(eChannelId) || - ADMW1001_CHANNEL_IS_ADC_CJC(eChannelId))) { + ADMW1001_CHANNEL_IS_ADC_CJC(eChannelId) || ADMW1001_CHANNEL_IS_ADC(eChannelId) )) + { ADMW_LOG_ERROR( "Invalid ADC sensor type %d specified for channel %d", sensorType, eChannelId); @@ -2204,12 +2265,12 @@ return eRet; } -// eRet = admw1001_SetDiagnosticsConfig(hDevice, &pDeviceConfig->diagnostics); -// if (eRet) -// { -// ADMW_LOG_ERROR("Failed to set diagnostics configuration"); -// return eRet; -// } + eRet = admw1001_SetDiagnosticsConfig(hDevice, &pDeviceConfig->diagnostics); + if (eRet) + { + ADMW_LOG_ERROR("Failed to set diagnostics configuration"); + return eRet; + } for (ADMW1001_CH_ID id = ADMW1001_CH_ID_ANLG_1_UNIVERSAL; id < ADMW1001_MAX_CHANNELS;