maXTouch component.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | MXT_FAMILY_143E 0x81 |
#define | MXT_ID_BLOCK_SIZE 7 |
#define | MXT_MEM_ADDR 0x00 |
#define | MXT_VARIANT_143E 0x07 |
#define | OBJECT_TABLE_ELEMENT_SIZE 6 |
#define | OBJECT_TABLE_START_ADDRESS 7 |
Functions | |
static status_code_t | mxt_calculate_infoblock_crc (struct mxt_device *device, uint32_t *crc) |
Calculates the crc checksum of the data in the info block. More... | |
status_code_t | mxt_close_device (struct mxt_device *device) |
Closes the twi connection and frees memory. More... | |
static uint32_t | mxt_crc_24 (uint32_t crc, uint8_t byte1, uint8_t byte2) |
Calculates the next crc value of current crc value and the following two bytes. More... | |
static uint8_t | mxt_crc_8 (uint8_t crc, uint8_t data) |
Calculates the next crc value of current crc value and the following byte. More... | |
static status_code_t | mxt_create_report_id_map (struct mxt_device *device) |
Create report ID map from the object list in mxt_device. More... | |
static uint32_t | mxt_get_crc_value (struct mxt_device *device) |
Reads out the crc value stored in the mxt-device. 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... | |
static uint8_t | mxt_get_object_size (struct mxt_device *device, mxt_memory_adr mem_adr) |
Returns the object size by using the object address. 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... | |
static int8_t | mxt_get_report_id_offset (struct mxt_device *device, enum mxt_object_type object_type) |
Returns the report id offset for a object. More... | |
static uint8_t | mxt_get_tot_report_ids (struct mxt_device *device) |
Total number of report ids available in the maXTouch device. More... | |
static void | mxt_info_le_to_cpu (struct mxt_device *device) |
Do any potential endian conversions in info block. More... | |
status_code_t | mxt_init_device (struct mxt_device *device, twihs_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_probe_device (twihs_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... | |
static status_code_t | mxt_read_id_block (struct mxt_device *device) |
Read out the id information from the maXTouch device and put it into the info_object struct in the device instance. More... | |
static status_code_t | mxt_read_info_block (struct mxt_device *device) |
Read info block from device. More... | |
status_code_t | mxt_read_message (struct mxt_device *device, struct mxt_conf_messageprocessor_t5 *message) |
Get next message in queue. More... | |
static status_code_t | mxt_read_object_table (struct mxt_device *device) |
Read out the object table from the maXTouch device and put it into the object_list structs in the device instance. 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... | |
static status_code_t | mxt_validate_info_block (struct mxt_device *device) |
Validates the info block by comparing the calculated Compares the calculated and stored crc value. More... | |
static status_code_t | mxt_validate_message (twihs_package_t *packet) |
Validates the message received from the maXTouch device. 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_FAMILY_143E 0x81 |
Referenced by mxt_probe_device().
#define MXT_ID_BLOCK_SIZE 7 |
Referenced by mxt_calculate_infoblock_crc(), mxt_get_crc_value(), and mxt_read_id_block().
#define MXT_MEM_ADDR 0x00 |
Referenced by mxt_probe_device(), and mxt_read_id_block().
#define MXT_VARIANT_143E 0x07 |
Referenced by mxt_probe_device().
#define OBJECT_TABLE_ELEMENT_SIZE 6 |
Referenced by mxt_calculate_infoblock_crc(), and mxt_get_crc_value().
#define OBJECT_TABLE_START_ADDRESS 7 |
Referenced by mxt_read_object_table().
|
static |
Calculates the crc checksum of the data in the info block.
*device | Pointer to mxt_device instance |
*crc | Pointer to the crc variable |
References mxt_device::info_object, mxt_crc_24(), MXT_ID_BLOCK_SIZE, mxt_info_object::obj_count, mxt_device::object_list, OBJECT_TABLE_ELEMENT_SIZE, and STATUS_OK.
Referenced by mxt_validate_info_block().
|
inlinestatic |
Calculates the next crc value of current crc value and the following two bytes.
crc | |
byte1 | |
byte2 |
Referenced by mxt_calculate_infoblock_crc().
|
inlinestatic |
Calculates the next crc value of current crc value and the following byte.
crc | |
data |
Referenced by mxt_validate_message().
|
static |
Create report ID map from the object list in mxt_device.
*device | Pointer to mxt_device instance |
References mxt_device::info_object, mxt_report_id_map::instance, mxt_object::instances, mxt_get_tot_report_ids(), mxt_object::num_report_ids, mxt_info_object::obj_count, mxt_device::object_list, mxt_report_id_map::object_type, mxt_device::report_id_map, STATUS_OK, and mxt_object::type.
Referenced by mxt_init_device().
|
static |
Reads out the crc value stored in the mxt-device.
*device | Pointer to mxt_device instance |
References twihs_packet::addr, addr, ERR_IO_ERROR, mxt_device::info_object, mxt_device::interface, mxt_device::mxt_chip_adr, MXT_ID_BLOCK_SIZE, mxt_info_object::obj_count, OBJECT_TABLE_ELEMENT_SIZE, STATUS_OK, and twihs_master_read().
Referenced by mxt_validate_info_block().
|
static |
Returns the object size by using the object address.
*device | Pointer to mxt_device instance |
mem_adr | Address of the object |
References mxt_device::info_object, mxt_info_object::obj_count, mxt_device::object_list, mxt_object::size, and mxt_object::start_address.
Referenced by mxt_read_config_object(), and mxt_write_config_object().
|
static |
Returns the report id offset for a object.
*device | Pointer to mxt_device instance |
object_type | ID of the object |
References mxt_get_tot_report_ids(), mxt_report_id_map::object_type, and mxt_device::report_id_map.
Referenced by mxt_init_device().
|
static |
Total number of report ids available in the maXTouch device.
*device | Pointer to mxt_device instance |
References mxt_device::info_object, mxt_object::num_report_ids, mxt_info_object::obj_count, and mxt_device::object_list.
Referenced by mxt_create_report_id_map(), and mxt_get_report_id_offset().
|
static |
Do any potential endian conversions in info block.
*device | Pointer to mxt_device instance |
References mxt_device::info_object, le16_to_cpu, mxt_info_object::obj_count, mxt_device::object_list, and mxt_object::start_address.
Referenced by mxt_init_device().
|
static |
Read out the id information from the maXTouch device and put it into the info_object struct in the device instance.
*device | Pointer to mxt_device instance |
References twihs_packet::addr, ERR_IO_ERROR, mxt_device::info_object, mxt_device::interface, mxt_device::mxt_chip_adr, MXT_ID_BLOCK_SIZE, MXT_MEM_ADDR, STATUS_OK, and twihs_master_read().
Referenced by mxt_read_info_block().
|
inlinestatic |
Read info block from device.
*device | Pointer to mxt_device instance |
References mxt_read_id_block(), mxt_read_object_table(), status, and STATUS_OK.
Referenced by mxt_init_device().
|
static |
Read out the object table from the maXTouch device and put it into the object_list structs in the device instance.
*device | Pointer to mxt_device instance |
References twihs_packet::addr, ERR_IO_ERROR, mxt_device::info_object, mxt_device::interface, mxt_device::mxt_chip_adr, mxt_info_object::obj_count, mxt_device::object_list, OBJECT_TABLE_START_ADDRESS, STATUS_OK, and twihs_master_read().
Referenced by mxt_read_info_block().
|
static |
Validates the info block by comparing the calculated Compares the calculated and stored crc value.
*device | Pointer to mxt_device instance |
References ERR_BAD_DATA, mxt_calculate_infoblock_crc(), mxt_get_crc_value(), and STATUS_OK.
Referenced by mxt_init_device().
|
inlinestatic |
Validates the message received from the maXTouch device.
packet | Message received from the maXTouch device |
References twihs_packet::buffer, ERR_BAD_DATA, mxt_crc_8(), MXT_TWI_MSG_SIZE_T5, and STATUS_OK.
Referenced by mxt_read_message().