Microchip® Advanced Software Framework

QDebug_at32uc3l.c 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.

#include "QDebug_at32uc3l.h"
#include "compiler.h"
#include "QDebugTransport.h"
#include "QDebugSettings.h"
#include "SERIAL.h"

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...
 
void Set_Channel_Config (void)
 Extract the data packet from QTouch Studio and set channel config. More...
 
void Set_Global_Config (void)
 Extract the data packet from QTouch Studio and set global config. 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 Set_Subscriptions (void)
 Set Data Subscription values. More...
 
void Transmit_Burst_Lengths (void)
 Transmits the QMatrix burst length values to QTouch Studio. More...
 
void Transmit_Delta (void)
 Transmits the channel delta values to QTouch Studio. More...
 
void Transmit_Dummy (void)
 Transmits a dummy packet if no other subscriptions are set. More...
 
void Transmit_Global_Config (void)
 Transmits the global config struct to QTouch Studio. More...
 
void Transmit_QT_User_Data (uint8_t *pdata, uint16_t c)
 Transmits user data to QTouch Studio. More...
 
void Transmit_Ref (void)
 Transmits the channel reference values to QTouch Studio. More...
 
void Transmit_Sensor_Config (void)
 Transmits the channel config struct to QTouch Studio. More...
 
void Transmit_Sign_On (void)
 Transmits the sign on packet to QTouch Studio. More...
 
void Transmit_Signals (void)
 Transmits the measurement values for each channel to QTouch Studio. More...
 
void Transmit_State (void)
 Transmits the state values to QTouch Studio. More...
 
void Transmit_Time_Stamps (void)
 Transmits the application execution timestamp values to QTouch Studio. More...
 

Variables

volatile int8_t autonomous_qtouch_in_touch
 
static uint16_t delivery = 0
 
uint16_t measurement_period_ms
 Time measurement period in ms. More...
 
static uint16_t qgLibraryChanges = 0
 
uint8_t qgRefschanged
 
uint8_t qgStateschanged
 
static uint16_t qgSubsAllways = 0
 
static uint16_t qgSubsChange = 0
 
static uint16_t qgSubsOnce = 0
 
uint16_t timestamp1_hword
 Time stamp information. More...
 
uint16_t timestamp1_lword
 
uint16_t timestamp2_hword
 
uint16_t timestamp2_lword
 
uint16_t timestamp3_hword
 
uint16_t timestamp3_lword
 
touch_config_t touch_config
 
static bool transmit_dummy = false
 
Object to get library info.
touch_info_t qm_libinfo
 

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.

volatile int8_t autonomous_qtouch_in_touch

Referenced by Transmit_State().

uint16_t delivery = 0
static
uint16_t measurement_period_ms

Time measurement period in ms.

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

Referenced by ISR(), Set_Measurement_Period(), and Transmit_Global_Config().

uint16_t qgLibraryChanges = 0
static

Referenced by QDebug_SendData().

uint8_t qgRefschanged

compile file only when QDebug is enabled.

These must somehow be updated from the library.

uint8_t qgStateschanged
uint16_t qgSubsAllways = 0
static
uint16_t qgSubsChange = 0
static
uint16_t qgSubsOnce = 0
static

Subscriptions.

Referenced by QDebug_SendData(), and QDebug_SetSubscriptions().

touch_info_t qm_libinfo
uint16_t timestamp1_hword

Time stamp information.

Referenced by Transmit_Time_Stamps().

uint16_t timestamp1_lword

Referenced by Transmit_Time_Stamps().

uint16_t timestamp2_hword

Referenced by Transmit_Time_Stamps().

uint16_t timestamp2_lword

Referenced by Transmit_Time_Stamps().

uint16_t timestamp3_hword

Referenced by Transmit_Time_Stamps().

uint16_t timestamp3_lword

Referenced by Transmit_Time_Stamps().

touch_config_t touch_config
bool transmit_dummy = false
static

Referenced by QDebug_SendData().