/*! \brief Transmits the global config struct to QTouch Studio. */ void Transmit_Global_Config(void) { #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; touch_ret_t touch_ret = TOUCH_SUCCESS; /* get the global parameters from the library and transmit the global * parameters to the Qtouch Studio */ touch_ret = QDEBUG_GET_GLOBAL_PARAM_FUNC(&p_mutlcap_config->global_param); if (touch_ret != TOUCH_SUCCESS) { while (1) { } } PutChar(QT_GLOBAL_CONFIG); PutChar(p_mutlcap_config->global_param.recal_threshold); PutChar(p_mutlcap_config->global_param.di); PutChar(p_mutlcap_config->global_param.drift_hold_time); PutChar(p_mutlcap_config->global_param.max_on_duration); PutChar(p_mutlcap_config->global_param.tch_drift_rate); PutChar(p_mutlcap_config->global_param.atch_drift_rate); PutChar(p_mutlcap_config->global_param.atch_recal_delay); #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; touch_ret_t touch_ret = TOUCH_SUCCESS; /* get the global parameters from the library and transmit the global * parameters to the Qtouch Studio */ touch_ret = QDEBUG_GET_GLOBAL_PARAM_FUNC(&p_selfcap_config->global_param); if (touch_ret != TOUCH_SUCCESS) { while (1) { } } PutChar(QT_GLOBAL_CONFIG); PutChar(p_selfcap_config->global_param.recal_threshold); PutChar(p_selfcap_config->global_param.di); PutChar(p_selfcap_config->global_param.drift_hold_time); PutChar(p_selfcap_config->global_param.max_on_duration); PutChar(p_selfcap_config->global_param.tch_drift_rate); PutChar(p_selfcap_config->global_param.atch_drift_rate); PutChar(p_selfcap_config->global_param.atch_recal_delay); #endif PutInt(touch_time.measurement_period_ms); PutInt(0); /* TICKS_PER_MS */ PutChar(0); /* Time_Setting */ Send_Message(); }
/*============================================================================ 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 }
void Transmit_Sensor_Config(void) { #if ((DEF_TOUCH_QMATRIX == 1) || \ (DEF_TOUCH_QTOUCH_GRP_A == 1) || \ (DEF_TOUCH_QTOUCH_GRP_B == 1)) uint8_t c; sensor_t *p_sensors = QDEBUG_SENSOR_PTR; PutChar(QT_SENSOR_CONFIG); PutChar(1); // 1 = KRS for(c=0; c < QDEBUG_NUM_SENSORS; c++) { PutChar(p_sensors[c].threshold); PutChar(p_sensors[c].type_aks_pos_hyst); PutChar(p_sensors[c].from_channel); PutChar(p_sensors[c].to_channel); } #endif #if DEF_TOUCH_AUTONOMOUS_QTOUCH == 1 touch_at_param_t touch_sensor_param; int16_t touch_ret; touch_ret = QDEBUG_GET_GLOBAL_PARAM_FUNC(&touch_sensor_param); if(touch_ret != TOUCH_SUCCESS) { while(1); } PutChar(QT_SENSOR_CONFIG); PutChar(1); // 1 = KRS PutChar(touch_sensor_param.sense); PutChar(0u); /* type_aks_pos_hyst. */ PutChar(0u); PutChar(0u); #endif Send_Message(); }
/*============================================================================ Name : Transmit_Global_Config ------------------------------------------------------------------------------ Purpose : Transmits the global config struct to QTouch Studio Input : n/a Output : n/a Notes : ============================================================================*/ void Transmit_Global_Config(void) { int16_t touch_ret; /* avoid Cppcheck Warning */ UNUSED(touch_ret); #if ((DEF_TOUCH_QMATRIX == 1) || \ (DEF_TOUCH_QTOUCH_GRP_A == 1) || \ (DEF_TOUCH_QTOUCH_GRP_B == 1)) touch_global_param_t global_params; /* get the global parameters from the library and transmit the global parameters to the QTouch Studio */ touch_ret = QDEBUG_GET_GLOBAL_PARAM_FUNC(&global_params); if(touch_ret != TOUCH_SUCCESS) { while(1); } PutChar(QT_GLOBAL_CONFIG); PutChar(global_params.recal_threshold); PutChar(global_params.di); PutChar(global_params.drift_hold_time); PutChar(global_params.max_on_duration); PutChar(global_params.neg_drift_rate); PutChar(global_params.pos_drift_rate); PutChar(global_params.pos_recal_delay); PutInt(measurement_period_ms); PutInt(0);//TICKS_PER_MS PutChar(0); // Time_Setting #endif #if DEF_TOUCH_AUTONOMOUS_QTOUCH == 1 touch_at_param_t touch_sensor_param; /* 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); } PutChar(QT_GLOBAL_CONFIG); PutChar(touch_sensor_param.pthr); PutChar(touch_sensor_param.filter); PutChar(1u); /* Dummy. drift_hold_time. */ PutChar(0u); /* Dummy. max_on_duration. */ PutChar(touch_sensor_param.ndrift); PutChar(touch_sensor_param.pdrift); PutChar(1u); /* Dummy. pos_recal_delay. */ PutInt(measurement_period_ms); PutInt(0);//TICKS_PER_MS PutChar(0); // Time_Setting #endif Send_Message(); }