//Must be performed before each ADC-Measurement
void ADC_Init(uint8_t channel)
{
if(channel == 0)
{
Gain1Time = EEPROM_GetGain1Time();
Gain2Time = EEPROM_GetGain2Time();
Gain3Time = EEPROM_GetGain3Time();
SampleQuantity = EEPROM_GetSampleQuantity();
Chip_IOCON_PinMuxSet(LPC_IOCON, UltrasonicPin, FUNC2);
Chip_ADC_Init(LPC_ADC, &ADCSetup); //Default Setup 400kHz/10bit
Chip_ADC_SetSampleRate(LPC_ADC, &ADCSetup, EEPROM_GetADCFrequ()));//Set Rate to X kHz
Chip_ADC_EnableChannel(LPC_ADC, TempChannel, DISABLE);
Chip_ADC_EnableChannel(LPC_ADC, UltrasonicChannel, ENABLE);
}
else if(channel == 1)
{
Chip_IOCON_PinMuxSet(LPC_IOCON, TempPin, FUNC2);
Chip_ADC_Init(LPC_ADC, &ADCSetup);//Default Setup 400kHz/10bit
Chip_ADC_SetBurstCmd(LPC_ADC, DISABLE);
Chip_ADC_SetSampleRate(LPC_ADC, &ADCSetup, 10000);//Set Rate to 10kHz
Chip_ADC_EnableChannel(LPC_ADC, UltrasonicChannel, DISABLE);
Chip_ADC_EnableChannel(LPC_ADC, TempChannel, ENABLE);
}
} <-------------- Line 74
|