maXTouch: Fix I2C address, errors when debug enable, reorganize some data
This commit is contained in:
parent
560409c912
commit
b4d3cebc2f
@ -70,9 +70,10 @@
|
||||
# define CONFIG_SAMA5D4EK_MXT_DEVMINOR 0
|
||||
#endif
|
||||
|
||||
/* The touchscreen communicates on TWI0 */
|
||||
/* The touchscreen communicates on TWI0, I2C address 0x4c */
|
||||
|
||||
#define MXT_BUSNUM 0
|
||||
#define MXT_TWI_BUS 0
|
||||
#define MXT_I2C_ADDRESS 0x4c
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
@ -128,7 +129,7 @@ static struct sama5d4ek_tscinfo_s g_mxtinfo =
|
||||
{
|
||||
.lower =
|
||||
{
|
||||
.address = (0x4c >> 1),
|
||||
.address = MXT_I2C_ADDRESS,
|
||||
.frequency = CONFIG_SAMA5D4EK_MXT_I2CFREQUENCY,
|
||||
|
||||
.attach = mxt_attach,
|
||||
@ -259,10 +260,10 @@ int arch_tcinitialize(int minor)
|
||||
|
||||
/* Get an instance of the I2C interface for the touchscreen chip select */
|
||||
|
||||
i2c = up_i2cinitialize(MXT_BUSNUM);
|
||||
i2c = up_i2cinitialize(MXT_TWI_BUS);
|
||||
if (!i2c)
|
||||
{
|
||||
idbg("Failed to initialize I2C%d\n", MXT_BUSNUM);
|
||||
idbg("Failed to initialize I2C%d\n", MXT_TWI_BUS);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -126,21 +126,6 @@ struct mxt_info_s
|
||||
};
|
||||
#define MXT_INFO_SIZE 7
|
||||
|
||||
struct mxt_object_s
|
||||
{
|
||||
uint8_t type; /* Object type */
|
||||
uint8_t addr[2]; /* Start address */
|
||||
uint8_t size; /* Size of each instance - 1 */
|
||||
uint8_t ninstances; /* Number of instances - 1 */
|
||||
uint8_t nids; /* Number of report IDs */
|
||||
};
|
||||
|
||||
struct mxt_msg_s
|
||||
{
|
||||
uint8_t id; /* Report ID */
|
||||
uint8_t body[7]; /* Message body */
|
||||
};
|
||||
|
||||
/* Describes the state of the MXT driver */
|
||||
|
||||
struct mxt_dev_s
|
||||
@ -814,7 +799,7 @@ static void mxt_worker(FAR void *arg)
|
||||
uint32_t chksum;
|
||||
int status;
|
||||
|
||||
status = msg_body[0]
|
||||
status = msg.body[0];
|
||||
chksum = (uint32_t)msg.body[1] |
|
||||
((uint32_t)msg.body[2] << 8) |
|
||||
((uint32_t)msg.body[3] << 16);
|
||||
@ -845,8 +830,8 @@ static void mxt_worker(FAR void *arg)
|
||||
else
|
||||
{
|
||||
ivdbg("Ignored: id=%u message={%02x %02x %02x %02x %02x %02x %02x}\n",
|
||||
msg->id, msg->body[0], msg->body[1], msg->body[2], msg->body[3],
|
||||
msg->body[4], msg->body[5], msg->body[6], msg->body[7]);
|
||||
msg.id, msg.body[0], msg.body[1], msg.body[2], msg.body[3],
|
||||
msg.body[4], msg.body[5], msg.body[6]);
|
||||
}
|
||||
}
|
||||
while (id != 0xff);
|
||||
@ -1705,7 +1690,7 @@ int mxt_register(FAR struct i2c_dev_s *i2c,
|
||||
ret = mxt_hwinitialize(priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
idbg("ERROR: mxt_hwinitialize failed: %d\n", reg);
|
||||
idbg("ERROR: mxt_hwinitialize failed: %d\n", ret);
|
||||
goto errout_with_irq;
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,6 @@
|
||||
# define MXT_OBJECT_NUM 0x06 /* Number of objects */
|
||||
#define MXT_OBJECT_START 0x07
|
||||
|
||||
#define MXT_OBJECT_SIZE 6
|
||||
|
||||
/* Object types */
|
||||
|
||||
#define MXT_DEBUG_DIAGNOSTIC_T37 37
|
||||
@ -255,6 +253,25 @@
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
/* This structure describes one maXTouch object */
|
||||
|
||||
struct mxt_object_s
|
||||
{
|
||||
uint8_t type; /* Object type */
|
||||
uint8_t addr[2]; /* Start address */
|
||||
uint8_t size; /* Size of each instance - 1 */
|
||||
uint8_t ninstances; /* Number of instances - 1 */
|
||||
uint8_t nids; /* Number of report IDs */
|
||||
};
|
||||
#define MXT_OBJECT_SIZE 6
|
||||
|
||||
/* This structure describes one maXTouch message */
|
||||
|
||||
struct mxt_msg_s
|
||||
{
|
||||
uint8_t id; /* Report ID */
|
||||
uint8_t body[7]; /* Message body */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -79,13 +79,6 @@
|
||||
# error "Work queue support required. CONFIG_SCHED_WORKQUEUE must be selected."
|
||||
#endif
|
||||
|
||||
/* I2C addresses ************************************************************/
|
||||
|
||||
#define MXT_APP_LOW 0x4a
|
||||
#define MXT_APP_HIGH 0x4b
|
||||
#define MXT_BOOT_LOW 0x24
|
||||
#define MXT_BOOT_HIGH 0x25
|
||||
|
||||
/* Helper macros ************************************************************/
|
||||
|
||||
#define MXT_ATTACH(s,isr,arg) ((s)->attach(s,isr,arg))
|
||||
@ -120,8 +113,8 @@ struct mxt_lower_s
|
||||
{
|
||||
/* Device characterization */
|
||||
|
||||
uint32_t frequency; /* Initial I2C frequency */
|
||||
uint8_t address; /* 7-bit I2C address (only bits 0-6 used) */
|
||||
uint32_t frequency; /* I2C frequency */
|
||||
|
||||
/* True: Swap X and Y values */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user