コード例 #1
0
ファイル: info_block.c プロジェクト: sonntam/obp-utils
/*!
 * @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
ファイル: info_block.c プロジェクト: sonntam/obp-utils
/*!
 * @param  mxt Maxtouch Device
 * @param  object_type Object ID number.
 * @param  instance Instance number of the object.
 *
 * @brief  Returns the start address of the selected object and instance number
 *         in the chip's memory map.
 * @return Object address, or OBJECT_NOT_FOUND if object/instance not found.
 */
uint16_t mxt_get_object_address(struct mxt_device *mxt, uint16_t object_type, uint8_t instance)
{
  struct mxt_id_info *id = mxt->info.id;
  int i = 0;
  struct mxt_object obj;

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

    /* Does object type match? */
    if (obj.type == object_type) {
      /* Are there enough instances defined in the firmware? */
      if (obj.instances_minus_one >= instance) {
        return mxt_get_start_position(obj, instance);
      } else {
        mxt_warn(mxt->ctx, "T%u instance %u not present on device",
                 object_type, instance);
        return OBJECT_NOT_FOUND;
      }
    }
  }

  mxt_verb(mxt->ctx, "T%u not present on device", object_type);
  return OBJECT_NOT_FOUND;
}
コード例 #3
0
ファイル: self_test.c プロジェクト: prajoshpremdas/obp-utils
//******************************************************************************
/// \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;
      }
   }
   
}