Microchip® Advanced Software Framework

mxt_device.h File Reference

maXTouch component.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdint.h>
#include <status_codes.h>
#include <twi_master.h>
#include "conf_mxt.h"

Data Structures

struct  mxt_conf_messageprocessor_t5
 Object message. More...
 
struct  mxt_device
 maXTouch device information data container struct More...
 
struct  mxt_gen_commandprocessor_t6
 Commandprocessor T6 object. More...
 
struct  mxt_info_object
 Identification header. More...
 
struct  mxt_object
 Object table entry. More...
 
struct  mxt_report_id_map
 Map of the report ID vs object type and instance. More...
 
struct  mxt_touch_event
 Touch event struct. More...
 

Macros

#define MXT_MAX_MSG_SIZE   7
 
#define MXT_RESET_TIME   65
 
#define MXT_TWI_MSG_SIZE_T5   MXT_MAX_MSG_SIZE + 2
 
COMMSCONFIG T18 object control register bit positions
#define MXT_COMMSCONFIG_T18_CHG_MODE_bp   2
 
#define MXT_COMMSCONFIG_T18_DISMNTR_bp   7
 
COMMANDPROCESSOR T6 object register offset
#define MXT_GEN_COMMANDPROCESSOR_RESET   0
 
#define MXT_GEN_COMMANDPROCESSOR_BACKUPNV   1
 
#define MXT_GEN_COMMANDPROCESSOR_CALIBRATE   2
 
#define MXT_GEN_COMMANDPROCESSOR_REPORTALL   3
 
#define MXT_GEN_COMMANDPROCESSOR_DIAGNOSTIC   5
 
Touch event types
#define MXT_UNGRIP_EVENT   1
 
#define MXT_SUPPRESS_EVENT   2
 
#define MXT_AMP_EVENT   4
 
#define MXT_VECTOR_EVENT   8
 
#define MXT_MOVE_EVENT   16
 
#define MXT_RELEASE_EVENT   32
 
#define MXT_PRESS_EVENT   64
 
#define MXT_DETECT_EVENT   128
 

Typedefs

typedef uint16_t mxt_memory_adr
 
typedef void(* mxt_message_handler_t )(struct mxt_device *device, struct mxt_conf_messageprocessor_t5 *message)
 Message handler prototype. More...
 

Enumerations

enum  mxt_object_type {
  MXT_GEN_MESSAGEPROCESSOR_T5 = 5,
  MXT_GEN_COMMANDPROCESSOR_T6 = 6,
  MXT_GEN_POWERCONFIG_T7 = 7,
  MXT_GEN_ACQUISITIONCONFIG_T8 = 8,
  MXT_TOUCH_MULTITOUCHSCREEN_T9 = 9,
  MXT_SPT_COMMSCONFIG_T18 = 18,
  MXT_SPT_MESSAGECOUNT_T44 = 44,
  MXT_PROCG_TOUCHSUPPRESSION_T48 = 48
}
 Object types. More...
 

Functions

status_code_t mxt_close_device (struct mxt_device *device)
 Closes the twi connection and frees memory. More...
 
int8_t mxt_get_message_count (struct mxt_device *device)
 Get pending message count. More...
 
uint16_t mxt_get_object_address (struct mxt_device *device, uint8_t object_id, uint8_t instance)
 Get memory address to object. More...
 
enum mxt_object_type mxt_get_object_type (struct mxt_device *device, struct mxt_conf_messageprocessor_t5 *message)
 Get object type from message. More...
 
status_code_t mxt_init_device (struct mxt_device *device, twi_master_t interface, uint8_t chip_adr, uint32_t chgpin)
 Initialize maXTouch device connected to TWIx module. More...
 
bool mxt_is_message_pending (struct mxt_device *device)
 Report if there is any pending messages in the queue. More...
 
status_code_t mxt_load_configuration (struct mxt_device *device, void *configuration_data)
 
status_code_t mxt_probe_device (twi_master_t interface, uint8_t chip_adr)
 Probe for a maXTouch connected to a specific TWI line. More...
 
status_code_t mxt_process_messages (struct mxt_device *device)
 Process message queue on maXTouch device. More...
 
status_code_t mxt_read_config_object (struct mxt_device *device, mxt_memory_adr memory_adr, void *obj_data)
 Read object configuration. More...
 
status_code_t mxt_read_config_reg (struct mxt_device *device, mxt_memory_adr memory_adr, uint8_t *value)
 Read object register. More...
 
status_code_t mxt_read_message (struct mxt_device *device, struct mxt_conf_messageprocessor_t5 *message)
 Get next message in queue. More...
 
status_code_t mxt_read_touch_event (struct mxt_device *device, struct mxt_touch_event *touch_event)
 Read next touch event in queue, skip other events (other events are lost) More...
 
void mxt_set_message_handler (struct mxt_device *device, mxt_message_handler_t handler)
 Set message handler. More...
 
status_code_t mxt_write_config_object (struct mxt_device *device, mxt_memory_adr memory_adr, void *obj_data)
 Write object configuration. More...
 
status_code_t mxt_write_config_reg (struct mxt_device *device, mxt_memory_adr memory_adr, uint8_t value)
 Write object register. More...
 

#define MXT_MAX_MSG_SIZE   7
#define MXT_RESET_TIME   65

Referenced by mxt_init().

#define MXT_TWI_MSG_SIZE_T5   MXT_MAX_MSG_SIZE + 2

typedef uint16_t mxt_memory_adr