/* ** =================================================================== ** Method : AD1_OnMeasurementComplete (component ADC) ** ** Description : ** The method services the conversion complete interrupt of the ** selected peripheral(s) and eventually invokes the beans ** event(s). ** This method is internal. It is used by Processor Expert only. ** =================================================================== */ void AdcLdd1_OnMeasurementComplete(LDD_TUserData *UserDataPtr) { (void)UserDataPtr; /* Parameter is not used, suppress unused argument warning */ if (ModeFlg == STOP) { /* If the driver is in STOP mode */ return; /* Return from interrupt */ } if (ModeFlg == CALIBRATING) { /* If the driver is in CALIBRATING mode */ (void)AdcLdd1_GetCalibrationResultStatus(AdcLdd1_DeviceDataPtr); ModeFlg = STOP; /* Set the device to the stop mode */ AD1_OnCalibrationEnd(); /* If yes then invoke user event */ return; /* Return from interrupt */ } if (ModeFlg != SINGLE) { AdcLdd1_GetMeasuredValues(AdcLdd1_DeviceDataPtr, (LDD_TData *)&AD1_OutV); OutFlg = TRUE; /* Measured value is available */ AD1_OnEnd(); /* If yes then invoke user event */ if (ModeFlg == MEASURE) { /* Is the device in the measure state? */ ModeFlg = STOP; /* Set the device to the stop mode */ return; /* Return from interrupt */ } SampleGroup[0].ChannelIdx = 0U; /* Restart measurement */ (void)AdcLdd1_CreateSampleGroup(AdcLdd1_DeviceDataPtr, (LDD_ADC_TSample *)SampleGroup, 1U); /* Configure sample group */ (void)AdcLdd1_StartSingleMeasurement(AdcLdd1_DeviceDataPtr); } else { AdcLdd1_GetMeasuredValues(AdcLdd1_DeviceDataPtr, (LDD_TData *)&AD1_OutV); OutFlg = TRUE; /* Measured value is available */ AD1_OnEnd(); /* If yes then invoke user event */ ModeFlg = STOP; /* Set the device to the stop mode */ } }
/* ** =================================================================== ** Method : AD1_OnMeasurementComplete (component ADC) ** ** Description : ** The method services the conversion complete interrupt of the ** selected peripheral(s) and eventually invokes the beans ** event(s). ** This method is internal. It is used by Processor Expert only. ** =================================================================== */ void AdcLdd1_OnMeasurementComplete(LDD_TUserData *UserDataPtr) { AdcLdd1_TResultData ResultData; /* Temporary result data */ (void)UserDataPtr; /* Parameter is not used, suppress unused argument warning */ if (ModeFlg == CALIBRATING) { /* If the driver is in CALIBRATING mode */ (void)AdcLdd1_GetCalibrationResultStatus(AdcLdd1_DeviceDataPtr); ModeFlg = STOP; /* Set the device to the stop mode */ AD1_OnCalibrationEnd(); /* If yes then invoke user event */ return; /* Return from interrupt */ } AdcLdd1_GetMeasuredValues(AdcLdd1_DeviceDataPtr, (LDD_TData *)&ResultData); AD1_OutV[SumChan] += ResultData; SumChan++; /* Increase counter of measured channels*/ if (SumChan == 4U) { /* Is number of measured channels equal to the number of channels used in the component? */ SumChan = 0U; /* If yes then set the counter of measured channels to 0 */ SumCnt++; /* Increase counter of conversions*/ if (SumCnt == 128U) { /* Is number of conversions on each channel equal to the number of conversions defined in the component? */ OutFlg = TRUE; /* Measured values are available */ AD1_OnEnd(); /* If yes then invoke user event */ ModeFlg = STOP; /* Set the device to the stop mode */ return; /* Return from interrupt */ } } SampleGroup[0].ChannelIdx = SumChan; /* Start measurement of next channel */ (void)AdcLdd1_CreateSampleGroup(AdcLdd1_DeviceDataPtr, (LDD_ADC_TSample *)SampleGroup, 1U); /* Configure sample group */ (void)AdcLdd1_StartSingleMeasurement(AdcLdd1_DeviceDataPtr); }
/* ** =================================================================== ** Method : AD1_OnMeasurementComplete (component ADC) ** ** Description : ** The method services the conversion complete interrupt of the ** selected peripheral(s) and eventually invokes the beans ** event(s). ** This method is internal. It is used by Processor Expert only. ** =================================================================== */ void AdcLdd1_OnMeasurementComplete(LDD_TUserData *UserDataPtr) { (void)UserDataPtr; /* Parameter is not used, suppress unused argument warning */ if (ModeFlg == CALIBRATING) { /* If the driver is in CALIBRATING mode */ (void)AdcLdd1_GetCalibrationResultStatus(AdcLdd1_DeviceDataPtr); ModeFlg = STOP; /* Set the device to the stop mode */ AD1_OnCalibrationEnd(); /* If yes then invoke user event */ return; /* Return from interrupt */ } AdcLdd1_GetMeasuredValues(AdcLdd1_DeviceDataPtr, (LDD_TData *)&AD1_OutV); OutFlg = TRUE; /* Measured value is available */ AD1_OnEnd(); /* If yes then invoke user event */ ModeFlg = STOP; /* Set the device to the stop mode */ }