Microchip® Advanced Software Framework

QDebug_at32uc3l.h File Reference

This file contains the QDebug public API that can be used to transfer data from a Touch Device to QTouch Studio using the QT600 USB Bridge.

Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.

Macros

Subscription definitions.

compile file only when QDebug is enabled.

#define SUBS_SIGN_ON   0
 
#define SUBS_GLOBAL_CONFIG   1
 
#define SUBS_SENSOR_CONFIG   2
 
#define SUBS_SIGNALS   3
 
#define SUBS_REF   4
 
#define SUBS_DELTA   5
 
#define SUBS_STATES   6
 
PC commands.
#define QT_CMD_DUMMY   0x10
 
#define QT_CMD_SET_SUBS   0x11
 
#define QT_CMD_SET_GLOBAL_CONFIG   0x12
 
#define QT_CMD_SET_CH_CONFIG   0x13
 
#define QT_CMD_SET_MEASUREMENT_PERIOD   0x14
 
#define QT_CMD_SET_QM_BURST_LENGTHS   0x15
 
Touch MCU data packets.
#define QT_DUMMY   0x20
 
#define QT_SIGN_ON   0x21
 
#define QT_GLOBAL_CONFIG   0x22
 
#define QT_SENSOR_CONFIG   0x23
 
#define QT_SIGNALS   0x24
 
#define QT_REFERENCES   0x25
 
#define QT_DELTAS   0x26
 
#define QT_STATES   0x27
 
Macros for QMatrix API and data structure.
#define QDEBUG_SENSOR_STATES_PTR   p_qm_measure_data->p_sensor_states
 
#define QDEBUG_SENSOR_PTR   p_qm_measure_data->p_sensors
 
#define QDEBUG_SIGNALS_PTR   p_qm_measure_data->p_channel_signals
 
#define QDEBUG_REFERENCES_PTR   p_qm_measure_data->p_channel_references
 
#define QDEBUG_SENSOR_RS_VALUES
 
#define QDEBUG_BURST_LEN_PTR   (&qm_burst_length[0])
 
#define QDEBUG_LIBINFO   qm_libinfo
 
#define QDEBUG_NUM_SENSOR_STATE_BYTES   ((QM_NUM_CHANNELS + 7u) / 8u)
 
#define QDEBUG_GET_DELTA_FUNC   touch_qm_sensor_get_delta
 
#define QDEBUG_GET_LIBINFO_FUNC   touch_qm_get_libinfo
 
#define QDEBUG_GET_GLOBAL_PARAM_FUNC   touch_qm_get_global_param
 
#define QDEBUG_UPDATE_GLOBAL_PARAM_FUNC   touch_qm_update_global_param
 
#define QDEBUG_GET_SENSOR_CONFIG_FUNC   touch_qm_sensor_get_config
 
#define QDEBUG_UPDATE_SENSOR_CONFIG_FUNC   touch_qm_sensor_update_config
 
#define QDEBUG_NUM_SENSORS   QM_NUM_SENSORS
 
#define QDEBUG_NUM_CHANNELS   QM_NUM_CHANNELS
 
#define QDEBUG_NUM_ROTORS_SLIDERS   QM_NUM_ROTORS_SLIDERS
 

Functions

Public functions.
void QDebug_Init (void)
 This API initializes QDebug interface, including the low level hardware interface (SPI, TWI, USART etc). More...
 
void QDebug_ProcessCommands (void)
 Command handler for the data received from QTouch Studio. More...
 
void QDebug_SendData (uint16_t qt_lib_flags)
 Send data to QTouch Studio based on the subscription. More...
 
void QDebug_SetSubscriptions (uint16_t once, uint16_t change, uint16_t allways)
 Set subscription values. More...
 
Private functions.
void Set_Global_Config (void)
 Extract the data packet from QTouch Studio and set global config. More...
 
void Set_Channel_Config (void)
 Extract the data packet from QTouch Studio and set channel config. More...
 
void Set_Subscriptions (void)
 Set Data Subscription values. More...
 
void Set_Measurement_Period (void)
 Extract the data packet from QTouch Studio and set measurement period. More...
 
void Set_QM_Burst_Lengths (void)
 Extract the data packet from QTouch Studio and set QMatrix burst lengths. More...
 
void Set_QT_User_Data (uint8_t *pdata)
 Extracts user data from QTouch Studio to touch mcu memory. More...
 
void Transmit_Dummy (void)
 Transmits a dummy packet if no other subscriptions are set. More...
 
void Transmit_Sign_On (void)
 Transmits the sign on packet to QTouch Studio. More...
 
void Transmit_Global_Config (void)
 Transmits the global config struct to QTouch Studio. More...
 
void Transmit_Sensor_Config (void)
 Transmits the channel config struct to QTouch Studio. More...
 
void Transmit_Signals (void)
 Transmits the measurement values for each channel to QTouch Studio. More...
 
void Transmit_Ref (void)
 Transmits the channel reference values to QTouch Studio. More...
 
void Transmit_Delta (void)
 Transmits the channel delta values to QTouch Studio. More...
 
void Transmit_State (void)
 Transmits the state values to QTouch Studio. More...
 
void Transmit_Burst_Lengths (void)
 Transmits the QMatrix burst length values to QTouch Studio. More...
 
void Transmit_Time_Stamps (void)
 Transmits the application execution timestamp values to QTouch Studio. More...
 
void Transmit_QT_User_Data (uint8_t *pdata, uint16_t c)
 Transmits user data to QTouch Studio. More...
 

Variables

touch_measure_data_tp_qm_measure_data
 Pointer to the measured data. More...
 
touch_measure_data_tp_qta_measure_data
 
touch_measure_data_tp_qtb_measure_data
 
uint8_t qm_burst_length [QM_NUM_CHANNELS]
 The below data is required for the QTouch library. More...
 

#define QDEBUG_BURST_LEN_PTR   (&qm_burst_length[0])

Referenced by Transmit_Burst_Lengths().

#define QDEBUG_GET_DELTA_FUNC   touch_qm_sensor_get_delta

Referenced by Transmit_Delta().

#define QDEBUG_GET_GLOBAL_PARAM_FUNC   touch_qm_get_global_param
#define QDEBUG_GET_LIBINFO_FUNC   touch_qm_get_libinfo

Referenced by QDebug_Init().

#define QDEBUG_GET_SENSOR_CONFIG_FUNC   touch_qm_sensor_get_config

Referenced by Set_Channel_Config().

#define QDEBUG_LIBINFO   qm_libinfo

Referenced by QDebug_Init(), and Transmit_Sign_On().

#define QDEBUG_NUM_ROTORS_SLIDERS   QM_NUM_ROTORS_SLIDERS

Referenced by Transmit_State().

#define QDEBUG_NUM_SENSOR_STATE_BYTES   ((QM_NUM_CHANNELS + 7u) / 8u)

Referenced by Transmit_State().

#define QDEBUG_NUM_SENSORS   QM_NUM_SENSORS
#define QDEBUG_REFERENCES_PTR   p_qm_measure_data->p_channel_references

Referenced by Transmit_Delta(), and Transmit_Ref().

#define QDEBUG_SENSOR_PTR   p_qm_measure_data->p_sensors

Referenced by Transmit_Sensor_Config().

#define QDEBUG_SENSOR_RS_VALUES
Value:
p_qm_measure_data->\ p_rotor_slider_values
touch_measure_data_t * p_qm_measure_data
Pointer to the measured data.
Definition: touch.c:76

Referenced by Transmit_State().

#define QDEBUG_SENSOR_STATES_PTR   p_qm_measure_data->p_sensor_states

Referenced by Transmit_State().

#define QDEBUG_SIGNALS_PTR   p_qm_measure_data->p_channel_signals

Referenced by Transmit_Delta(), and Transmit_Signals().

#define QDEBUG_UPDATE_GLOBAL_PARAM_FUNC   touch_qm_update_global_param

Referenced by Set_Global_Config().

#define QDEBUG_UPDATE_SENSOR_CONFIG_FUNC   touch_qm_sensor_update_config

Referenced by Set_Channel_Config().

#define QT_CMD_DUMMY   0x10

Referenced by QDebug_ProcessCommands().

#define QT_CMD_SET_CH_CONFIG   0x13

Referenced by QDebug_ProcessCommands().

#define QT_CMD_SET_GLOBAL_CONFIG   0x12

Referenced by QDebug_ProcessCommands().

#define QT_CMD_SET_MEASUREMENT_PERIOD   0x14
#define QT_CMD_SET_QM_BURST_LENGTHS   0x15

Referenced by QDebug_ProcessCommands().

#define QT_CMD_SET_SUBS   0x11

Referenced by QDebug_ProcessCommands().

#define QT_DELTAS   0x26

Referenced by Transmit_Delta().

#define QT_DUMMY   0x20

Referenced by Transmit_Dummy().

#define QT_GLOBAL_CONFIG   0x22

Referenced by Transmit_Global_Config().

#define QT_REFERENCES   0x25

Referenced by Transmit_Ref().

#define QT_SENSOR_CONFIG   0x23

Referenced by Transmit_Sensor_Config().

#define QT_SIGN_ON   0x21

Referenced by Transmit_Sign_On().

#define QT_SIGNALS   0x24

Referenced by Transmit_Signals().

#define QT_STATES   0x27

Referenced by Transmit_State().

#define SUBS_DELTA   5

Referenced by QDebug_SendData().

#define SUBS_GLOBAL_CONFIG   1

Referenced by QDebug_SendData().

#define SUBS_REF   4

Referenced by QDebug_SendData().

#define SUBS_SENSOR_CONFIG   2

Referenced by QDebug_SendData().

#define SUBS_SIGN_ON   0

Referenced by QDebug_SendData().

#define SUBS_SIGNALS   3

Referenced by QDebug_SendData().

#define SUBS_STATES   6

Referenced by QDebug_SendData().

void QDebug_Init ( void  )

This API initializes QDebug interface, including the low level hardware interface (SPI, TWI, USART etc).

Note
Must be called before using any other QDebug API.

References QDEBUG_GET_LIBINFO_FUNC, QDEBUG_LIBINFO, SERIAL_Init(), and TOUCH_SUCCESS.

Referenced by init_touch().

void QDebug_ProcessCommands ( void  )

Command handler for the data received from QTouch Studio.

Note
This function should be called in the main loop after measure_sensors to process the data received from QTOuch Studio.

References QT_CMD_DUMMY, QT_CMD_SET_CH_CONFIG, QT_CMD_SET_GLOBAL_CONFIG, QT_CMD_SET_QM_BURST_LENGTHS, QT_CMD_SET_SUBS, Set_Channel_Config(), Set_Global_Config(), Set_Measurement_Period(), Set_QM_Burst_Lengths(), and Set_Subscriptions().

Referenced by touch_handler().

void QDebug_SetSubscriptions ( uint16_t  once,
uint16_t  change,
uint16_t  allways 
)

Set subscription values.

Note
This function can be used directly in main to set data subscription if 1way SPI interface is used.

References qgSubsAllways, qgSubsChange, and qgSubsOnce.

Referenced by Set_Subscriptions().

void Set_Channel_Config ( void  )

Extract the data packet from QTouch Studio and set channel config.

Note
Should only be called from the command handler.

References tag_touch_qt_param_t::aks_group, tag_touch_qt_param_t::detect_hysteresis, tag_touch_qt_param_t::detect_threshold, QDEBUG_GET_SENSOR_CONFIG_FUNC, QDEBUG_UPDATE_SENSOR_CONFIG_FUNC, tag_touch_at_param_t::sense, TOUCH_SUCCESS, and UNUSED.

Referenced by QDebug_ProcessCommands().

void Set_Measurement_Period ( void  )

Extract the data packet from QTouch Studio and set measurement period.

Note
Should only be called from the command handler.

References measurement_period_ms, and UNUSED.

Referenced by QDebug_ProcessCommands().

void Set_QM_Burst_Lengths ( void  )

Extract the data packet from QTouch Studio and set QMatrix burst lengths.

Note
Should only be called from the command handler.

References qm_burst_length, QM_NUM_CHANNELS, touch_qm_channel_update_burstlen(), touch_qm_sensors_calibrate(), and TOUCH_SUCCESS.

Referenced by QDebug_ProcessCommands().

void Set_QT_User_Data ( uint8_t *  pdata)

Extracts user data from QTouch Studio to touch mcu memory.

Parameters
pdata,:data pointer.
Note
The data can be binary data.
void Set_Subscriptions ( void  )

Set Data Subscription values.

Note
Should only be called from the command handler.

References QDebug_SetSubscriptions().

Referenced by QDebug_ProcessCommands().

void Transmit_Burst_Lengths ( void  )

Transmits the QMatrix burst length values to QTouch Studio.

Note
This value is available for each channel.

References QDEBUG_BURST_LEN_PTR, and QDEBUG_NUM_CHANNELS.

void Transmit_Delta ( void  )

Transmits the channel delta values to QTouch Studio.

References QDEBUG_GET_DELTA_FUNC, QDEBUG_NUM_SENSORS, QDEBUG_REFERENCES_PTR, QDEBUG_SIGNALS_PTR, QT_DELTAS, and UNUSED.

Referenced by QDebug_SendData().

void Transmit_Dummy ( void  )

Transmits a dummy packet if no other subscriptions are set.

References QT_DUMMY.

Referenced by QDebug_SendData().

void Transmit_QT_User_Data ( uint8_t *  pdata,
uint16_t  c 
)

Transmits user data to QTouch Studio.

Parameters
pdata,:data pointer.
c,:length of data in bytes.
Note
The data will be binary data.
void Transmit_Ref ( void  )

Transmits the channel reference values to QTouch Studio.

References QDEBUG_NUM_CHANNELS, QDEBUG_REFERENCES_PTR, and QT_REFERENCES.

Referenced by QDebug_SendData().

void Transmit_Sensor_Config ( void  )

Transmits the channel config struct to QTouch Studio.

References QDEBUG_GET_GLOBAL_PARAM_FUNC, QDEBUG_NUM_SENSORS, QDEBUG_SENSOR_PTR, QT_SENSOR_CONFIG, tag_touch_at_param_t::sense, and TOUCH_SUCCESS.

Referenced by QDebug_SendData().

void Transmit_Sign_On ( void  )

Transmits the sign on packet to QTouch Studio.

References delivery, INTERFACE, PROJECT_ID, QDEBUG_LIBINFO, QDEBUG_NUM_CHANNELS, and QT_SIGN_ON.

Referenced by QDebug_SendData().

void Transmit_Signals ( void  )

Transmits the measurement values for each channel to QTouch Studio.

References QDEBUG_NUM_CHANNELS, QDEBUG_SIGNALS_PTR, and QT_SIGNALS.

Referenced by QDebug_SendData().

void Transmit_State ( void  )
void Transmit_Time_Stamps ( void  )

Transmits the application execution timestamp values to QTouch Studio.

Note
This value is a combination of current_time_ms_touch (high word) & timer counter register (low word).

References timestamp1_hword, timestamp1_lword, timestamp2_hword, timestamp2_lword, timestamp3_hword, and timestamp3_lword.

touch_measure_data_t* p_qm_measure_data

Pointer to the measured data.

QMatrix measured data pointer.

Needs to be global since it is required for the QDebug module.

touch_measure_data_t* p_qta_measure_data
touch_measure_data_t* p_qtb_measure_data
uint8_t qm_burst_length[QM_NUM_CHANNELS]

The below data is required for the QTouch library.

Do not alter these here since they are usually configured via the touch_config_at32uc3l.hQMatrix burst length.

Specify the number of QMatrix burst pulses for each channel. In order to disable bursting on a individual channel, a value of 1u has to be specified.

Warning
QMatrix Burst length setting recommendation. When the burst length value corresponding to (X0,Y1),(X0,Y2)...(Xn,Yn) are different, 1k ohm resistive drive MUST be used on all the enabled Y lines by setting the corresponding bits in the CSARES register.

When the burst length value corresponding to (X0,Y1),(X0,Y2)...(Xn,Yn) are same or set to 0x01(disabled), enabling the 1k ohm resistive drive on Y lines is optional.

Note
A value of 0u will be same as specifying a burst length value of 255u pulses. Range: 1u to 255u.
Once the Touch Library has been initialized for QMatrix method using the touch_qm_sensors_init API, a new qm_burst_length[x] value of a Touch channel MUST be updated only using the touch_qm_channel_update_burstlen API. It is recommended to have qm_burst_length array as global variable as the Touch Library updates this array when the touch_qm_channel_update_burstlen API is called.

Referenced by Set_QM_Burst_Lengths().