diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-29 23:37:33 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-29 23:37:33 +0000 |
commit | 04c0868c718d4c98d6af747cf08f613bc45d1c2c (patch) | |
tree | 4bc1ff8e6606574edc2d3da1a0270eed97cce742 /nuttx/include | |
parent | f46f746f97c06a54a6f1d9c7e4f15389c13a5545 (diff) | |
download | px4-nuttx-04c0868c718d4c98d6af747cf08f613bc45d1c2c.tar.gz px4-nuttx-04c0868c718d4c98d6af747cf08f613bc45d1c2c.tar.bz2 px4-nuttx-04c0868c718d4c98d6af747cf08f613bc45d1c2c.zip |
More logic added to the TSC2007 touchscreen driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3829 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/input/tsc2007.h | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/nuttx/include/nuttx/input/tsc2007.h b/nuttx/include/nuttx/input/tsc2007.h index 75053e005..10e5d778d 100644 --- a/nuttx/include/nuttx/input/tsc2007.h +++ b/nuttx/include/nuttx/input/tsc2007.h @@ -60,6 +60,50 @@ # define CONFIG_TSC2007_NPOLLWAITERS 2 #endif +/* Check for some required settings. This can save the user a lot of time + * in getting the right configuration. + */ + +#ifndef CONFIG_I2C_TRANSFER +# error "CONFIG_I2C_TRANSFER is required in the I2C configuration" +#endif + +#ifdef CONFIG_DISABLE_SIGNALS +# error "Signals are required. CONFIG_DISABLE_SIGNALS must not be selected." +#endif + +#ifndef CONFIG_SCHED_WORKQUEUE +# error "Work queue support required. CONFIG_SCHED_WORKQUEUE must be selected." +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* A reference to a structure of this type must be passed to the TSC2007 + * driver. This structure provides information about the configuration + * of the TSB2007 and provides some board-specific hooks. + * + * Memory for this structure is provided by the caller. It is not copied + * by the driver and is presumed to persist while the driver is active. + */ + +struct tsc2007_config_s +{ + /* Device characterization */ + + uint8_t address; /* 7-bit I2C address (only bits 0-6 used) */ + uint16_t caldata; /* Calibrated X plate resistance data */ + uint32_t frequency; /* I2C frequency */ + + /* IRQ/GPIO access callbacks */ + + int (*attach)(FAR struct tsc2007_config_s *state, xcpt_t isr); + int (*enable)(FAR struct tsc2007_config_s *state, bool enable); + int (*clear)(FAR struct tsc2007_config_s *state); + int (*pendown)(FAR struct tsc2007_config_s *state); +}; + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ @@ -80,8 +124,9 @@ extern "C" { * number * * Input Parameters: - * dev - An I2C driver instance - * minor - The input device minor number + * dev - An I2C driver instance + * config - Persistant board configuration data + * minor - The input device minor number * * Returned Value: * Zero is returned on success. Otherwise, a negated errno value is @@ -89,12 +134,14 @@ extern "C" { * ****************************************************************************/ -EXTERN int tsc2007_register(FAR struct i2c_dev_s *dev, int minor); +EXTERN int tsc2007_register(FAR struct i2c_dev_s *dev, + FAR struct tsc2007_config_s *config, + int minor); #undef EXTERN #ifdef __cplusplus } #endif -#endief /* CONFIG_INPUT && CONFIG_INPUT_TSC2007 */ +#endif /* CONFIG_INPUT && CONFIG_INPUT_TSC2007 */ #endif /* __INCLUDE_NUTTX_INPUT_TSC2007_H */ |