void qt_set_parameter(void)
{
qt_config_data.qt_recal_threshold = DEF_QT_RECAL_THRESHOLD ;
qt_config_data.qt_di = DEF_QT_DI;
qt_config_data.qt_drift_hold_time = DEF_QT_DRIFT_HOLD_TIME;
qt_config_data.qt_max_on_duration = DEF_QT_MAX_ON_DURATION;
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_pos_recal_delay = DEF_QT_POS_RECAL_DELAY;
}
int main(void)
{
unsigned int brust_flag=0;
sys_clk32M_init();
io_init();
OLED_Init();
Qtouch_Timer_init();
SNS_array[0][0]= 0x54;
SNS_array[0][1]= 0x00;
SNS_array[1][0]= 0x28;
SNS_array[1][1]= 0x00;
SNSK_array[0][0]= 0xa8;
SNSK_array[0][1]= 0x00;
SNSK_array[1][0]= 0x50;
SNSK_array[1][1]= 0x00;
Fill_RAM(0);
Search_Table_Display(1,32,0,Xlevel);
qt_reset_sensing();
qt_enable_key(CHANNEL_0,AKS_GROUP_1,20,HYST_50);
qt_enable_key(CHANNEL_1,AKS_GROUP_1,20,HYST_50);
qt_enable_key(CHANNEL_2,AKS_GROUP_1,20,HYST_50);
qt_enable_key(CHANNEL_4,AKS_GROUP_1,20,HYST_50);
qt_enable_key(CHANNEL_3,AKS_GROUP_1,30,HYST_50);
qt_init_sensing();
qt_set_parameter();
TCC0_CTRLA = TC_CLKSEL_DIV64_gc;
PMIC_CTRL |= PMIC_HILVLEN_bm|PMIC_MEDLVLEN_bm|PMIC_LOLVLEN_bm;
sei();
while(1)
{
if(qt_measure_flag)
{
qt_measure_flag = 0;
do{brust_flag = qt_measure_sensors(current_time_ms_touch)&QTLIB_BURST_AGAIN ;}
while(brust_flag);
Clear_Block_Area(1,1,0,127);
if (GET_SENSOR_STATE(0)) Search_Table_Display(1,0,1,Xlevel);
if (GET_SENSOR_STATE(1)) Search_Table_Display(1,1,1,Xlevel);
if (GET_SENSOR_STATE(2)) Search_Table_Display(1,2,1,Xlevel);
if (GET_SENSOR_STATE(3)) Search_Table_Display(1,3,1,Xlevel);
if (GET_SENSOR_STATE(4)) Search_Table_Display(1,4,1,Xlevel);
}
}
}
主程序代码,大神在哪里 |