Vybhav Kadaba
/
EV-PRO-MW1001_Development_code_cleanup2
Code clean up, removed unwanted enums and configurations
Diff: inc/admw1001/admw1001_config.h
- Revision:
- 34:b60ee1e0af2b
- Parent:
- 33:df7a00f1b8e1
- Child:
- 43:e1789b7214cf
--- a/inc/admw1001/admw1001_config.h Thu Nov 14 05:35:08 2019 +0000 +++ b/inc/admw1001/admw1001_config.h Tue Nov 19 11:17:35 2019 +0000 @@ -58,8 +58,7 @@ #define ADMW1001_SENSOR_COMMAND_MAX_LENGTH 7 /*! ADMW1001 channel priority options */ -typedef enum -{ +typedef enum { ADMW1001_CHANNEL_PRIORITY_0 = 0, ADMW1001_CHANNEL_PRIORITY_1, ADMW1001_CHANNEL_PRIORITY_2, @@ -80,8 +79,7 @@ } ADMW1001_CHANNEL_PRIORITY; /*! ADMW1001 operating mode options */ -typedef enum -{ +typedef enum { ADMW1001_OPERATING_MODE_SINGLECYCLE = 0, /*!< Executes a single measurement cycle and stops */ ADMW1001_OPERATING_MODE_CONTINUOUS, @@ -92,8 +90,7 @@ } ADMW1001_OPERATING_MODE; /*! ADMW1001 data ready mode options */ -typedef enum -{ +typedef enum { ADMW1001_DATAREADY_PER_CONVERSION = 0, /*!< The DATAREADY signal is asserted after completion of each conversion * - a single data sample only from the latest completed conversion is @@ -114,8 +111,7 @@ } ADMW1001_DATAREADY_MODE; /*! ADMW1001 power mode options */ -typedef enum -{ +typedef enum { ADMW1001_POWER_MODE_HIBERNATION = 0, /*!< module has entede hibernation mode. All analog circuitry is disabled. All peripherals disabled apart from the Wake-up pin functionality. */ ADMW1001_POWER_MODE_ACTIVE, @@ -124,8 +120,7 @@ } ADMW1001_POWER_MODE; /*! ADMW1001 measurement analog filter settling options */ -typedef enum -{ +typedef enum { ADMW1001_FILTER_SETTLING_ALWAYS = 0, /*!< Allow full settling time to elapse between every measurement from an analog sensor */ ADMW1001_FILTER_SETTLING_FAST, @@ -138,8 +133,7 @@ * Optionally select a measurement unit for final conversion results. * Currently applicable only to specific temperature sensor types. */ -typedef enum -{ +typedef enum { ADMW1001_MEASUREMENT_UNIT_UNSPECIFIED = 0, /*!< No measurement unit specified */ ADMW1001_MEASUREMENT_UNIT_CELSIUS, @@ -159,8 +153,7 @@ * @note Open-sensor diagnostic checks, when performed, will add a delay to the * start of the next measurement cycle. */ -typedef enum -{ +typedef enum { ADMW1001_OPEN_SENSOR_DIAGNOSTICS_DISABLED = 0, /*!< No Open-Sensor Detection is performed */ ADMW1001_OPEN_SENSOR_DIAGNOSTICS_PER_CYCLE, @@ -173,21 +166,19 @@ } ADMW1001_OPEN_SENSOR_DIAGNOSTICS; -typedef enum -{ +typedef enum { ADMW1001_BUFFER_BYPASSS_DISABLED = 0, /*!< Buffer Bypass Disabled */ ADMW1001_BUFFER_BYPASSS_ENABLED, /*!< Buffer Bypass Enabled */ - + } ADMW1001_BUFFER_BYPASSS; /*! ADMW1001 analog input signal amplification gain options * * @note applicable only to ADC analog sensor channels */ -typedef enum -{ +typedef enum { ADMW1001_ADC_RTD_CURVE_EUROPEAN = 0, /*!< EUROPEAN RTD curve used. */ ADMW1001_ADC_RTD_CURVE_AMERICAN, @@ -202,8 +193,7 @@ * * @note applicable only to ADC analog sensor channels */ -typedef enum -{ +typedef enum { ADMW1001_ADC_GAIN_1X = 0, /*!< no amplification gain */ ADMW1001_ADC_GAIN_2X, @@ -228,8 +218,7 @@ * @note applicable only to ADC analog sensor channels, and * specific sensor types */ -typedef enum -{ +typedef enum { ADMW1001_ADC_EXC_STATE_CYCLE_POWER=0, /*!< Excitation for measurement is active only during measurement */ ADMW1001_ADC_EXC_STATE_ALWAYS_ON, @@ -241,12 +230,11 @@ * @note applicable only to ADC analog sensor channels, and * specific sensor types */ -typedef enum -{ +typedef enum { ADMW1001_ADC_NO_EXTERNAL_EXC_CURRENT = -1, - /*!< NO External excitation is provided */ + /*!< NO External excitation is provided */ ADMW1001_ADC_EXC_CURRENT_EXTERNAL = 0, - /*!< External excitation is provided */ + /*!< External excitation is provided */ ADMW1001_ADC_EXC_CURRENT_50uA, /*!< 50uA excitation current enabled */ ADMW1001_ADC_EXC_CURRENT_100uA, @@ -264,21 +252,20 @@ * * @note applicable only to a diode sensor */ -typedef enum -{ - ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_10UA_100UA = 0, +typedef enum { + ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_10UA_100UA = 0, /**< 2 Current measurement 10uA 100uA */ - ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_20UA_160UA, + ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_20UA_160UA, /**< 2 Current measurement 20uA 160uA */ - ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_50UA_300UA, + ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_50UA_300UA, /**< 2 Current measurement 50uA 300uA */ - ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_100UA_600UA, + ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_100UA_600UA, /**< 2 Current measurement 100uA 600uA */ - ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_10UA_50UA_100UA, + ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_10UA_50UA_100UA, /**< 3 current measuremetn 10uA 50uA 100uA */ - ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_20UA_100UA_160UA, + ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_20UA_100UA_160UA, /**< 3 current measuremetn 20uA 100uA 160uA */ - ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_50UA_150UA_300UA, + ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_50UA_150UA_300UA, /**< 3 current measuremetn 50uA 150uA 300uA */ ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_100UA_300UA_600UA, /**< 3 current measuremetn 100uA 300uA 600uA */ @@ -290,8 +277,7 @@ * @note applicable only to ADC analog sensor channels, and * specific sensor types */ -typedef enum -{ +typedef enum { ADMW1001_ADC_REFERENCE_VOLTAGE_INTERNAL = 0, /*!< Internal VRef - 1.2V */ ADMW1001_ADC_REFERENCE_VOLTAGE_EXTERNAL_1, @@ -307,8 +293,7 @@ * * @note applicable only to ADC analog sensor channels */ -typedef enum -{ +typedef enum { ADMW1001_ADC_GND_SW_OPEN = 0, /*!< Ground switch not enabled for measurement. */ ADMW1001_ADC_GND_SW_CLOSED, @@ -320,8 +305,7 @@ * * @note applicable only to ADC analog sensor channels */ -typedef enum -{ +typedef enum { ADMW1001_CHOP_MD_NONE = 0, /*!< No chop performed. */ ADMW1001_CHOP_MD_HW, @@ -330,15 +314,14 @@ /*!< Software only chop performed. */ ADMW1001_CHOP_MD_HWSW, /*!< Hardware and software chop performed. */ - + } ADMW1001_CHOP_MD; /*! ADMW1001 analog filter selection options * * @note applicable only to ADC analog sensor channels */ -typedef enum -{ +typedef enum { ADMW1001_ADC_FILTER_SINC4 = 0, /*!< SINC4 - 4th order sinc response filter */ ADMW1001_ADC_FILTER_SINC3, @@ -349,11 +332,10 @@ /*! ADMW1001 Sinc Filter range (SF) * * @note applicable only to ADC analog sensor channels - * @note SF must be set in conjunction with chop mode + * @note SF must be set in conjunction with chop mode * and sinc filter type to achieve the desired sampling rate. */ -typedef enum -{ +typedef enum { ADMW1001_SF_976HZ = 0, /*!< SF setting for 976Hz sample rate. */ ADMW1001_SF_488HZ = 1, @@ -379,8 +361,7 @@ * * @note applicable only for I2C sensors */ -typedef enum -{ +typedef enum { ADMW1001_DIGITAL_SENSOR_COMMS_I2C_CLOCK_SPEED_100K = 0, /*!< 100kHz I2C clock speed */ ADMW1001_DIGITAL_SENSOR_COMMS_I2C_CLOCK_SPEED_400K, @@ -392,8 +373,7 @@ * * @note applicable only for SPI sensors */ -typedef enum -{ +typedef enum { ADMW1001_DIGITAL_SENSOR_COMMS_SPI_MODE_0 = 0, /*!< SPI mode 0 Clock Polarity = 0 Clock Phase = 0 */ ADMW1001_DIGITAL_SENSOR_COMMS_SPI_MODE_1, @@ -409,8 +389,7 @@ * * @note applicable only for SPI sensors */ -typedef enum -{ +typedef enum { ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_8MHZ = 0, /*!< SPI Clock Speed configured to 8MHz */ ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_4MHZ, @@ -447,8 +426,7 @@ } ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK; /*! ADMW1001 Power Configuration options */ -typedef struct -{ +typedef struct { ADMW1001_POWER_MODE powerMode; /*!< Power mode selection */ @@ -459,8 +437,7 @@ * @note required only when ADMW1001_OPERATING_MODE_MULTICYCLE is selected * as the operatingMode (@ref ADMW1001_MEASUREMENT_CONFIG) */ -typedef struct -{ +typedef struct { uint32_t cyclesPerBurst; /*!< Number of cycles to complete for a single burst */ uint32_t burstInterval; @@ -469,8 +446,7 @@ } ADMW1001_MULTICYCLE_CONFIG; /*! ADMW1001 Measurement Configuration options */ -typedef struct -{ +typedef struct { ADMW1001_OPERATING_MODE operatingMode; /*!< Operating mode - specifies how measurement cycles are scheduled */ ADMW1001_DATAREADY_MODE dataReadyMode; @@ -489,7 +465,7 @@ */ uint8_t reserved0[3]; /*!< Reserved for future use and ensure word alignment. - */ + */ uint32_t cycleInterval; /*!< Cycle interval - specifies the time interval between the start of each * successive measurement cycle. Applicable only when operatingMode is @@ -503,12 +479,13 @@ * Applicable only if the selected reference type is * voltage. * (see @ref ADMW1001_ADC_REFERENCE_TYPE) - */ + */ float32_t RSenseValue; - /*!< Sense resistor value in Ohms. */ - uint32_t reserved1[3]; - /*!< Reserved for future use and ensure word alignment. - */ + /*!< Sense resistor value in Ohms. */ + float32_t externalRefVoltage; + /*!< External Reference Voltage. + */ + uint32_t reserved1[2]; } ADMW1001_MEASUREMENT_CONFIG; @@ -517,8 +494,7 @@ * @note applicable only to ADC analog sensor channels, and * specific sensor types */ -typedef struct -{ +typedef struct { ADMW1001_ADC_EXC_STATE excitationState; /*!< Excitation current state */ ADMW1001_ADC_EXC_CURRENT outputLevel; @@ -532,8 +508,7 @@ * * @note applicable only to ADC analog sensor channels */ -typedef struct -{ +typedef struct { ADMW1001_ADC_FILTER_TYPE type; /*!< Filter type selection */ ADMW1001_SINC_FILTER_RANGE sf; @@ -551,8 +526,7 @@ * * @note applicable only to ADC analog sensor channels */ -typedef struct -{ +typedef struct { ADMW1001_ADC_SENSOR_TYPE sensor; /*!< Sensor type selection */ ADMW1001_ADC_RTD_CURVE rtdCurve; @@ -567,7 +541,7 @@ bool vBiasEnable; /*!< ADC Reference configuration */ uint8_t bufferBypass; - /*!< Buffer Bypass configuration */ + /*!< Buffer Bypass configuration */ uint8_t reserved0[2]; /*!< Reserved for future use and ensure word alignment. */ uint32_t reserved1[6]; @@ -578,8 +552,7 @@ /*! ADMW1001 look-up table selection * Select table used to linearise the measurement. */ -typedef enum -{ +typedef enum { ADMW1001_LUT_DEFAULT = 0, /*!< Default LUT */ ADMW1001_LUT_UNITY = 1, @@ -588,15 +561,14 @@ /*!< User defined custom LUT */ ADMW1001_LUT_RESERVED = 3, /*!< Reserved for future use */ - + } ADMW1001_LUT_SELECT; /*! ADMW1001 digital sensor data encoding * * @note applicable only to SPI and I2C digital sensor channels */ -typedef enum -{ +typedef enum { ADMW1001_DIGITAL_SENSOR_DATA_CODING_NONE = 0, /**< None/Invalid - data format is ignored if coding is set to this value */ ADMW1001_DIGITAL_SENSOR_DATA_CODING_UNIPOLAR, @@ -613,8 +585,7 @@ * * @note applicable only to SPI and I2C digital sensor channels */ -typedef struct -{ +typedef struct { ADMW1001_DIGITAL_SENSOR_DATA_CODING coding; /**< Data Encoding of Sensor Result */ bool littleEndian; @@ -636,8 +607,7 @@ * * @note applicable only to SPI and I2C digital sensor channels */ -typedef struct -{ +typedef struct { uint8_t command[ADMW1001_SENSOR_COMMAND_MAX_LENGTH]; /*!< Optional command bytes to send to the device */ uint8_t commandLength; @@ -649,8 +619,7 @@ * * @note applicable only to digital sensor channels */ -typedef struct -{ +typedef struct { uint32_t calibrationParam; /*!< Independently established environmental variable used during calibration * of a digital sensor. Used only if the sensor supports calibration @@ -667,8 +636,7 @@ * * @note applicable only to digital sensor channels */ -typedef struct -{ +typedef struct { bool useCustomCommsConfig; /*!< Optional parameter to enable user digital communication settings */ ADMW1001_DIGITAL_SENSOR_COMMS_I2C_CLOCK_SPEED i2cClockSpeed; @@ -684,8 +652,7 @@ * * @note applicable only to I2C digital sensor channels */ -typedef struct -{ +typedef struct { ADMW1001_I2C_SENSOR_TYPE sensor; /*!< Sensor type selection */ uint8_t deviceAddress; @@ -726,12 +693,11 @@ * * @note applicable only to SPI digital sensor channels */ -typedef struct -{ +typedef struct { ADMW1001_SPI_SENSOR_TYPE sensor; /*!< Sensor type selection */ uint8_t reserved[2]; - /*!< Reserved for future use and ensure word alignment. */ + /*!< Reserved for future use and ensure word alignment. */ ADMW1001_DIGITAL_SENSOR_COMMAND configurationCommand; /*!< Optional configuration command to send to the device at start-up. * A default configuration command will be used if this is not specified. @@ -763,8 +729,7 @@ } ADMW1001_SPI_CHANNEL_CONFIG; /*! ADMW1001 Measurement Channel configuration details */ -typedef struct -{ +typedef struct { bool enableChannel; /*!< Option to include this channel in normal measurement cycles */ bool disablePublishing; @@ -841,8 +806,7 @@ * ID. Lower numbers indicate higher priority, with 0 being the highest. * Set to 0 if not required. */ - union - { + union { ADMW1001_ADC_CHANNEL_CONFIG adcChannelConfig; /*!< ADC channel configuration - applicable only to ADC channels */ ADMW1001_I2C_CHANNEL_CONFIG i2cChannelConfig; @@ -858,8 +822,7 @@ } ADMW1001_CHANNEL_CONFIG; /*! ADMW1001 Diagnostics configuration details */ -typedef struct -{ +typedef struct { bool disableGlobalDiag; /*!< Option to disable the following diagnostic checks on the ADC: * - Reference Detection errors @@ -884,8 +847,7 @@ typedef uint16_t ADMW1001_ADVANCED_ACCESS_KEY; /*! ADMW1001 Device configuration details */ -typedef struct -{ +typedef struct { ADMW1001_POWER_CONFIG power; /*!< Power configuration details */ ADMW1001_MEASUREMENT_CONFIG measurement;