/*============================================================================ Name : Set_Global_Config ------------------------------------------------------------------------------ Purpose : Extract the data packet from QTouch Studio and set global config Input : n/a Output : n/a Notes : Should only be called from the command handler ============================================================================*/ void Set_Global_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)) touch_global_param_t global_params; global_params.recal_threshold = (recal_threshold_t)GetChar(); global_params.di = GetChar(); global_params.drift_hold_time = GetChar(); global_params.max_on_duration = GetChar(); global_params.neg_drift_rate = GetChar(); global_params.pos_drift_rate = GetChar(); global_params.pos_recal_delay = GetChar(); /* update the global parameter value inside the uc3l library */ touch_ret = QDEBUG_UPDATE_GLOBAL_PARAM_FUNC(&global_params); if(touch_ret != TOUCH_SUCCESS) { while(1); } #endif #if DEF_TOUCH_AUTONOMOUS_QTOUCH == 1 touch_at_param_t touch_sensor_param; uint8_t dummy_var; /* Fill touch_sensor_param structure with default values. This is because QTouch Studio does not provide sense and outsense values. So these values should not be overwritten by the update API. */ touch_ret = QDEBUG_GET_GLOBAL_PARAM_FUNC(&touch_sensor_param); if(touch_ret != TOUCH_SUCCESS) { while(1); } /* Update data from QTouch Studio. */ touch_sensor_param.pthr = (recal_threshold_t)GetChar(); touch_sensor_param.filter = GetChar(); dummy_var = GetChar(); /* Skip drift_hold_time. */ dummy_var = GetChar(); /* Skip max_on_duration. */ touch_sensor_param.ndrift = GetChar(); touch_sensor_param.pdrift = GetChar(); /* avoid Cppcheck Warning */ UNUSED(dummy_var); /* update the global parameter value inside the uc3l library */ touch_ret = QDEBUG_UPDATE_GLOBAL_PARAM_FUNC(&touch_sensor_param); if(touch_ret != TOUCH_SUCCESS) { while(1); } #endif }
/*! \brief Extract the data packet from QTouch Studio and set global config. * \note Should only be called from the command handler. */ void Set_Global_Config(void) { touch_ret_t touch_ret; #ifdef DEF_TOUCH_QDEBUG_ENABLE_MUTLCAP touch_config_t *p_touch_config = &touch_config; touch_mutlcap_config_t *p_mutlcap_config = p_touch_config->p_mutlcap_config; p_mutlcap_config->global_param.recal_threshold = (recal_threshold_t)GetChar(); p_mutlcap_config->global_param.di = GetChar(); p_mutlcap_config->global_param.drift_hold_time = GetChar(); p_mutlcap_config->global_param.max_on_duration = GetChar(); p_mutlcap_config->global_param.tch_drift_rate = GetChar(); p_mutlcap_config->global_param.atch_drift_rate = GetChar(); p_mutlcap_config->global_param.atch_recal_delay = GetChar(); #endif #ifdef DEF_TOUCH_QDEBUG_ENABLE_SELFCAP touch_config_t *p_touch_config = &touch_config; touch_selfcap_config_t *p_selfcap_config = p_touch_config->p_selfcap_config; p_selfcap_config->global_param.recal_threshold = GetChar(); p_selfcap_config->global_param.di = GetChar(); p_selfcap_config->global_param.drift_hold_time = GetChar(); p_selfcap_config->global_param.max_on_duration = GetChar(); p_selfcap_config->global_param.tch_drift_rate = GetChar(); p_selfcap_config->global_param.atch_drift_rate = GetChar(); p_selfcap_config->global_param.atch_recal_delay = GetChar(); #endif touch_time.measurement_period_ms = (GetChar() << 8u); touch_time.measurement_period_ms |= GetChar(); #if ((BOARD == SAMD20_XPLAINED_PRO) || (BOARD == SAMD21_XPLAINED_PRO)) touch_time_counter = 0u; #else set_timer_period(touch_time.measurement_period_ms); #endif #ifdef DEF_TOUCH_QDEBUG_ENABLE_SELFCAP /* update the global parameter value inside the SAMD library */ touch_ret = QDEBUG_UPDATE_GLOBAL_PARAM_FUNC( &p_selfcap_config->global_param); if (touch_ret != TOUCH_SUCCESS) { while (1) { } } #endif #ifdef DEF_TOUCH_QDEBUG_ENABLE_MUTLCAP /* update the global parameter value inside the SAMD library */ touch_ret = QDEBUG_UPDATE_GLOBAL_PARAM_FUNC( &p_mutlcap_config->global_param); if (touch_ret != TOUCH_SUCCESS) { while (1) { } } #endif }