diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-05-06 01:37:47 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-05-06 01:37:47 +0000 |
commit | 4d0ba63ec40e2279356961c14a99b6f246034c6f (patch) | |
tree | 5ecc21b8f79c08b4ca93153afc349472a174f81d /nuttx/include/nuttx/input/stmpe11.h | |
parent | 0e2f2317773a5d5eb1c3d446bf81d9c90c41a79a (diff) |
Add framework for STMPE11 ADC interfaces
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4702 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/include/nuttx/input/stmpe11.h')
-rw-r--r-- | nuttx/include/nuttx/input/stmpe11.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/nuttx/include/nuttx/input/stmpe11.h b/nuttx/include/nuttx/input/stmpe11.h index 5bf79e8cda..48cba30a72 100644 --- a/nuttx/include/nuttx/input/stmpe11.h +++ b/nuttx/include/nuttx/input/stmpe11.h @@ -147,6 +147,7 @@ #define STMPE11_ADC_CTRL1 0x20 /* ADC control */ #define STMPE11_ADC_CTRL2 0x21 /* ADC control */ #define STMPE11_ADC_CAPT 0x22 /* To initiate ADC data acquisition */ +#define STMPE11_ADC_DATACH(n) (0x30 + ((n) << 1)) /* ADC channel n (16-bit) */ #define STMPE11_ADC_DATACH0 0x30 /* ADC channel 0 (16-bit) */ #define STMPE11_ADC_DATACH1 0x32 /* ADC channel 1 (16_bit) */ #define STMPE11_ADC_DATACH2 0x34 /* ADC channel 2 (16-bit) */ @@ -598,6 +599,66 @@ EXTERN int stmpe11_gpioattach(STMPE11_HANDLE handle, uint8_t pinconfig, stmpe11_handler_t handler); #endif +/******************************************************************************************** + * Name: stmpe11_adctiming + * + * Description: + * Configure overall ADC timing that applies to all pins. + * + * Input Parameters: + * handle - The handle previously returned by stmpe11_instantiate + * ctrl1 - The value of the ADC_CRTL1 register (see above). + * ctrl2 - The value of the ADC_CRTL2 register (see above). + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to indicate + * the nature of the failure. + * + ********************************************************************************************/ + +#ifndef CONFIG_STMPE11_ADC_DISABLE +EXTERN int stmpe11_adctiming(STMPE11_HANDLE handle, uint8_t ctrl1, uint8_t ctrl2); +#endif + +/******************************************************************************************** + * Name: stmpe11_adcconfig + * + * Description: + * Configure a pin for ADC input. + * + * Input Parameters: + * handle - The handle previously returned by stmpe11_instantiate + * pin - The ADC pin number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to indicate + * the nature of the failure. + * + ********************************************************************************************/ + +#ifndef CONFIG_STMPE11_ADC_DISABLE +EXTERN int stmpe11_adcconfig(STMPE11_HANDLE handle, int pin); +#endif + +/******************************************************************************************** + * Name: stmpe11_adcread + * + * Description: + * Read the converted analog input value from the select pin. + * + * Input Parameters: + * handle - The handle previously returned by stmpe11_instantiate + * pin - The ADC pin number + * + * Returned Value: + * The converted value (there is no error reporting mechanism). + * + ********************************************************************************************/ + +#ifndef CONFIG_STMPE11_ADC_DISABLE +EXTERN uint16_t stmpe11_adcread(STMPE11_HANDLE handle, int pin); +#endif + #undef EXTERN #ifdef __cplusplus } |