diff options
Diffstat (limited to 'nuttx/drivers/input/stmpe811_adc.c')
-rw-r--r-- | nuttx/drivers/input/stmpe811_adc.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/nuttx/drivers/input/stmpe811_adc.c b/nuttx/drivers/input/stmpe811_adc.c index 5b9d045c9..1ffe987e6 100644 --- a/nuttx/drivers/input/stmpe811_adc.c +++ b/nuttx/drivers/input/stmpe811_adc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * drivers/input/stmpe11_adc.c + * drivers/input/stmpe811_adc.c * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -49,11 +49,11 @@ #include <debug.h> #include <nuttx/arch.h> -#include <nuttx/input/stmpe11.h> +#include <nuttx/input/stmpe811.h> -#include "stmpe11.h" +#include "stmpe811.h" -#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_STMPE11) && !defined(CONFIG_STMPE11_ADC_DISABLE) +#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_STMPE811) && !defined(CONFIG_STMPE811_ADC_DISABLE) /**************************************************************************** * Private Types @@ -72,14 +72,14 @@ ****************************************************************************/ /**************************************************************************** - * Name: stmpe11_adcinitialize + * Name: stmpe811_adcinitialize * * Description: * Configure for ADC mode operation. Set overall ADC ADC timing that * applies to all pins. * * Input Parameters: - * handle - The handle previously returned by stmpe11_instantiate + * handle - The handle previously returned by stmpe811_instantiate * * Returned Value: * Zero is returned on success. Otherwise, a negated errno value is @@ -87,9 +87,9 @@ * ****************************************************************************/ -int stmpe11_adcinitialize(STMPE11_HANDLE handle) +int stmpe811_adcinitialize(STMPE811_HANDLE handle) { - FAR struct stmpe11_dev_s *priv = (FAR struct stmpe11_dev_s *)handle; + FAR struct stmpe811_dev_s *priv = (FAR struct stmpe811_dev_s *)handle; uint8_t regval; int ret; @@ -107,13 +107,13 @@ int stmpe11_adcinitialize(STMPE11_HANDLE handle) /* Enable Clocking for ADC */ - regval = stmpe11_getreg8(priv, STMPE11_SYS_CTRL2); + regval = stmpe811_getreg8(priv, STMPE811_SYS_CTRL2); regval &= ~SYS_CTRL2_ADC_OFF; - stmpe11_putreg8(priv, STMPE11_SYS_CTRL2, regval); + stmpe811_putreg8(priv, STMPE811_SYS_CTRL2, regval); /* Select Sample Time, bit number and ADC Reference */ - stmpe11_putreg8(priv, STMPE11_ADC_CTRL1, priv->config->ctrl1); + stmpe811_putreg8(priv, STMPE811_ADC_CTRL1, priv->config->ctrl1); /* Wait for 20 ms */ @@ -121,23 +121,23 @@ int stmpe11_adcinitialize(STMPE11_HANDLE handle) /* Select the ADC clock speed */ - stmpe11_putreg8(priv, STMPE11_ADC_CTRL2, priv->config->ctrl2); + stmpe811_putreg8(priv, STMPE811_ADC_CTRL2, priv->config->ctrl2); /* Mark ADC initialized */ - priv->flags |= STMPE11_FLAGS_ADC_INITIALIZED; + priv->flags |= STMPE811_FLAGS_ADC_INITIALIZED; sem_post(&priv->exclsem); return OK; } /**************************************************************************** - * Name: stmpe11_adcconfig + * Name: stmpe811_adcconfig * * Description: * Configure a pin for ADC input. * * Input Parameters: - * handle - The handle previously returned by stmpe11_instantiate + * handle - The handle previously returned by stmpe811_instantiate * pin - The ADC pin number * * Returned Value: @@ -146,14 +146,14 @@ int stmpe11_adcinitialize(STMPE11_HANDLE handle) * ****************************************************************************/ -int stmpe11_adcconfig(STMPE11_HANDLE handle, int pin) +int stmpe811_adcconfig(STMPE811_HANDLE handle, int pin) { - FAR struct stmpe11_dev_s *priv = (FAR struct stmpe11_dev_s *)handle; + FAR struct stmpe811_dev_s *priv = (FAR struct stmpe811_dev_s *)handle; uint8_t pinmask = GPIO_PIN(pin); uint8_t regval; int ret; - DEBUGASSERT(handle && (unsigned)pin < STMPE11_ADC_NPINS); + DEBUGASSERT(handle && (unsigned)pin < STMPE811_ADC_NPINS); /* Get exclusive access to the device structure */ @@ -179,9 +179,9 @@ int stmpe11_adcconfig(STMPE11_HANDLE handle, int pin) * ADC_CTRL1_REF_SEL bit). */ - regval = stmpe11_getreg8(priv, STMPE11_GPIO_AF); + regval = stmpe811_getreg8(priv, STMPE811_GPIO_AF); regval &= ~pinmask; - stmpe11_putreg8(priv, STMPE11_GPIO_AF, regval); + stmpe811_putreg8(priv, STMPE811_GPIO_AF, regval); /* Mark the pin as 'in use' */ @@ -191,13 +191,13 @@ int stmpe11_adcconfig(STMPE11_HANDLE handle, int pin) } /**************************************************************************** - * Name: stmpe11_adcread + * Name: stmpe811_adcread * * Description: * Read the converted analog input value from the select pin. * * Input Parameters: - * handle - The handle previously returned by stmpe11_instantiate + * handle - The handle previously returned by stmpe811_instantiate * pin - The ADC pin number * * Returned Value: @@ -205,9 +205,9 @@ int stmpe11_adcconfig(STMPE11_HANDLE handle, int pin) * ****************************************************************************/ -uint16_t stmpe11_adcread(STMPE11_HANDLE handle, int pin) +uint16_t stmpe811_adcread(STMPE811_HANDLE handle, int pin) { - FAR struct stmpe11_dev_s *priv = (FAR struct stmpe11_dev_s *)handle; + FAR struct stmpe811_dev_s *priv = (FAR struct stmpe811_dev_s *)handle; uint8_t pinmask = GPIO_PIN(pin); uint8_t regval; int i; @@ -229,7 +229,7 @@ uint16_t stmpe11_adcread(STMPE11_HANDLE handle, int pin) * ADC CAPT register. */ - stmpe11_putreg8(priv, STMPE11_ADC_CAPT, pinmask); + stmpe811_putreg8(priv, STMPE811_ADC_CAPT, pinmask); /* Wait for the conversion to complete. The ADC CAPT register reads '1' * if conversion is completed. Reads '0' if conversion is in progress. @@ -248,7 +248,7 @@ uint16_t stmpe11_adcread(STMPE11_HANDLE handle, int pin) /* Check if the conversion is complete */ - regval = stmpe11_getreg8(priv, STMPE11_ADC_CAPT); + regval = stmpe811_getreg8(priv, STMPE811_ADC_CAPT); if ((regval & pinmask) != 0) { break; @@ -259,8 +259,8 @@ uint16_t stmpe11_adcread(STMPE11_HANDLE handle, int pin) * from the channel register associated with the pin. */ - return stmpe11_getreg16(priv, STMPE11_ADC_DATACH(pin)); + return stmpe811_getreg16(priv, STMPE811_ADC_DATACH(pin)); } -#endif /* CONFIG_INPUT && CONFIG_INPUT_STMPE11 && !CONFIG_STMPE11_ADC_DISABLE */ +#endif /* CONFIG_INPUT && CONFIG_INPUT_STMPE811 && !CONFIG_STMPE811_ADC_DISABLE */ |