qt_touch_status_t

Structure

qt_touch_status_t

Input / Output

Output from the Library

Use

Holds the status (On/ Off) of the sensors and the linear and angular positions of sliders and rotors respectively

Fields

Comment

sensor_states[]

For Sensor, the sensor_states. Bit “n” = state of nth sensor :

Bit Value  0 - indicates the sensor is not in detect

Bit Value 1  - indicates the sensor is in detect

rotor_slider_values[]

Rotors angles or slider positions if rotors and sliders are used. These values are valid when sensor states shows that the corresponding rotor or slider is in detect

The macro that can get the sensor state when the sensor number is provided can be something as below:

					#define GET_SENSOR_STATE(SENSOR_NUMBER) \
    qt_measure_data.qt_touch_status.sensor_states[(SENSOR_NUMBER/8)] & (1 <<(SENSOR_NUMBER % 8))
				

The host application can use this macro to act accordingly, the following example shows how to toggle a IO pin (PD2) based on the sensor0 state. (Set PD2 if sensor0 is in detect, and clear PD2 if sensor0 is not in detect)

					DDRD |= (1u << PORTD2);
if (GET_SENSOR_STATE(0) !=0)
{        
    PORTD |= (1u << PORTD2); /* Set PORTD2 */
}
else
{
    PORTD &= ~(1u << PORTD2); /* Clear PORTD2 */
}