iLLD_TC27xC  1.0
Channel Functions
Collaboration diagram for Channel Functions:

Functions

IFX_INLINE void IfxVadc_Adc_configureWaitForReadMode (IfxVadc_Adc_Channel *channel, boolean waitForRead)
 pointer to the VADC channel More...
 
IFX_INLINE Ifx_VADC_RES IfxVadc_Adc_getResult (IfxVadc_Adc_Channel *channel)
 Get conversion result (Function does not care about the alignment) More...
 
IFX_EXTERN void IfxVadc_Adc_getChannelConfig (IfxVadc_Adc_Channel *channel, IfxVadc_Adc_ChannelConfig *config)
 Get the current channel configuration (e.g. sample settings) More...
 
IFX_EXTERN IfxVadc_Status IfxVadc_Adc_initChannel (IfxVadc_Adc_Channel *channel, const IfxVadc_Adc_ChannelConfig *config)
 Initialise one channel with given configuration. More...
 
IFX_EXTERN void IfxVadc_Adc_initChannelConfig (IfxVadc_Adc_ChannelConfig *config, const IfxVadc_Adc_Group *group)
 Initialise buffer with default channel configuration. More...
 

Detailed Description

Function Documentation

IFX_INLINE void IfxVadc_Adc_configureWaitForReadMode ( IfxVadc_Adc_Channel channel,
boolean  waitForRead 
)

pointer to the VADC channel

Parameters
channelpointer to the VADC channel
waitForReadwait for read mode enabled/disable
Returns
None

For coding example see: IfxVadc_Adc_getResultBasedOnRequestSource

Definition at line 1098 of file IfxVadc_Adc.h.

IFX_EXTERN void IfxVadc_Adc_getChannelConfig ( IfxVadc_Adc_Channel channel,
IfxVadc_Adc_ChannelConfig config 
)

Get the current channel configuration (e.g. sample settings)

Parameters
channelpointer to the VADC channel
configpointer to the VADC channel configuration
Returns
None

Example Usage :How to use the VADC ADC Interface driver?

Definition at line 129 of file IfxVadc_Adc.c.

IFX_INLINE Ifx_VADC_RES IfxVadc_Adc_getResult ( IfxVadc_Adc_Channel channel)

Get conversion result (Function does not care about the alignment)

Parameters
channelpointer to the VADC channel
Returns
scaled Conversion result

Here,Three channels are used for queued transfers

// IMPORTANT: for deterministic results we have to disable the queue gate
// while filling the queue, otherwise results could be output in the wrong order
unsigned savedGate = adcGroup.module.vadc->G[adcGroup.groupId].QMR0.B.ENGT;
adcGroup.module.vadc->G[adcGroup.groupId].QMR0.B.ENGT = 0;
// create channel config
IfxVadc_Adc_ChannelConfig adcChannelConfig[3];
IfxVadc_Adc_Channel adcChannel[3];
for(int chnIx=0; chnIx<3; ++chnIx) {
IfxVadc_Adc_initChannelConfig(&adcChannelConfig[chnIx], &adcGroup);
adcChannelConfig[chnIx].channelId = (IfxVadc_ChannelId)(chnIx);
adcChannelConfig[chnIx].resultRegister = IfxVadc_ChannelResult_1; // use result register #1 for all channels
// initialize the channel
IfxVadc_Adc_initChannel(&adcChannel[chnIx], &adcChannelConfig[chnIx]);
// Add channel to queue with refill enabled
// restore previous gate config
adcGroup.module.vadc->G[adcGroup.groupId].QMR0.B.ENGT = savedGate;
// start the Queue
IfxVadc_Adc_startQueue(&adcGroup); // just for the case that somebody copy&pastes the code - the queue has already been started in previous test
// get 10 results for all 3 channels and store in temporary buffer
// (the usage of a buffer is required, since the print statements used by the checks take more time than the conversions)
Ifx_VADC_RES resultTrace[3*10];
for(int i=0; i<3*10; ++i)
{
unsigned chnIx = i % 3;
// wait for valid result
Ifx_VADC_RES conversionResult;
do {
conversionResult = IfxVadc_Adc_getResult(&adcChannel[chnIx]);
} while( !conversionResult.B.VF );
// store result
resultTrace[i] = conversionResult;
}
// stop the queue
// check results in buffer

Definition at line 1104 of file IfxVadc_Adc.h.

IFX_EXTERN IfxVadc_Status IfxVadc_Adc_initChannel ( IfxVadc_Adc_Channel channel,
const IfxVadc_Adc_ChannelConfig config 
)

Initialise one channel with given configuration.

Parameters
channelpointer to the VADC channel
configpointer to the VADC channel configuration
Returns
IfxVadc_Status
// create channel config
IfxVadc_Adc_ChannelConfig adcChannelConfig;
IfxVadc_Adc_initChannelConfig(&adcChannelConfig, &adcGroup);
// change channel (default is ChannelId0, change to ChannelId2)
adcChannelConfig.channelId = IfxVadc_ChannelId2;
// initialize the channel
IfxVadc_Adc_initChannel(&adcChannel, &adcChannelConfig);

Definition at line 315 of file IfxVadc_Adc.c.

IFX_EXTERN void IfxVadc_Adc_initChannelConfig ( IfxVadc_Adc_ChannelConfig config,
const IfxVadc_Adc_Group group 
)

Initialise buffer with default channel configuration.

Parameters
configpointer to the VADC channel configuration
grouppointer to the VADC group
Returns
None

For coding example see: IfxVadc_Adc_initChannel

Definition at line 402 of file IfxVadc_Adc.c.