Vybhav Kadaba
/
EV-PRO-MW1001_Development_updateFW
Bumped Mbed FW version to 01.20.0080
Diff: src/admw_1001.c
- Revision:
- 33:df7a00f1b8e1
- Parent:
- 32:52445bef314d
- Child:
- 36:54e2418e7620
--- a/src/admw_1001.c Fri Oct 25 05:08:19 2019 +0000 +++ b/src/admw_1001.c Thu Nov 14 05:35:08 2019 +0000 @@ -1030,6 +1030,19 @@ return ADMW_SUCCESS; } +static ADMW_RESULT admw_SetRSenseValue( + ADMW_DEVICE_HANDLE hDevice, + float32_t RSenseValue) +{ + ADMW_CORE_External_Reference_Resistor_t RefResistorConfigReg; + + RefResistorConfigReg.Ext_Refin1_Value = RSenseValue; + + WRITE_REG_FLOAT(hDevice, RefResistorConfigReg.VALUE32, CORE_EXTERNAL_REFERENCE_RESISTOR); + + return ADMW_SUCCESS; + +} static ADMW_RESULT admw_SetMode( ADMW_DEVICE_HANDLE hDevice, ADMW1001_OPERATING_MODE eOperatingMode, @@ -1130,6 +1143,12 @@ return eRet; } + eRet = admw_SetRSenseValue(hDevice, pMeasConfig->RSenseValue); + if (eRet != ADMW_SUCCESS) + { + ADMW_LOG_ERROR("Failed to set RSenseValue"); + return eRet; + } return ADMW_SUCCESS; } @@ -1428,14 +1447,17 @@ return ADMW_SUCCESS; } -static ADMW_RESULT admw_SetChannelAdcFilter( +static ADMW_RESULT admw_SetChannelAdcMeasurementSetup( ADMW_DEVICE_HANDLE hDevice, ADMW1001_CH_ID eChannelId, - ADMW1001_ADC_FILTER_CONFIG *pFilterConfig) + ADMW1001_ADC_CHANNEL_CONFIG *pAdcChannelConfig) { ADMW_CORE_Measurement_Setup_t MeasSetupReg; + ADMW1001_ADC_FILTER_CONFIG *pFilterConfig = &pAdcChannelConfig->filter; MeasSetupReg.VALUE32 = REG_RESET_VAL(CORE_MEASUREMENT_SETUPn); - + MeasSetupReg.PST_MEAS_EXC_CTRL = pAdcChannelConfig->current.excitationState; + MeasSetupReg.Buffer_Bypass = pAdcChannelConfig->bufferBypass; + if (pFilterConfig->type == ADMW1001_ADC_FILTER_SINC4) { MeasSetupReg.ADC_Filter_Type = CORE_MEASUREMENT_SETUP_ENABLE_SINC4; MeasSetupReg.ADC_SF = pFilterConfig->sf; @@ -1533,8 +1555,8 @@ return eRet; } - eRet = admw_SetChannelAdcFilter(hDevice, eChannelId, - &pAdcChannelConfig->filter); + eRet = admw_SetChannelAdcMeasurementSetup(hDevice, eChannelId, + pAdcChannelConfig); if (eRet != ADMW_SUCCESS) { ADMW_LOG_ERROR("Failed to set ADC filter for channel %d", eChannelId);