Exemple #1
0
/*! \brief Extract the data packet from QTouch Studio and set channel config.
 * \note  Should only be called from the command handler.
 */
void Set_Channel_Config(void)
{
	touch_ret_t touch_ret = TOUCH_SUCCESS;
	sensor_id_t sensor_id;
	uint8_t type_aks_pos_hyst;
#ifdef DEF_TOUCH_QDEBUG_ENABLE_MUTLCAP
	touch_mutlcap_param_t touch_sensor_param;
#else
	touch_selfcap_param_t touch_sensor_param;
#endif
	sensor_id = GetChar();

	/* Read back and initialize the touch_sensor_param structure.
	 * This is because not all the touch_sensor_param members are
	 * updated by this API. */
	touch_ret
		= QDEBUG_GET_SENSOR_CONFIG_FUNC(sensor_id,
			&touch_sensor_param);
	if (touch_ret != TOUCH_SUCCESS) {
		while (1) {
		}
	}

	/* Update the necessary members of the touch_sensor_param structure
	 * and write back. */
	touch_sensor_param.detect_threshold = GetChar();
	type_aks_pos_hyst = GetChar();
	touch_sensor_param.aks_group
		= (aks_group_t)((uint8_t)((type_aks_pos_hyst & 0x38u) >> 3u));
	touch_sensor_param.detect_hysteresis
		= (hysteresis_t)((uint8_t)(type_aks_pos_hyst & 0x03u));

	touch_ret = QDEBUG_UPDATE_SENSOR_CONFIG_FUNC(sensor_id,
			&touch_sensor_param);
	if (touch_ret != TOUCH_SUCCESS) {
		while (1) {
		}
	}
}
Exemple #2
0
/*============================================================================
Name    :   Set_Channel_Config
------------------------------------------------------------------------------
Purpose :   Extract the data packet from QTouch Studio and set channel config
Input   :   n/a
Output  :   n/a
Notes   :   Should only be called from the command handler
============================================================================*/
void Set_Channel_Config(void)
{
      touch_ret_t touch_ret = TOUCH_SUCCESS;

#if ((DEF_TOUCH_QMATRIX == 1)      || \
     (DEF_TOUCH_QTOUCH_GRP_A == 1) || \
     (DEF_TOUCH_QTOUCH_GRP_B == 1))

      sensor_id_t sensor_id;
      uint8_t type_aks_pos_hyst;

#if (DEF_TOUCH_QMATRIX == 1)
      touch_qm_param_t touch_sensor_param;
#endif

#if ((DEF_TOUCH_QTOUCH_GRP_A == 1) || (DEF_TOUCH_QTOUCH_GRP_B == 1))
      touch_qt_param_t touch_sensor_param;
#endif

      sensor_id = GetChar();

      /* Read back and initialize the touch_sensor_param structure.
         This is because not all the touch_sensor_param members are
         updated by this API. */
      touch_ret = QDEBUG_GET_SENSOR_CONFIG_FUNC( sensor_id, &touch_sensor_param );
      if(touch_ret != TOUCH_SUCCESS)
      {
              while(1);
      }

      /* Update the necessary members of the touch_sensor_param structure
         and write back. */
      touch_sensor_param.detect_threshold  = GetChar();
      type_aks_pos_hyst                    = GetChar();
      touch_sensor_param.aks_group         = (aks_group_t)((uint8_t)((type_aks_pos_hyst & 0x38u) >> 3u ));
      touch_sensor_param.detect_hysteresis = (hysteresis_t)((uint8_t)(type_aks_pos_hyst & 0x03u));

      touch_ret = QDEBUG_UPDATE_SENSOR_CONFIG_FUNC( sensor_id, &touch_sensor_param );
      if(touch_ret != TOUCH_SUCCESS)
      {
              while(1);
      }
#endif

#if DEF_TOUCH_AUTONOMOUS_QTOUCH == 1
      sensor_id_t sensor_id;
      touch_at_param_t touch_sensor_param;

      sensor_id = GetChar(); /* Dummy. To skip sensor_id. */
      /* avoid Cppcheck Warning */
      UNUSED(sensor_id);

      /* Read back and initialize the touch_sensor_param structure.
         This is because not all the touch_sensor_param members are
         updated by this API. */
      touch_ret = QDEBUG_GET_SENSOR_CONFIG_FUNC( &touch_sensor_param );
      if(touch_ret != TOUCH_SUCCESS)
      {
              while(1);
      }

      /* Update the necessary members of the touch_sensor_param structure
         and write back. */
      touch_sensor_param.sense  = GetChar(); /* Sense level (Detect Threshold). */

      touch_ret = QDEBUG_UPDATE_SENSOR_CONFIG_FUNC( &touch_sensor_param );
      if(touch_ret != TOUCH_SUCCESS)
      {
              while(1);
      }
#endif
}