📄 wmauxadc.h
字号:
/*-----------------------------------------------------------------------------
* Copyright (c) Wolfson Microelectronics plc. All rights reserved.
*
* This software as well as any related documentation is furnished under
* license and may only be used or copied in accordance with the terms of the
* license. The information in this file is furnished for informational use
* only, is subject to change without notice, and should not be construed as
* a commitment by Wolfson Microelectronics plc. Wolfson Microelectronics plc
* assumes no responsibility or liability for any errors or inaccuracies that
* may appear in this document or any software that may be provided in
* association with this document.
*
* Except as permitted by such license, no part of this document may be
* reproduced, stored in a retrieval system, or transmitted in any form or by
* any means without the express written consent of Wolfson Microelectronics plc.
*
* $Id: WMAuxADC.h 1327 2005-02-24 16:04:43Z ib $
*
* This file contains platform-independent routines for controlling
* the analogue to digital converters on Wolfson codecs.
*
* Warning:
* This driver is specifically written for Wolfson Codecs. It is not a
* general CODEC device driver.
*
* -----------------------------------------------------------------------------*/
#ifndef __WMAUXADC_H__
#define __WMAUXADC_H__
/*
* Include files
*/
#include "WMTypes.h"
#include "WMConfig.h"
/*
* Global definitions
*/
/* The maximum value from our ADCs */
#define WM_MAX_DATA_VAL 0x0FFF
/* A value we will never receive, which is used to indicate an invalid sample */
#define WM_INVALID_SAMPLE (WM_REGVAL)0xFFFF
/* The ADCs which can be requested */
typedef unsigned short WM_AUXADC_TYPE;
#define WM_ADC_UNKNOWN 0x0000
#define WM_ADC_X_COORD 0x0001
#define WM_ADC_Y_COORD 0x0002
#define WM_ADC_TOUCH 0x0003 /* X- and Y-coordinates */
#define WM_ADC_PRESSURE 0x0004
#define WM_ADC_BMON 0x0005
#define WM_ADC_AUXADC 0x0006
#define WM_ADC_PHONE 0x0007
#define WM_ADC_PCBEEP 0x0008
#define WM_ADC_COMP1 0x0009
#define WM_ADC_COMP2 0x000A
#define WM_ADC_WIPER 0x000B
#define WM_ADC_AUX1 0x000C
#define WM_ADC_AUX2 0x000D
#define WM_ADC_AUX3 0x000E
#define WM_ADC_AUX4 0x000F
#define WM_ADC_SPKMON 0x0010
#define WM_AUXADC_INVALID ((WM_REGVAL) -1)
#define WM_ADCSEL_INVALID WM_AUXADC_INVALID
/*
* Private data
*/
/*
* Function prototypes
*/
#ifdef __cplusplus
extern "C" {
#endif
#if WM_AUXADC
/*-----------------------------------------------------------------------------
* Function: WMAuxADCInit
*
* Initialises the ADC functionality.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
WMSTATUS WMAuxADCInit( WM_DEVICE_HANDLE hDevice );
/*-----------------------------------------------------------------------------
* Function: WMAuxADCShutdown
*
* Shuts down the ADC functionality.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: void
*---------------------------------------------------------------------------*/
void WMAuxADCShutdown( WM_DEVICE_HANDLE hDevice );
/*-----------------------------------------------------------------------------
* Function: WMAuxADCPowerUp
*
* Called to power up the Auxiliary ADC-specific sections of the chip.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* powerSections The sections to power up.
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
#define WMAuxADCPowerUp( hDevice, powerSections ) \
WMPowerUp( hDevice, WM_DRIVER_AUXADC, powerSections )
/*-----------------------------------------------------------------------------
* Function: WMAuxADCPowerDown
*
* Called to power down the auxiliary ADC-specific sections of the chip.
* Note if the sections are still in use by another driver they will not
* actually be powered down.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* powerSections The sections to power down.
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
#define WMAuxADCPowerDown( hDevice, powerSections ) \
WMPowerDown( hDevice, WM_DRIVER_AUXADC, powerSections )
/*-----------------------------------------------------------------------------
* Function: WMAuxADCStart
*
* Prepares the ADC functionality to generate readings of the appropriate type.
*
* Note the ADCs are mutually exclusive - selecting one deselects the previous
* one. The exceptions to this are the X- and Y-coordinates, which can be
* streamed along with the ADC reading.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* adc Which ADC to read from.
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
WMSTATUS WMAuxADCStart( WM_DEVICE_HANDLE hDevice, WM_AUXADC_TYPE adc );
/*-----------------------------------------------------------------------------
* Function: WMAuxADCSelect
*
* Prepares the ADC functionality to generate readings of the appropriate type,
* but doesn't start streaming.
*
* Note the ADCs are mutually exclusive - selecting one deselects the previous
* one. The exceptions to this are the X- and Y-coordinates, which can be
* streamed along with the ADC reading.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* adc Which ADC to read from.
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
WMSTATUS WMAuxADCSelect( WM_DEVICE_HANDLE hDevice, WM_AUXADC_TYPE adc );
/*-----------------------------------------------------------------------------
* Function: WMAuxADCStop
*
* Stops the ADC functionality from generating readings of the appropriate type.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* adc Which ADC to stop.
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
WMSTATUS WMAuxADCStop( WM_DEVICE_HANDLE hDevice, WM_AUXADC_TYPE adc );
/*-----------------------------------------------------------------------------
* Function: WMSampleADC
*
* Returns the next sample of the given type.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* adc One of the WM_AUXADC_TYPE constants.
* pValue Variable to receive the value (between 0 and 0xFFF).
* Set to WM_INVALID_SAMPLE on error.
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
WMSTATUS WMSampleADC( WM_DEVICE_HANDLE hDevice,
WM_AUXADC_TYPE adc,
WM_REGVAL *pValue
);
#endif /* WM_AUXADC */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __WMAUXADC_H__ */
/*------------------------------ END OF FILE ---------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -