예제 #1
0
/*!
 * @brief  Logs information about the chip.
 */
void mxt_display_chip_info(struct mxt_device *mxt)
{
  struct mxt_object obj;
  char firmware_version[MXT_FW_VER_LEN];
  struct mxt_id_info *id = mxt->info.id;
  int i;

  mxt_get_firmware_version(mxt, (char *)&firmware_version);

  /* Display ID information */
  mxt_dbg(mxt->ctx, "Family ID = %u (0x%02X)",
          id->family, id->family);
  mxt_dbg(mxt->ctx, "Variant ID = %u (0x%02X)",
          id->variant, id->variant);
  mxt_dbg(mxt->ctx, "Firmware Version = %s", firmware_version);
  mxt_dbg(mxt->ctx, "Matrix X Size = %d", id->matrix_x_size);
  mxt_dbg(mxt->ctx, "Matrix Y Size = %d", id->matrix_y_size);
  mxt_dbg(mxt->ctx, "Number of elements in the Object Table = %d",
          id->num_objects);

  /* Display information about specific objects */
  for (i = 0; i < id->num_objects; i++) {
    obj = mxt->info.objects[i];

    mxt_dbg(mxt->ctx, "T%u size:%u instances:%u address:%u",
            obj.type, MXT_SIZE(obj),
            MXT_INSTANCES(obj), mxt_get_start_position(obj, 0));
  }
}
예제 #2
0
/*!
 * @brief  Populates a look-up table for the report IDs.
 * @return #mxt_rc
 */
int mxt_calc_report_ids(struct mxt_device *mxt)
{
  /* Report ID zero is reserved - start from one */
  int num_report_ids = 1;
  int report_id_count = 1;

  int i;
  int instance;
  int report_index;

  struct mxt_object obj;

  /* Calculate the number of report IDs */
  for (i = 0; i < mxt->info.id->num_objects; i++)
  {
    obj = mxt->info.objects[i];
    num_report_ids += MXT_INSTANCES(obj) * obj.num_report_ids;
  }

  /* Allocate memory for report ID look-up table */
  mxt->report_id_map = calloc(num_report_ids, sizeof(struct mxt_report_id_map));
  if (mxt->report_id_map == NULL)
  {
    mxt_err(mxt->ctx, "calloc failure");
    return MXT_ERROR_NO_MEM;
  }

  /* Store the object and instance for each report ID */
  for (i = 0; i < mxt->info.id->num_objects; i++)
  {
    obj = mxt->info.objects[i];

    for (instance = 0; instance < MXT_INSTANCES(obj); instance++)
    {
      for (report_index = 0; report_index < obj.num_report_ids; report_index++)
      {
        mxt->report_id_map[report_id_count].object_type = obj.type;
        mxt->report_id_map[report_id_count].instance = instance;
        report_id_count++;
      }
    }
  }

  mxt_verb(mxt->ctx, "Created a look-up table of %d Report IDs", report_id_count);

  return MXT_SUCCESS;
}
예제 #3
0
//******************************************************************************
/// \brief Print T25 limits for each enabled touch object
static void print_t25_limits(struct mxt_device *mxt, uint16_t t25_addr)
{
   int i;
   struct mxt_object obj;
   int touch_object = 0;
   uint8_t buf[4];
   uint16_t upsiglim;
   uint16_t losiglim;
   int instance;

   for (i = 0; i < mxt->info.id->num_objects; i++)
   {
      obj = mxt->info.objects[i];

      switch (obj.type)
      {
      case TOUCH_MULTITOUCHSCREEN_T9:
      case TOUCH_SINGLETOUCHSCREEN_T10:
      case TOUCH_XSLIDER_T11:
      case TOUCH_YSLIDER_T12:
      case TOUCH_XWHEEL_T13:
      case TOUCH_YWHEEL_T14:
      case TOUCH_KEYARRAY_T15:
      case TOUCH_PROXIMITY_T23:
      case TOUCH_KEYSET_T31:
      case TOUCH_XSLIDERSET_T32:
         for (instance = 0; (instance < MXT_INSTANCES(obj)); instance++)
         {
            mxt_read_register(mxt, (uint8_t *)&buf, mxt_get_start_position(obj, instance), 1);

            mxt_info(mxt->ctx, "%s[%d] %s",
                   mxt_get_object_name(obj.type),
                   instance,
                   buf[0] & 0x01 ? "enabled":"disabled");

            mxt_read_register(mxt, (uint8_t *)&buf,
               t25_addr + 2 + touch_object * 4, 4);

            upsiglim = (uint16_t)((buf[1] << 8u) | buf[0]);
            losiglim = (uint16_t)((buf[3] << 8u) | buf[2]);

            mxt_info(mxt->ctx, "  UPSIGLIM:%d", upsiglim);
            mxt_info(mxt->ctx, "  LOSIGLIM:%d", losiglim);

            touch_object++;
         }
         break;
      default:
         break;
      }
   }
   
}
예제 #4
0
/*!
 * @param mxt Maxtouch Device
 * @param object_type Object ID number.
 *
 * @brief  Returns the number of instances of the specific object type
 * @return number of instances, zero if not found
 */
uint8_t mxt_get_object_instances(struct mxt_device *mxt, uint16_t object_type)
{
  struct mxt_id_info *id = mxt->info.id;
  int i;

  for (i = 0; i < id->num_objects; i++) {
    if (mxt->info.objects[i].type == object_type) {
      return MXT_INSTANCES(mxt->info.objects[i]);
    }
  }

  return 0;
}