Vybhav Kadaba
/
EV-PRO-MW1001_Development_code_cleanup2
Code clean up, removed unwanted enums and configurations
Diff: src/admw_1001.c
- Revision:
- 44:94bdfaefddac
- Parent:
- 43:e1789b7214cf
- Child:
- 45:f5f553b8c0d5
--- a/src/admw_1001.c Tue Jan 07 05:45:58 2020 +0000 +++ b/src/admw_1001.c Thu Jan 16 06:52:27 2020 +0000 @@ -1214,25 +1214,16 @@ 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; + if(pDiagnosticsConfig->osdFrequency <= 0x7F) + { + diagnosticsControlReg.Diag_OSD_Freq = pDiagnosticsConfig->osdFrequency; } - + else + { + 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; @@ -2104,14 +2095,15 @@ { ADMW_CORE_Settling_Time_t settlingTimeReg; - if (nSettlingTime < (1 << 12)) { - settlingTimeReg.Settling_Time_Units = CORE_SETTLING_TIME_MICROSECONDS; - } else if (nSettlingTime < (1000 * (1 << 12))) { + if (nSettlingTime < (1 << 12)) + { + settlingTimeReg.Settling_Time_Units = CORE_SETTLING_TIME_MILLISECONDS; + } + else + { + settlingTimeReg.Settling_Time_Units = CORE_SETTLING_TIME_SECONDS; nSettlingTime /= 1000; - } else { - settlingTimeReg.Settling_Time_Units = CORE_SETTLING_TIME_SECONDS; - nSettlingTime /= 1000000; } CHECK_REG_FIELD_VAL(CORE_SETTLING_TIME_SETTLING_TIME, nSettlingTime);