A little more cleanup after the big STMPE11->811 name change

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4783 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-05-29 01:43:51 +00:00
parent 26d1e5ab3f
commit 4bca971ba1
9 changed files with 420 additions and 420 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ struct stm32_stmpe811config_s
/* Additional private definitions only known to this driver */
STMPE811_HANDLE handle; /* The STMPE811 driver handle */
xcpt_t handler; /* The STMPE811 interrupt handler */
xcpt_t handler; /* The STMPE811 interrupt handler */
};
/****************************************************************************
+1 -1
View File
@@ -136,7 +136,7 @@ struct stm32_stmpe811config_s
/* Additional private definitions only known to this driver */
STMPE811_HANDLE handle; /* The STMPE811 driver handle */
xcpt_t handler; /* The STMPE811 interrupt handler */
xcpt_t handler; /* The STMPE811 interrupt handler */
};
/****************************************************************************
+54 -54
View File
@@ -1,5 +1,5 @@
/********************************************************************************************
* drivers/input/stmpe11.h
* drivers/input/stmpe811.h
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -37,8 +37,8 @@
*
********************************************************************************************/
#ifndef __DRIVERS_INPUT_STMPE11_H
#define __DRIVERS_INPUT_STMPE11_H
#ifndef __DRIVERS_INPUT_STMPE811_H
#define __DRIVERS_INPUT_STMPE811_H
/********************************************************************************************
* Included Files
@@ -51,9 +51,9 @@
#include <nuttx/clock.h>
#include <nuttx/wqueue.h>
#include <nuttx/input/stmpe11.h>
#include <nuttx/input/stmpe811.h>
#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_STMPE11)
#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_STMPE811)
/********************************************************************************************
* Pre-Processor Definitions
@@ -62,12 +62,12 @@
/* Reference counting is partially implemented, but not needed in the current design.
*/
#undef CONFIG_STMPE11_REFCNT
#undef CONFIG_STMPE811_REFCNT
/* No support for the SPI interface yet */
#ifdef CONFIG_STMPE11_SPI
# error "Only the STMPE11 I2C interface is supported by this driver"
#ifdef CONFIG_STMPE811_SPI
# error "Only the STMPE811 I2C interface is supported by this driver"
#endif
/* Driver support ***************************************************************************/
@@ -78,32 +78,32 @@
#define DEV_FORMAT "/dev/input%d"
#define DEV_NAMELEN 16
/* STMPE11 Resources ************************************************************************/
#ifndef CONFIG_STMPE11_TSC_DISABLE
# define SMTPE11_ADC_NPINS 4 /* Only pins 0-3 can be used for ADC */
# define SMTPE11_GPIO_NPINS 4 /* Only pins 0-3 can be used as GPIOs */
/* STMPE811 Resources ************************************************************************/
#ifndef CONFIG_STMPE811_TSC_DISABLE
# define STMPE811_ADC_NPINS 4 /* Only pins 0-3 can be used for ADC */
# define STMPE811_GPIO_NPINS 4 /* Only pins 0-3 can be used as GPIOs */
#else
# define SMTPE11_ADC_NPINS 8 /* All pins can be used for ADC */
# define SMTPE11_GPIO_NPINS 8 /* All pins can be used as GPIOs */
# define STMPE811_ADC_NPINS 8 /* All pins can be used for ADC */
# define STMPE811_GPIO_NPINS 8 /* All pins can be used as GPIOs */
#endif
/* Driver flags */
#define STMPE11_FLAGS_TSC_INITIALIZED (1 << 0) /* 1: The TSC block has been initialized */
#define STMPE11_FLAGS_GPIO_INITIALIZED (1 << 1) /* 1: The GIO block has been initialized */
#define STMPE11_FLAGS_ADC_INITIALIZED (1 << 2) /* 1: The ADC block has been initialized */
#define STMPE11_FLAGS_TS_INITIALIZED (1 << 3) /* 1: The TS block has been initialized */
#define STMPE811_FLAGS_TSC_INITIALIZED (1 << 0) /* 1: The TSC block has been initialized */
#define STMPE811_FLAGS_GPIO_INITIALIZED (1 << 1) /* 1: The GIO block has been initialized */
#define STMPE811_FLAGS_ADC_INITIALIZED (1 << 2) /* 1: The ADC block has been initialized */
#define STMPE811_FLAGS_TS_INITIALIZED (1 << 3) /* 1: The TS block has been initialized */
/* Timeout to detect missing pen up events */
#define STMPE11_PENUP_TICKS ((100 + (MSEC_PER_TICK-1)) / MSEC_PER_TICK)
#define STMPE811_PENUP_TICKS ((100 + (MSEC_PER_TICK-1)) / MSEC_PER_TICK)
/********************************************************************************************
* Public Types
********************************************************************************************/
/* This describes the state of one contact */
enum stmpe11_contact_3
enum stmpe811_contact_3
{
CONTACT_NONE = 0, /* No contact */
CONTACT_DOWN, /* First contact */
@@ -111,47 +111,47 @@ enum stmpe11_contact_3
CONTACT_UP, /* Contact lost */
};
/* This structure describes the results of one STMPE11 sample */
/* This structure describes the results of one STMPE811 sample */
struct stmpe11_sample_s
struct stmpe811_sample_s
{
uint8_t id; /* Sampled touch point ID */
uint8_t contact; /* Contact state (see enum stmpe11_contact_e) */
uint8_t contact; /* Contact state (see enum stmpe811_contact_e) */
bool valid; /* True: x,y,z contain valid, sampled data */
uint16_t x; /* Measured X position */
uint16_t y; /* Measured Y position */
uint8_t z; /* Measured Z index */
};
/* This structure represents the state of the SMTPE11 driver */
/* This structure represents the state of the STMPE811 driver */
struct stmpe11_dev_s
struct stmpe811_dev_s
{
#ifdef CONFIG_STMPE11_MULTIPLE
FAR struct stmpe11_dev_s *flink; /* Supports a singly linked list of drivers */
#ifdef CONFIG_STMPE811_MULTIPLE
FAR struct stmpe811_dev_s *flink; /* Supports a singly linked list of drivers */
#endif
/* Common fields */
FAR struct stmpe11_config_s *config; /* Board configuration data */
FAR struct stmpe811_config_s *config; /* Board configuration data */
sem_t exclsem; /* Manages exclusive access to this structure */
#ifdef CONFIG_STMPE11_SPI
#ifdef CONFIG_STMPE811_SPI
FAR struct spi_dev_s *spi; /* Saved SPI driver instance */
#else
FAR struct i2c_dev_s *i2c; /* Saved I2C driver instance */
#endif
uint8_t inuse; /* SMTPE11 pins in use */
uint8_t flags; /* See SMTPE11_FLAGS_* definitions */
uint8_t inuse; /* STMPE811 pins in use */
uint8_t flags; /* See STMPE811_FLAGS_* definitions */
struct work_s work; /* Supports the interrupt handling "bottom half" */
/* Fields that may be disabled to save size if touchscreen support is not used. */
#ifndef CONFIG_STMPE11_TSC_DISABLE
#ifdef CONFIG_STMPE11_REFCNT
#ifndef CONFIG_STMPE811_TSC_DISABLE
#ifdef CONFIG_STMPE811_REFCNT
uint8_t crefs; /* Number of times the device has been opened */
#endif
uint8_t nwaiters; /* Number of threads waiting for STMPE11 data */
uint8_t nwaiters; /* Number of threads waiting for STMPE811 data */
uint8_t id; /* Current touch point ID */
uint8_t minor; /* Touchscreen minor device number */
volatile bool penchange; /* An unreported event is buffered */
@@ -162,7 +162,7 @@ struct stmpe11_dev_s
struct work_s timeout; /* Supports tiemeout work */
WDOG_ID wdog; /* Timeout to detect missing pen down events */
struct stmpe11_sample_s sample; /* Last sampled touch point data */
struct stmpe811_sample_s sample; /* Last sampled touch point data */
/* The following is a list if poll structures of threads waiting for
* driver events. The 'struct pollfd' reference for each open is also
@@ -170,14 +170,14 @@ struct stmpe11_dev_s
*/
#ifndef CONFIG_DISABLE_POLL
struct pollfd *fds[CONFIG_STMPE11_NPOLLWAITERS];
struct pollfd *fds[CONFIG_STMPE811_NPOLLWAITERS];
#endif
#endif
/* Fields that may be disabled to save size of GPIO support is not used */
#if !defined(CONFIG_STMPE11_GPIO_DISABLE) && !defined(CONFIG_STMPE11_GPIOINT_DISABLE)
stmpe11_handler_t handlers[SMTPE11_GPIO_NPINS]; /* GPIO "interrupt handlers" */
#if !defined(CONFIG_STMPE811_GPIO_DISABLE) && !defined(CONFIG_STMPE811_GPIOINT_DISABLE)
stmpe811_handler_t handlers[STMPE811_GPIO_NPINS]; /* GPIO "interrupt handlers" */
#endif
};
@@ -186,37 +186,37 @@ struct stmpe11_dev_s
********************************************************************************************/
/********************************************************************************************
* Name: stmpe11_getreg8
* Name: stmpe811_getreg8
*
* Description:
* Read from an 8-bit STMPE11 register
* Read from an 8-bit STMPE811 register
*
********************************************************************************************/
uint8_t stmpe11_getreg8(FAR struct stmpe11_dev_s *priv, uint8_t regaddr);
uint8_t stmpe811_getreg8(FAR struct stmpe811_dev_s *priv, uint8_t regaddr);
/********************************************************************************************
* Name: stmpe11_putreg8
* Name: stmpe811_putreg8
*
* Description:
* Write a value to an 8-bit STMPE11 register
* Write a value to an 8-bit STMPE811 register
*
********************************************************************************************/
void stmpe11_putreg8(FAR struct stmpe11_dev_s *priv, uint8_t regaddr, uint8_t regval);
void stmpe811_putreg8(FAR struct stmpe811_dev_s *priv, uint8_t regaddr, uint8_t regval);
/********************************************************************************************
* Name: stmpe11_getreg16
* Name: stmpe811_getreg16
*
* Description:
* Read 16-bits of data from an STMPE-11 register
*
********************************************************************************************/
uint16_t stmpe11_getreg16(FAR struct stmpe11_dev_s *priv, uint8_t regaddr);
uint16_t stmpe811_getreg16(FAR struct stmpe811_dev_s *priv, uint8_t regaddr);
/********************************************************************************************
* Name: stmpe11_tscint
* Name: stmpe811_tscint
*
* Description:
* Handle touchscreen interrupt events (this function actually executes in the context of
@@ -224,12 +224,12 @@ uint16_t stmpe11_getreg16(FAR struct stmpe11_dev_s *priv, uint8_t regaddr);
*
********************************************************************************************/
#ifndef CONFIG_STMPE11_TSC_DISABLE
void stmpe11_tscworker(FAR struct stmpe11_dev_s *priv, uint8_t intsta) weak_function;
#ifndef CONFIG_STMPE811_TSC_DISABLE
void stmpe811_tscworker(FAR struct stmpe811_dev_s *priv, uint8_t intsta) weak_function;
#endif
/********************************************************************************************
* Name: stmpe11_gpioworker
* Name: stmpe811_gpioworker
*
* Description:
* Handle GPIO interrupt events (this function actually executes in the context of the
@@ -237,9 +237,9 @@ void stmpe11_tscworker(FAR struct stmpe11_dev_s *priv, uint8_t intsta) weak_func
*
********************************************************************************************/
#if !defined(CONFIG_STMPE11_GPIO_DISABLE) && !defined(CONFIG_STMPE11_GPIOINT_DISABLE)
void stmpe11_gpioworker(FAR struct stmpe11_dev_s *priv) weak_function;
#if !defined(CONFIG_STMPE811_GPIO_DISABLE) && !defined(CONFIG_STMPE811_GPIOINT_DISABLE)
void stmpe811_gpioworker(FAR struct stmpe811_dev_s *priv) weak_function;
#endif
#endif /* CONFIG_INPUT && CONFIG_INPUT_STMPE11 */
#endif /* __DRIVERS_INPUT_STMPE11_H */
#endif /* CONFIG_INPUT && CONFIG_INPUT_STMPE811 */
#endif /* __DRIVERS_INPUT_STMPE811_H */
+28 -28
View File
@@ -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 */
File diff suppressed because it is too large Load Diff
+73 -73
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* drivers/input/stmpe11_gpio.c
* drivers/input/stmpe811_gpio.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -47,11 +47,11 @@
#include <errno.h>
#include <debug.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_GPIO_DISABLE)
#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_STMPE811) && !defined(CONFIG_STMPE811_GPIO_DISABLE)
/****************************************************************************
* Private Types
@@ -66,13 +66,13 @@
****************************************************************************/
/****************************************************************************
* Name: stmpe11_gpioinit
* Name: stmpe811_gpioinit
*
* Description:
* Initialize the GPIO interrupt subsystem
*
* 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
@@ -80,31 +80,31 @@
*
****************************************************************************/
static void stmpe11_gpioinit(FAR struct stmpe11_dev_s *priv)
static void stmpe811_gpioinit(FAR struct stmpe811_dev_s *priv)
{
uint8_t regval;
if ((priv->flags & STMPE11_FLAGS_GPIO_INITIALIZED) == 0)
if ((priv->flags & STMPE811_FLAGS_GPIO_INITIALIZED) == 0)
{
/* Enable Clocking for GPIO */
regval = stmpe11_getreg8(priv, STMPE11_SYS_CTRL2);
regval = stmpe811_getreg8(priv, STMPE811_SYS_CTRL2);
regval &= ~SYS_CTRL2_GPIO_OFF;
stmpe11_putreg8(priv, STMPE11_SYS_CTRL2, regval);
stmpe811_putreg8(priv, STMPE811_SYS_CTRL2, regval);
/* Disable all GPIO interrupts */
stmpe11_putreg8(priv, STMPE11_GPIO_EN, 0);
stmpe811_putreg8(priv, STMPE811_GPIO_EN, 0);
/* Enable global GPIO interrupts */
#ifndef CONFIG_STMPE11_GPIOINT_DISABLE
regval = stmpe11_getreg8(priv, STMPE11_INT_EN);
#ifndef CONFIG_STMPE811_GPIOINT_DISABLE
regval = stmpe811_getreg8(priv, STMPE811_INT_EN);
regval |= INT_GPIO;
stmpe11_putreg8(priv, STMPE11_INT_EN, regval);
stmpe811_putreg8(priv, STMPE811_INT_EN, regval);
#endif
priv->flags |= STMPE11_FLAGS_GPIO_INITIALIZED;
priv->flags |= STMPE811_FLAGS_GPIO_INITIALIZED;
}
}
@@ -113,13 +113,13 @@ static void stmpe11_gpioinit(FAR struct stmpe11_dev_s *priv)
****************************************************************************/
/****************************************************************************
* Name: stmpe11_gpioconfig
* Name: stmpe811_gpioconfig
*
* Description:
* Configure an STMPE11 GPIO pin
* Configure an STMPE811 GPIO pin
*
* Input Parameters:
* handle - The handle previously returned by stmpe11_instantiate
* handle - The handle previously returned by stmpe811_instantiate
* pinconfig - Bit-encoded pin configuration
*
* Returned Value:
@@ -128,15 +128,15 @@ static void stmpe11_gpioinit(FAR struct stmpe11_dev_s *priv)
*
****************************************************************************/
int stmpe11_gpioconfig(STMPE11_HANDLE handle, uint8_t pinconfig)
int stmpe811_gpioconfig(STMPE811_HANDLE handle, uint8_t pinconfig)
{
FAR struct stmpe11_dev_s *priv = (FAR struct stmpe11_dev_s *)handle;
int pin = (pinconfig & STMPE11_GPIO_PIN_MASK) >> STMPE11_GPIO_PIN_SHIFT;
FAR struct stmpe811_dev_s *priv = (FAR struct stmpe811_dev_s *)handle;
int pin = (pinconfig & STMPE811_GPIO_PIN_MASK) >> STMPE811_GPIO_PIN_SHIFT;
uint8_t pinmask = (1 << pin);
uint8_t regval;
int ret;
DEBUGASSERT(handle && (unsigned)pin < STMPE11_GPIO_NPINS);
DEBUGASSERT(handle && (unsigned)pin < STMPE811_GPIO_NPINS);
/* Get exclusive access to the device structure */
@@ -159,41 +159,41 @@ int stmpe11_gpioconfig(STMPE11_HANDLE handle, uint8_t pinconfig)
/* Make sure that the GPIO block has been initialized */
stmpe11_gpioinit(priv);
stmpe811_gpioinit(priv);
/* Set the alternate function bit for the pin, making it a GPIO */
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);
/* Is the pin an input or an output? */
if ((pinconfig & STMPE11_GPIO_DIR) == STMPE11_GPIO_OUTPUT)
if ((pinconfig & STMPE811_GPIO_DIR) == STMPE811_GPIO_OUTPUT)
{
/* The pin is an output */
regval = stmpe11_getreg8(priv, STMPE11_GPIO_DIR);
regval = stmpe811_getreg8(priv, STMPE811_GPIO_DIR);
regval &= ~pinmask;
stmpe11_putreg8(priv, STMPE11_GPIO_DIR, regval);
stmpe811_putreg8(priv, STMPE811_GPIO_DIR, regval);
/* Set its initial output value */
stmpe11_gpiowrite(handle, pinconfig,
(pinconfig & STMPE11_GPIO_VALUE) != STMPE11_GPIO_ZERO);
stmpe811_gpiowrite(handle, pinconfig,
(pinconfig & STMPE811_GPIO_VALUE) != STMPE811_GPIO_ZERO);
}
else
{
/* It is an input */
regval = stmpe11_getreg8(priv, STMPE11_GPIO_DIR);
regval = stmpe811_getreg8(priv, STMPE811_GPIO_DIR);
regval |= pinmask;
stmpe11_putreg8(priv, STMPE11_GPIO_DIR, regval);
stmpe811_putreg8(priv, STMPE811_GPIO_DIR, regval);
/* Set up the falling edge detection */
regval = stmpe11_getreg8(priv, STMPE11_GPIO_FE);
if ((pinconfig & STMPE11_GPIO_FALLING) != 0)
regval = stmpe811_getreg8(priv, STMPE811_GPIO_FE);
if ((pinconfig & STMPE811_GPIO_FALLING) != 0)
{
regval |= pinmask;
}
@@ -201,12 +201,12 @@ int stmpe11_gpioconfig(STMPE11_HANDLE handle, uint8_t pinconfig)
{
regval &= pinmask;
}
stmpe11_putreg8(priv, STMPE11_GPIO_FE, regval);
stmpe811_putreg8(priv, STMPE811_GPIO_FE, regval);
/* Set up the rising edge detection */
regval = stmpe11_getreg8(priv, STMPE11_GPIO_RE);
if ((pinconfig & STMPE11_GPIO_FALLING) != 0)
regval = stmpe811_getreg8(priv, STMPE811_GPIO_RE);
if ((pinconfig & STMPE811_GPIO_FALLING) != 0)
{
regval |= pinmask;
}
@@ -214,13 +214,13 @@ int stmpe11_gpioconfig(STMPE11_HANDLE handle, uint8_t pinconfig)
{
regval &= pinmask;
}
stmpe11_putreg8(priv, STMPE11_GPIO_RE, regval);
stmpe811_putreg8(priv, STMPE811_GPIO_RE, regval);
/* Disable interrupts for now */
regval = stmpe11_getreg8(priv, STMPE11_GPIO_EN);
regval = stmpe811_getreg8(priv, STMPE811_GPIO_EN);
regval &= ~pinmask;
stmpe11_putreg8(priv, STMPE11_GPIO_EN, regval);
stmpe811_putreg8(priv, STMPE811_GPIO_EN, regval);
}
/* Mark the pin as 'in use' */
@@ -231,13 +231,13 @@ int stmpe11_gpioconfig(STMPE11_HANDLE handle, uint8_t pinconfig)
}
/****************************************************************************
* Name: stmpe11_gpiowrite
* Name: stmpe811_gpiowrite
*
* Description:
* Set or clear the GPIO output
*
* Input Parameters:
* handle - The handle previously returned by stmpe11_instantiate
* handle - The handle previously returned by stmpe811_instantiate
* pinconfig - Bit-encoded pin configuration
* value = true: write logic '1'; false: write logic '0;
*
@@ -246,13 +246,13 @@ int stmpe11_gpioconfig(STMPE11_HANDLE handle, uint8_t pinconfig)
*
****************************************************************************/
void stmpe11_gpiowrite(STMPE11_HANDLE handle, uint8_t pinconfig, bool value)
void stmpe811_gpiowrite(STMPE811_HANDLE handle, uint8_t pinconfig, bool value)
{
FAR struct stmpe11_dev_s *priv = (FAR struct stmpe11_dev_s *)handle;
int pin = (pinconfig & STMPE11_GPIO_PIN_MASK) >> STMPE11_GPIO_PIN_SHIFT;
FAR struct stmpe811_dev_s *priv = (FAR struct stmpe811_dev_s *)handle;
int pin = (pinconfig & STMPE811_GPIO_PIN_MASK) >> STMPE811_GPIO_PIN_SHIFT;
int ret;
DEBUGASSERT(handle && (unsigned)pin < STMPE11_GPIO_NPINS);
DEBUGASSERT(handle && (unsigned)pin < STMPE811_GPIO_NPINS);
/* Get exclusive access to the device structure */
@@ -269,26 +269,26 @@ void stmpe11_gpiowrite(STMPE11_HANDLE handle, uint8_t pinconfig, bool value)
{
/* Set the output valu(s)e by writing to the SET register */
stmpe11_putreg8(priv, STMPE11_GPIO_SETPIN, (1 << pin));
stmpe811_putreg8(priv, STMPE811_GPIO_SETPIN, (1 << pin));
}
else
{
/* Clear the output value(s) by writing to the CLR register */
stmpe11_putreg8(priv, STMPE11_GPIO_CLRPIN, (1 << pin));
stmpe811_putreg8(priv, STMPE811_GPIO_CLRPIN, (1 << pin));
}
sem_post(&priv->exclsem);
}
/****************************************************************************
* Name: stmpe11_gpioread
* Name: stmpe811_gpioread
*
* Description:
* Set or clear the GPIO output
*
* Input Parameters:
* handle - The handle previously returned by stmpe11_instantiate
* handle - The handle previously returned by stmpe811_instantiate
* pinconfig - Bit-encoded pin configuration
* value - The location to return the state of the GPIO pin
*
@@ -298,14 +298,14 @@ void stmpe11_gpiowrite(STMPE11_HANDLE handle, uint8_t pinconfig, bool value)
*
****************************************************************************/
int stmpe11_gpioread(STMPE11_HANDLE handle, uint8_t pinconfig, bool *value)
int stmpe811_gpioread(STMPE811_HANDLE handle, uint8_t pinconfig, bool *value)
{
FAR struct stmpe11_dev_s *priv = (FAR struct stmpe11_dev_s *)handle;
int pin = (pinconfig & STMPE11_GPIO_PIN_MASK) >> STMPE11_GPIO_PIN_SHIFT;
FAR struct stmpe811_dev_s *priv = (FAR struct stmpe811_dev_s *)handle;
int pin = (pinconfig & STMPE811_GPIO_PIN_MASK) >> STMPE811_GPIO_PIN_SHIFT;
uint8_t regval;
int ret;
DEBUGASSERT(handle && (unsigned)pin < STMPE11_GPIO_NPINS);
DEBUGASSERT(handle && (unsigned)pin < STMPE811_GPIO_NPINS);
/* Get exclusive access to the device structure */
@@ -317,14 +317,14 @@ int stmpe11_gpioread(STMPE11_HANDLE handle, uint8_t pinconfig, bool *value)
return -errval;
}
regval = stmpe11_getreg8(priv, STMPE11_GPIO_MPSTA);
regval = stmpe811_getreg8(priv, STMPE811_GPIO_MPSTA);
*value = ((regval & GPIO_PIN(pin)) != 0);
sem_post(&priv->exclsem);
return OK;
}
/***********************************************************************************
* Name: stmpe11_gpioattach
* Name: stmpe811_gpioattach
*
* Description:
* Attach to a GPIO interrupt input pin and enable interrupts on the pin. Using
@@ -335,7 +335,7 @@ int stmpe11_gpioread(STMPE11_HANDLE handle, uint8_t pinconfig, bool *value)
* context of the worker thread.
*
* Input Parameters:
* handle - The handle previously returned by stmpe11_instantiate
* handle - The handle previously returned by stmpe811_instantiate
* pinconfig - Bit-encoded pin configuration
* handler - The handler that will be called when the interrupt occurs.
*
@@ -345,16 +345,16 @@ int stmpe11_gpioread(STMPE11_HANDLE handle, uint8_t pinconfig, bool *value)
*
************************************************************************************/
#ifndef CONFIG_STMPE11_GPIOINT_DISABLE
int stmpe11_gpioattach(STMPE11_HANDLE handle, uint8_t pinconfig,
stmpe11_handler_t handler)
#ifndef CONFIG_STMPE811_GPIOINT_DISABLE
int stmpe811_gpioattach(STMPE811_HANDLE handle, uint8_t pinconfig,
stmpe811_handler_t handler)
{
FAR struct stmpe11_dev_s *priv = (FAR struct stmpe11_dev_s *)handle;
int pin = (pinconfig & STMPE11_GPIO_PIN_MASK) >> STMPE11_GPIO_PIN_SHIFT;
FAR struct stmpe811_dev_s *priv = (FAR struct stmpe811_dev_s *)handle;
int pin = (pinconfig & STMPE811_GPIO_PIN_MASK) >> STMPE811_GPIO_PIN_SHIFT;
uint8_t regval;
int ret;
DEBUGASSERT(handle && (unsigned)pin < STMPE11_GPIO_NPINS);
DEBUGASSERT(handle && (unsigned)pin < STMPE811_GPIO_NPINS);
/* Get exclusive access to the device structure */
@@ -368,7 +368,7 @@ int stmpe11_gpioattach(STMPE11_HANDLE handle, uint8_t pinconfig,
/* Make sure that the GPIO interrupt system has been gpioinitialized */
stmpe11_gpioinit(priv);
stmpe811_gpioinit(priv);
/* Set/clear the handler */
@@ -376,7 +376,7 @@ int stmpe11_gpioattach(STMPE11_HANDLE handle, uint8_t pinconfig,
/* If an handler has provided, then we are enabling interrupts */
regval = stmpe11_getreg8(priv, STMPE11_GPIO_EN);
regval = stmpe811_getreg8(priv, STMPE811_GPIO_EN);
if (handler)
{
/* Enable interrupts for this GPIO */
@@ -389,7 +389,7 @@ int stmpe11_gpioattach(STMPE11_HANDLE handle, uint8_t pinconfig,
regval &= ~GPIO_PIN(pin);
}
stmpe11_putreg8(priv, STMPE11_GPIO_EN, regval);
stmpe811_putreg8(priv, STMPE811_GPIO_EN, regval);
sem_post(&priv->exclsem);
return OK;
@@ -397,7 +397,7 @@ int stmpe11_gpioattach(STMPE11_HANDLE handle, uint8_t pinconfig,
#endif
/****************************************************************************
* Name: stmpe11_gpioworker
* Name: stmpe811_gpioworker
*
* Description:
* Handle GPIO interrupt events (this function actually executes in the
@@ -405,8 +405,8 @@ int stmpe11_gpioattach(STMPE11_HANDLE handle, uint8_t pinconfig,
*
****************************************************************************/
#ifndef CONFIG_STMPE11_GPIOINT_DISABLE
void stmpe11_gpioworker(FAR struct stmpe11_dev_s *priv)
#ifndef CONFIG_STMPE811_GPIOINT_DISABLE
void stmpe811_gpioworker(FAR struct stmpe811_dev_s *priv)
{
uint8_t regval;
uint8_t pinmask;
@@ -414,11 +414,11 @@ void stmpe11_gpioworker(FAR struct stmpe11_dev_s *priv)
/* Get the set of pending GPIO interrupts */
regval = stmpe11_getreg8(priv, STMPE11_GPIO_INTSTA);
regval = stmpe811_getreg8(priv, STMPE811_GPIO_INTSTA);
/* Look at each pin */
for (pin = 0; pin < SMTPE11_GPIO_NPINS; pin++)
for (pin = 0; pin < STMPE811_GPIO_NPINS; pin++)
{
pinmask = GPIO_INT(pin);
if ((regval & pinmask) != 0)
@@ -444,11 +444,11 @@ void stmpe11_gpioworker(FAR struct stmpe11_dev_s *priv)
* pin position in the status register.
*/
stmpe11_putreg8(priv, STMPE11_GPIO_INTSTA, pinmask);
stmpe811_putreg8(priv, STMPE811_GPIO_INTSTA, pinmask);
}
}
}
#endif
#endif /* CONFIG_INPUT && CONFIG_INPUT_STMPE11 && !CONFIG_STMPE11_GPIO_DISABLE */
#endif /* CONFIG_INPUT && CONFIG_INPUT_STMPE811 && !CONFIG_STMPE811_GPIO_DISABLE */
+22 -22
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* drivers/input/stmpe11_temp.c
* drivers/input/stmpe811_temp.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -47,11 +47,11 @@
#include <errno.h>
#include <debug.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_TEMP_DISABLE)
#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_STMPE811) && !defined(CONFIG_STMPE811_TEMP_DISABLE)
/****************************************************************************
* Private Types
@@ -70,13 +70,13 @@
****************************************************************************/
/****************************************************************************
* Name: stmpe11_tempinitialize
* Name: stmpe811_tempinitialize
*
* Description:
* Configure the temperature sensor.
*
* 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
@@ -84,36 +84,36 @@
*
****************************************************************************/
int stmpe11_tempinitialize(STMPE11_HANDLE handle)
int stmpe811_tempinitialize(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;
/* Enable clocking for ADC and the temperature sensor */
regval = stmpe11_getreg8(priv, STMPE11_SYS_CTRL2);
regval = stmpe811_getreg8(priv, STMPE811_SYS_CTRL2);
regval &= ~(SYS_CTRL2_TS_OFF | SYS_CTRL2_ADC_OFF);
stmpe11_putreg8(priv, STMPE11_SYS_CTRL2, regval);
stmpe811_putreg8(priv, STMPE811_SYS_CTRL2, regval);
/* Enable the temperature sensor */
stmpe11_putreg8(priv, STMPE11_TEMP_CTRL, TEMP_CTRL_ENABLE);
stmpe811_putreg8(priv, STMPE811_TEMP_CTRL, TEMP_CTRL_ENABLE);
/* Aquire data enable */
stmpe11_putreg8(priv, STMPE11_TEMP_CTRL, (TEMP_CTRL_ACQ|TEMP_CTRL_ENABLE));
stmpe811_putreg8(priv, STMPE811_TEMP_CTRL, (TEMP_CTRL_ACQ|TEMP_CTRL_ENABLE));
return OK;
}
/****************************************************************************
* Name: stmpe11_tempread
* Name: stmpe811_tempread
*
* Description:
* Configure the temperature sensor.
*
* 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
@@ -121,21 +121,21 @@ int stmpe11_tempinitialize(STMPE11_HANDLE handle)
*
****************************************************************************/
uint16_t stmpe11_tempread(STMPE11_HANDLE handle)
uint16_t stmpe811_tempread(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;
uint32_t temp = 0;
uint8_t temp1;
uint8_t temp2;
/* Acquire data enable */
stmpe11_putreg8(priv, STMPE11_TEMP_CTRL, (TEMP_CTRL_ACQ|TEMP_CTRL_ENABLE));
stmpe811_putreg8(priv, STMPE811_TEMP_CTRL, (TEMP_CTRL_ACQ|TEMP_CTRL_ENABLE));
/* Read the temperature */
temp1 = stmpe11_getreg8(priv, STMPE11_SYS_CTRL2);
temp2 = stmpe11_getreg8(priv, STMPE11_SYS_CTRL2+1);
temp1 = stmpe811_getreg8(priv, STMPE811_SYS_CTRL2);
temp2 = stmpe811_getreg8(priv, STMPE811_SYS_CTRL2+1);
/* Scale the temperature (where Vio is assumed to be .33) */
@@ -147,7 +147,7 @@ uint16_t stmpe11_tempread(STMPE11_HANDLE handle)
}
/****************************************************************************
* Name: stmpe11_tempinterrupt
* Name: stmpe811_tempinterrupt
*
* Description:
* Configure the temperature sensor to sample the temperature periodically.
@@ -155,7 +155,7 @@ uint16_t stmpe11_tempread(STMPE11_HANDLE handle)
* to the client using the provide callback function pointer.
*
* Input Parameters:
* handle - The handle previously returned by stmpe11_instantiate
* handle - The handle previously returned by stmpe811_instantiate
* threshold - The threshold temperature value
* direction - True: Generate an interrupt if the temperate exceeds the
* threshold value; False: Generate an interrupt if the
@@ -170,5 +170,5 @@ uint16_t stmpe11_tempread(STMPE11_HANDLE handle)
****************************************************************************/
/* Not implemented */
#endif /* CONFIG_INPUT && CONFIG_INPUT_STMPE11 && !CONFIG_STMPE11_TEMP_DISABLE */
#endif /* CONFIG_INPUT && CONFIG_INPUT_STMPE811 && !CONFIG_STMPE811_TEMP_DISABLE */
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -546,10 +546,10 @@ extern "C" {
#ifdef CONFIG_STMPE811_SPI
EXTERN STMPE811_HANDLE stmpe811_instantiate(FAR struct spi_dev_s *dev,
FAR struct stmpe811_config_s *config);
FAR struct stmpe811_config_s *config);
#else
EXTERN STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_dev_s *dev,
FAR struct stmpe811_config_s *config);
FAR struct stmpe811_config_s *config);
#endif
/********************************************************************************************
@@ -657,7 +657,7 @@ EXTERN int stmpe811_gpioread(STMPE811_HANDLE handle, uint8_t pinconfig, bool *va
#if !defined(CONFIG_STMPE811_GPIO_DISABLE) && !defined(CONFIG_STMPE811_GPIOINT_DISABLE)
EXTERN int stmpe811_gpioattach(STMPE811_HANDLE handle, uint8_t pinconfig,
stmpe811_handler_t handler);
stmpe811_handler_t handler);
#endif
/********************************************************************************************