Search by Tags

ADC Lib API

 

Article updated at 28 Oct 2017
Compare with Revision




Attention: this is a legacy library and thus not supported by Toradex anymore. We recommend that you use the new libraries for all Toradex modules. Please see the Toradex CE Libraries and Code Samples for up-to-date information.

Library to support ADC interfacing. More...

Macros

#define CODEC_UNKNOWN  0 #define CODEC_UCB1400  1 #define CODEC_WM9713  2 #define CODEC_WM9715  3 #define CODEC_SGTL5000  4 #define ADC_VER_MAJ  2 Version Info. More...
#define ADC_VER_MIN  3 #define ADC_VER_BUILD  0 

Functions

BOOL  Ac97Init (void)
BOOL  Ac97DeInit (void)
void  ADCGetLibVersion (DWORD *pVerMaj, DWORD *pVerMin, DWORD *pBuild)
DWORD  getCodecType (void)
BOOL  ReadADCChannel (BYTE channel, DWORD *value, DWORD samples)
DWORD  MicrovoltsPerLsb (BYTE channel)
DWORD  ReadTouch (BYTE mode, DWORD filter)
BOOL  Ac97Write (UINT16 offset, UINT16 data)
BOOL  Ac97Read (UINT16 offset, UINT16 *pdata)

Detailed Description

Library to support ADC interfacing.

Author
samuel.bissig
Rev
2688
Date
2015-03-09 13:36:34 +0100 (Mo, 09 Mrz 2015)
Target Platforms:
PXAxxx, T20

Macro Definition Documentation

#define ADC_VER_BUILD   0
#define ADC_VER_MAJ   2

Version Info.

#define ADC_VER_MIN   3
#define CODEC_SGTL5000   4
#define CODEC_UCB1400   1
#define CODEC_UNKNOWN   0
#define CODEC_WM9713   2
#define CODEC_WM9715   3

Function Documentation

BOOL Ac97DeInit ( void  )

Deinitializes the AC97 interface.

Return values
TRUE Success.
FALSE Error.
BOOL Ac97Init ( void  )

Initializes the AC97 interface.

Return values
TRUE Success.
FALSE Error.
BOOL Ac97Read ( UINT16  offset,
UINT16 *  pdata
)

Directly reads an AC97 register.

Parameters
[in] offset Register address.
[out] pdata 16-bit value read from the register.
Return values
TRUE Success.
FALSE Error.
BOOL Ac97Write ( UINT16  offset,
UINT16  data
)

Directly writes to an AC97 register

Parameters
[in] offset Register address.
[in] data 16-bit value to write into the register.
Return values
TRUE Success.
FALSE Error.
void ADCGetLibVersion ( DWORD *  pVerMaj,
DWORD *  pVerMin,
DWORD *  pBuild
)

Reads the library Version.

Parameters
[out] pVerMaj Major version number.
[out] pVerMin Minor version number.
[out] pBuild Build number.
DWORD getCodecType ( void  )

Reads which codec is installed on the current Colibri module.

Return values
0 Codec unknown.
1 UCB1400.
2 WM9713.
3 WM9715.
4 SGTL5000
DWORD MicrovoltsPerLsb ( BYTE  channel )

Gets Converstion constant Microvolts per LSB. This can be different for each ADC and even for each channel.

Parameters
[in] channel ADC channel number (0..3)
Return values
(7500000/1024) Conversion constant Microvolts per ADC LSB.
(3300000*3/4096) Conversion constant Microvolts per ADC LSB.
(3300000 /4096) Conversion constant Microvolts per ADC LSB.
0 Error.
BOOL ReadADCChannel ( BYTE  channel,
DWORD *  value,
DWORD  samples
)

Reads one ADC channel from Colibri's audio codec.

Parameters
[in] channel ADC channel number (0..3)
[in] samples number of samples that should be taken, they will be summed up
[out] value raw ADC value, if sampels>1, value is the SUM of all measurements.
Return values
TRUE Success.
FALSE Error.
DWORD ReadTouch ( BYTE  mode,
DWORD  filter
)

Reads one value from the touch controller

Parameters
[in] mode X or Y axis measurement.
[in] samples Number of samples required.
Return values
value Position value.
FALSE No access.
-1 Error.

Remarks: Only the UCB1400 codec is currently supported.