Exemplo n.º 1
0
/*============================================================================
Name    :   config_sensors -
------------------------------------------------------------------------------
Purpose :   Configure the sensors
Input   :   n/a
Output  :   n/a
Notes   :   Generated code from QTouch Studio. Do not change
============================================================================*/
static void config_sensors(void)
{
	qt_enable_key( CHANNEL_3, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_4, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_slider( CHANNEL_0, CHANNEL_2, NO_AKS_GROUP, 10u, HYST_6_25, RES_8_BIT, 0u  );

}
Exemplo n.º 2
0
/**
 * \brief Configure the sensors.
 */
static void config_sensors(void)
{
	qt_enable_slider(BOARD_SLIDER_START_CHANNEL, BOARD_SLIDER_END_CHANNEL,
			AKS_GROUP_1, 16u, HYST_6_25, RES_8_BIT, 0u);
	qt_enable_key(BOARD_LEFT_KEY_CHANNEL, AKS_GROUP_1, 18u, HYST_6_25);
	qt_enable_key(BOARD_RIGHT_KEY_CHANNEL, AKS_GROUP_1, 18u, HYST_6_25);
}
Exemplo n.º 3
0
static void config_keys(void)
{
  qt_enable_key( CHANNEL_0, NO_AKS_GROUP, 10u, HYST_6_25 );
  
  #if(QT_NUM_CHANNELS >= 2u)
  qt_enable_key( CHANNEL_1, NO_AKS_GROUP, 10u, HYST_6_25 );
  #endif
  
}
Exemplo n.º 4
0
void app_touch_init(void)
{
#ifdef QTOUCH_STUDIO_MASKS
	SNS_array[0][0] = 0x50;
	SNS_array[0][1] = 0x00;
	SNS_array[1][0] = 0x00;
	SNS_array[1][1] = 0x00;

	SNSK_array[0][0] = 0xA0;
	SNSK_array[0][1] = 0x00;
	SNSK_array[1][0] = 0x00;
	SNSK_array[1][1] = 0x00;
#endif

	/* Configures the sensors as keys and assigns the channel numbers.
	 * The sensor is wired up with SNS=PF6 and SNSK=PF7
	 * When using "pin reconfigurability" this will result in channel 0
	 * because it is the first and only channel that is used.
	 * For the standard qtouch library setup we would need to use
	 * channel 3 since we are using the last two pins on the port.
	 */
	qt_enable_key(CHANNEL_0, NO_AKS_GROUP, 10u, HYST_6_25);
	qt_enable_key(CHANNEL_1, NO_AKS_GROUP, 10u, HYST_6_25);

	qt_init_sensing();

	/* This will fill the default threshold values in the configuration
	 * data structure. But User can change the values of these parameters.
	 */
	qt_config_data.qt_di              = DEF_QT_DI;
	qt_config_data.qt_neg_drift_rate  = DEF_QT_NEG_DRIFT_RATE;
	qt_config_data.qt_pos_drift_rate  = DEF_QT_POS_DRIFT_RATE;
	qt_config_data.qt_max_on_duration = DEF_QT_MAX_ON_DURATION;
	qt_config_data.qt_drift_hold_time = DEF_QT_DRIFT_HOLD_TIME;
	qt_config_data.qt_recal_threshold = DEF_QT_RECAL_THRESHOLD;
	qt_config_data.qt_pos_recal_delay = DEF_QT_POS_RECAL_DELAY;

	/* Initialize the timer counter */
	tc_enable(&TCC0);
	tc_write_period(&TCC0, TIMER_PERIOD);
	tc_write_clock_source(&TCC0, TC_CLKSEL_DIV8_gc);
	tc_set_cca_interrupt_level(&TCC0, PMIC_LVL_LOW);
	tc_set_cca_interrupt_callback(&TCC0, app_touch_tc_interrupt_callback);

	/*
	 * Set up callback function. This function is called after the library
	 * has made capacitive measurements, but before it has processed them.
	 * The user can use this hook to apply filter functions to the measured
	 * signal values.(Possibly to fix sensor layout faults)
	 */
	qt_filter_callback = NULL;

#ifdef _DEBUG_INTERFACE_
	QDebug_Init();
#endif
	sleepmgr_lock_mode(SLEEPMGR_IDLE);
}
Exemplo n.º 5
0
static void config_8ch_krs(void)
{
	// enable sensor 0: a key on channel 0
	qt_enable_key( CHANNEL_0, AKS_GROUP_2, 10u, HYST_6_25 );
	// enable sensor 1: a slider on channels 1..3  */
	qt_enable_slider( CHANNEL_1, CHANNEL_3, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u);
	// enable sensor 2: a key on channel 4
	qt_enable_key( CHANNEL_4, AKS_GROUP_2, 10u, HYST_6_25 );
	// enable sensor 3: a rotor on channels 5..7
	qt_enable_rotor( CHANNEL_5, CHANNEL_7, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u );
}
static void config_sensor(void)
{
	/* 
	 * The sensor is wired up with SNS=PF6 and SNSK=PF7
	 * When using "pin reconfigurability" this will result in channel 0
	 * because it is the first and only channel that is used.
	 * For the standard qtouch library setup we would need to use
	 * channel 3 since we are using the last two pins on the port.
	 */
	qt_enable_key(CHANNEL_0, NO_AKS_GROUP, 10u, HYST_6_25);
	qt_enable_key(CHANNEL_1, NO_AKS_GROUP, 10u, HYST_6_25);
}
Exemplo n.º 7
0
 //! \brief Configure the Sensors as keys and Rotor/Sliders for 32 channels only.
static void config_32ch_krs(void)
{
	// enable sensor 0: a keys on channel 0
	qt_enable_key( CHANNEL_0, AKS_GROUP_2, 10u, HYST_6_25 );
	// enable sensor 1: a slider on channels 1..3
	qt_enable_slider( CHANNEL_1, CHANNEL_3, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );
	// enable sensor 2: a key on channel 4
	qt_enable_key( CHANNEL_4, AKS_GROUP_2, 10u, HYST_6_25 );
	// enable sensor 3: a rotor on channels 5..7
	qt_enable_rotor( CHANNEL_5, CHANNEL_7, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u );
	// enable sensor 4: a keys on channel 8
	qt_enable_key( CHANNEL_8, AKS_GROUP_2, 10u, HYST_6_25 );
	// enable sensor 5: a slider on channels 9..11
	qt_enable_slider( CHANNEL_9, CHANNEL_11, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );
	// enable sensor 6: a keys on channel 12
	qt_enable_key( CHANNEL_12, AKS_GROUP_2, 10u, HYST_6_25 );
	// enable sensor 7: a slider on channels 13..15
	qt_enable_rotor( CHANNEL_13, CHANNEL_15, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );
	// enable sensor 0: a keys on channel 0
	qt_enable_key( CHANNEL_16, AKS_GROUP_2, 10u, HYST_6_25 );
	// enable sensor 1: a slider on channels 1..3
	qt_enable_slider( CHANNEL_17, CHANNEL_19, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );
	// enable sensor 2: a key on channel 4
	qt_enable_key( CHANNEL_20, AKS_GROUP_2, 10u, HYST_6_25 );
	// enable sensor 3: a rotor on channels 5..7
	qt_enable_rotor( CHANNEL_21, CHANNEL_23, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u );
	// enable sensor 4: a keys on channel 8
	qt_enable_key( CHANNEL_24, AKS_GROUP_2, 10u, HYST_6_25 );
	// enable sensor 5: a slider on channels 9..11
	qt_enable_slider( CHANNEL_25, CHANNEL_27, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );
	// enable sensor 6: a keys on channel 12
	qt_enable_key( CHANNEL_28, AKS_GROUP_2, 10u, HYST_6_25 );
	// enable sensor 7: a slider on channels 13..15
	qt_enable_rotor( CHANNEL_29, CHANNEL_31, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );
}
Exemplo n.º 8
0
/**
 * @brief  Configure the sensors, assign the channel number, aks_group,
 *hysteresis.
 * @ingroup QTouch
 */
void config_sensors(void)
{
	qt_enable_key(CHANNEL_19, AKS_GROUP_1, 20u, HYST_6_25 ); /* Sensor 0 */
	qt_enable_key(CHANNEL_3, AKS_GROUP_1, 20u, HYST_6_25 ); /* Sensor 1 */
	qt_enable_key(CHANNEL_0, AKS_GROUP_1, 20u, HYST_6_25 ); /* Sensor 2 */
	qt_enable_key(CHANNEL_17, AKS_GROUP_1, 20u, HYST_6_25 ); /* Sensor 3 */
	qt_enable_key(CHANNEL_18, AKS_GROUP_1, 20u, HYST_6_25 ); /* Sensor 4 */
	qt_enable_key(CHANNEL_2, AKS_GROUP_1, 15u, HYST_6_25 ); /* Sensor 5 */
	qt_enable_key(CHANNEL_1, AKS_GROUP_1, 15u, HYST_6_25 ); /* Sensor 6 */
	qt_enable_key(CHANNEL_16, AKS_GROUP_1, 16u, HYST_6_25 ); /* Sensor 7 */
	qt_enable_rotor(CHANNEL_8, CHANNEL_11, AKS_GROUP_1, 45u, HYST_25,
			RES_8_BIT, 3u );                                               /*
	                                                                                *Sensor
	                                                                                *8
	                                                                                **/
	qt_enable_key(CHANNEL_12, AKS_GROUP_1, 20u, HYST_6_25 ); /* Sensor 9 */
}
Exemplo n.º 9
0
static void config_16ch_krs(void)
{
    /*  enable sensors 0..7: keys on channels 0..7  */
    qt_enable_key( CHANNEL_0, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_1, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_2, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_3, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_4, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_5, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_6, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_7, AKS_GROUP_1, 10u, HYST_6_25 );
    /*  enable sensor 8: a rotor on channels 8..11  */
    qt_enable_rotor( CHANNEL_8, CHANNEL_11, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );
    /*  enable sensors 9: sliders on channels 12..15 respectively   */
    qt_enable_slider( CHANNEL_12, CHANNEL_15, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );

}
Exemplo n.º 10
0
/** \brief Function to setup touch button.
 *
 * This function will configure touch sensing for the QTB0 touch button.
 * LED1 is used as touch indication. Touch detected: LED1 on, touch not
 * detected: LED1 off.
 */
void touch_init(void)
{
    // Configure touch button (QTB0) pin mapping
    SNS_array[0][0] = 0x40;
    SNS_array[0][1] = 0x00;
    SNS_array[1][0] = 0x00;
    SNS_array[1][1] = 0x00;
    SNSK_array[0][0] = 0x80;
    SNSK_array[0][1] = 0x00;
    SNSK_array[1][0] = 0x00;
    SNSK_array[1][1] = 0x00;

    timer1_init();

    // PORTB3 (LED1) output default high (LED1 off)
    DDRB |= (1 << DDB3);
    PORTB |= (1 << PORTB3);

    // Configure the Sensor
    qt_enable_key(CHANNEL_0, NO_AKS_GROUP, 30, HYST_6_25);

    // Initialize touch sensing
    qt_init_sensing();

    /* Set the parameters like recalibration threshold,
     * Max_On_Duration etc in this function by the user
     */
    qt_set_parameters( );

    /* This function is called after the library has made
     * capacitive measurements, but before it has processed them.
     * The user can use this hook to apply filter functions to the
     * measured signal values.(Possibly to fix sensor layout faults)
     */
    qt_filter_callback = 0;
}
Exemplo n.º 11
0
static void config_32ch_krs(void)
{
        /*  enable sensors 0..7: keys on channels 0..7  */
    qt_enable_key( CHANNEL_0, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_1, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_2, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_3, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_4, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_5, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_6, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_7, AKS_GROUP_1, 10u, HYST_6_25 );
    /*  enable sensors 8..15: keys on channels 8..15    */
    qt_enable_key( CHANNEL_8, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_9, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_10, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_11, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_12, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_13, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_14, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_15, AKS_GROUP_1, 10u, HYST_6_25 );
    /*  enable sensors : rotor on channels  respectively   */
    qt_enable_rotor( CHANNEL_16, CHANNEL_19, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );
    /*  enable sensors : rotor on channels  respectively   */
    qt_enable_rotor( CHANNEL_20, CHANNEL_23, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );
     /*  enable sensors : slider on channels  respectively   */
    qt_enable_slider( CHANNEL_24, CHANNEL_27, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );
     /*  enable sensors : slider on channels  respectively   */
    qt_enable_slider( CHANNEL_28, CHANNEL_31, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );

}
Exemplo n.º 12
0
static void config_keys(void)
{
    /*  enable sensors 0..3: keys on channels 0..3  */
    qt_enable_key( CHANNEL_0, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_1, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_2, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_3, AKS_GROUP_1, 10u, HYST_6_25 );

#if(QT_NUM_CHANNELS >= 8u)
    /*  enable sensors 4..7: keys on channels 4..7   */
    qt_enable_key( CHANNEL_4, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_5, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_6, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_7, AKS_GROUP_1, 10u, HYST_6_25 );
#endif
#if (QT_NUM_CHANNELS >= 16u)
    /*  enable sensors 8..15: keys on channels 8..15    */
    qt_enable_key( CHANNEL_8, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_9, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_10, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_11, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_12, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_13, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_14, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_15, AKS_GROUP_1, 10u, HYST_6_25 );
#endif
#if (QT_NUM_CHANNELS >= 32u)
    /*  enable sensors 16..31: keys on channels 16..31  */
    qt_enable_key( CHANNEL_16, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_17, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_18, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_19, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_20, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_21, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_22, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_23, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_24, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_25, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_26, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_27, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_28, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_29, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_30, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_31, AKS_GROUP_1, 10u, HYST_6_25 );
#endif
#if (QT_NUM_CHANNELS >= 64u)
    /*  enable sensors 32..63: keys on channels 32..63  */
    qt_enable_key( CHANNEL_32, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_33, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_34, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_35, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_36, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_37, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_38, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_39, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_40, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_41, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_42, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_43, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_44, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_45, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_46, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_47, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_48, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_49, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_50, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_51, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_52, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_53, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_54, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_55, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_56, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_57, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_58, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_59, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_60, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_61, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_62, AKS_GROUP_1, 10u, HYST_6_25 );
    qt_enable_key( CHANNEL_63, AKS_GROUP_1, 10u, HYST_6_25 );
#endif

}
Exemplo n.º 13
0
/*============================================================================
Name    :   config_sensors -
------------------------------------------------------------------------------
Purpose :   Configure the sensors
Input   :   n/a
Output  :   n/a
Notes   :   Generated code from QTouch Studio. Do not change
============================================================================*/
static void config_sensors(void)
{
	qt_enable_key( CHANNEL_0, NO_AKS_GROUP, 26u, HYST_6_25 );

}
Exemplo n.º 14
0
/*============================================================================
Name    :   config_sensors -
------------------------------------------------------------------------------
Purpose :   Configure the sensors
Input   :   n/a
Output  :   n/a
Notes   :   Generated code from QTouch Studio. Do not change
============================================================================*/
static void config_sensors(void)
{
	qt_enable_key( CHANNEL_0, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_1, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_2, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_3, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_4, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_5, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_6, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_7, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_8, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_9, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_10, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_11, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_12, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_13, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_14, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_15, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_16, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_17, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_18, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_19, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_20, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_21, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_22, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_23, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_24, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_25, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_26, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_27, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_28, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_29, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_30, NO_AKS_GROUP, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_31, NO_AKS_GROUP, 10u, HYST_6_25 );
};
Exemplo n.º 15
0
/**
 * \brief Configure the touch sensor
 */
static void touch_config_sensor(void)
{
	 qt_enable_key(CHANNEL_0, NO_AKS_GROUP, 10, HYST_6_25);
}
Exemplo n.º 16
0
static void config_4ch_krs(void)
{
    qt_enable_key( CHANNEL_0, AKS_GROUP_2, 10u, HYST_6_25 );
    qt_enable_slider( CHANNEL_1, CHANNEL_3, NO_AKS_GROUP, 16u, HYST_6_25, RES_8_BIT, 0u  );

}
Exemplo n.º 17
0
/**
 * \brief Initializes the touch measurement timer.
 *
 * We need a timer that triggers approx. every millisecond.
 * The touch library seems to need this as time-base.
 */
static void init_timer(void)
{
	volatile avr32_tc_t *tc = TOUCH_MEASUREMENT_TC;

	const tc_waveform_opt_t waveform_options = {
		.channel  = TOUCH_MEASUREMENT_TC_CHANNEL,
		//! Software trigger effect on TIOB.
		.bswtrg   = TC_EVT_EFFECT_NOOP,
		//! External event effect on TIOB.
		.beevt    = TC_EVT_EFFECT_NOOP,
		//! RC compare effect on TIOB.
		.bcpc     = TC_EVT_EFFECT_NOOP,
		//! RB compare effect on TIOB.
		.bcpb     = TC_EVT_EFFECT_NOOP,
		//! Software trigger effect on TIOA.
		.aswtrg   = TC_EVT_EFFECT_NOOP,
		//! External event effect on TIOA.
		.aeevt    = TC_EVT_EFFECT_NOOP,
		//! RC compare effect on TIOA: toggle.
		.acpc     = TC_EVT_EFFECT_NOOP,
		//! RA compare effect on TIOA: toggle.
		.acpa     = TC_EVT_EFFECT_NOOP,
		//! Waveform selection
		.wavsel   = TC_WAVEFORM_SEL_UP_MODE_RC_TRIGGER,
		//! External event trigger enable.
		.enetrg   = 0,
		//! External event selection.
		.eevt     = 0,
		//! External event edge selection.
		.eevtedg  = TC_SEL_NO_EDGE,
		//! Counter disable when RC compare.
		.cpcdis   = 0,
		//! Counter clock stopped with RC compare.
		.cpcstop  = 0,
		//! Burst signal selection.
		.burst    = 0,
		//! Clock inversion selection.
		.clki     = 0,
		//! Internal source clock 3 (fPBA / 8).
		.tcclks   = TC_CLOCK_SOURCE_TC3
	};

	const tc_interrupt_t tc_interrupt = {
		.etrgs = 0,
		.ldrbs = 0,
		.ldras = 0,
		.cpcs  = 1,
		.cpbs  = 0,
		.cpas  = 0,
		.lovrs = 0,
		.covfs = 0,
	};

#if (defined __GNUC__)
	Disable_global_interrupt();
	INTC_register_interrupt(&tc_irq, TOUCH_MEASUREMENT_TC_IRQ,
			AVR32_INTC_INT0);
	Enable_global_interrupt();
#endif

	/* initialize the timer/counter. */
	sysclk_enable_peripheral_clock(&AVR32_TC1);
	tc_init_waveform(tc, &waveform_options);

	/* set the compare triggers. */
	tc_write_rc(tc, TOUCH_MEASUREMENT_TC_CHANNEL,
			(sysclk_get_pba_hz() / 8) / 1000);

	tc_configure_interrupts(tc, TOUCH_MEASUREMENT_TC_CHANNEL,
			&tc_interrupt);
	tc_start(tc, TOUCH_MEASUREMENT_TC_CHANNEL);
}

/**
 * \brief Initializes the touch library configuration.
 *
 * Sets the correct configuration for the QTouch library.
 */
static void qt_set_parameters(void)
{
	/* This will be modified by the user to different values. */
	qt_config_data.qt_di              = DEF_QT_DI;
	qt_config_data.qt_neg_drift_rate  = DEF_QT_NEG_DRIFT_RATE;
	qt_config_data.qt_pos_drift_rate  = DEF_QT_POS_DRIFT_RATE;
	qt_config_data.qt_max_on_duration = DEF_QT_MAX_ON_DURATION;
	qt_config_data.qt_drift_hold_time = DEF_QT_DRIFT_HOLD_TIME;
	qt_config_data.qt_recal_threshold = DEF_QT_RECAL_THRESHOLD;
	qt_config_data.qt_pos_recal_delay = DEF_QT_POS_RECAL_DELAY;

	/*
	 * This function is called after the library has made capacitive
	 * measurements, but before it has processed them. The user can use
	 * this hook to apply filter functions to the measured signal
	 * values. (Possibly to fix sensor layout faults).
	 */
	qt_filter_callback = NULL;
}

/**
 * \brief Initialize touch sensors
 *
 * The touch channels are connected on the GPIO controller 4 which is a part of
 * port X
 *
 * Touch Button:
 * GPIO
 * 98           SNSK1           CHANNEL1_SNS
 * 99           SNS1            CHANNEL1_SNSK
 *
 * Touch Slider:
 * 100          SNS0	        CHANNEL2_SNS
 * 101          SNSK0           CHANNEL2_SNSK
 * 102          SNS1            CHANNEL3_SNS
 * 103          SNSK1		CHANNEL3_SNSK
 * 104          SNS2            CHANNEL4_SNS
 * 105          SNSK2           CHANNEL4_SNSK
 */
void touch_init(void)
{
	/*
	 * Reset sensing is only needed when doing re-initialization during
	 * run-time
	 */
	// qt_reset_sensing();
	qt_enable_key(CHANNEL_1, NO_AKS_GROUP, 30u, HYST_12_5);

	/*
	 * Position hysteresis is not used in QTouch slider so this value will
	 * be ignored
	 */
	qt_enable_slider(CHANNEL_2, CHANNEL_4, NO_AKS_GROUP, 20u, HYST_12_5,
			RES_8_BIT, 0);

	qt_init_sensing();
	qt_set_parameters();

#ifdef _DEBUG_INTERFACE_
	sysclk_enable_peripheral_clock(&AVR32_SPI0);

	/* Initialize debug protocol */
	QDebug_Init();

	/* Process commands from PC */
	QDebug_ProcessCommands();
#endif

	init_timer();
}
Exemplo n.º 18
0
//! \brief  Configure the sensors as keys only.
static void config_keys(void)
{
	// enable sensors 0..3: keys on channels 0..3
	qt_enable_key( CHANNEL_0, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_1, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_2, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_3, AKS_GROUP_1, 10u, HYST_6_25 );

#if(QT_NUM_CHANNELS >= 8u)
	// enable sensors 4..7: keys on channels 4..7
	qt_enable_key( CHANNEL_4, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_5, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_6, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_7, AKS_GROUP_1, 10u, HYST_6_25 );
#endif
#if (QT_NUM_CHANNELS >= 16u)
	// enable sensors 8..15: keys on channels 8..15    
	qt_enable_key( CHANNEL_8, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_9, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_10, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_11, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_12, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_13, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_14, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_15, AKS_GROUP_1, 10u, HYST_6_25 );
#endif
#if (QT_NUM_CHANNELS >= 32u)
	// enable sensors 16..31: keys on channels 16..31  
	qt_enable_key( CHANNEL_16, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_17, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_18, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_19, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_20, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_21, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_22, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_23, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_24, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_25, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_26, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_27, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_28, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_29, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_30, AKS_GROUP_1, 10u, HYST_6_25 );
	qt_enable_key( CHANNEL_31, AKS_GROUP_1, 10u, HYST_6_25 );
#endif 

}