main.c中: 就执行以下语句:上电的同时按下键10,就是以下CSD_1_baSnsOnMask[1]==0x2, 但得到的结果总是表示键10没有按下,我怀疑是不是CSD初始化语句里, 把一上电检测的键10的电容值当成初始值,于是就没有识别键10为按下。麻烦帮我分析一下。 InitialGlobalParameters(); I2cStarUp(); ———————————————————————————————— void InitialGlobalParameters(void) { M8C_EnableGInt; //Enable CSD CSD_1_Start(); CSD_1_SetDefaultFingerThresholds(); CSD_1_InitializeBaselines(); //Enable I2CHW I2CHW_Start(); I2CHW_EnableMstr(); I2CHW_EnableInt();
} void I2cStarUp(void) { //read all HD information I2Cm_ReadData(DistributorNumAddr,&HDInformation_get.DistributorNumber_Read); I2Cm_ReadData(DistributorAttitudeAddr,&HDInformation_get.DistributorAttitude_Read); //I2Cm_SendCommand(SetHDFormatAddr,i); switch(HDInformation_get.DistributorNumber_Read&DISTRIBUTOR_NUMBER_MASK)//if HD owned no distributors { case 0: // no distributors feedback Sound_LightFeedback(10,10); OnlyDoOneType=0; // No do break; case 1: //one distributors ,reserved break; case 2: //two distributors,reserved break; case 3: //three distributors,reserved break; case 4: //four distributors,reserved break; case 5: //ATA if((HDInformation_get.DistributorAttitude_Read&DiSTRIBUTOR_ATTITUDE_ATA_MASK)!=0) // no encryption { if(CSD_1_baSnsOnMask[1] == 0x02) //power on with long pressing f1 botton { OnlyDoOneType=1; // Encrypt // EncryptOperation(); } else // SwitchWRState(); OnlyDoOneType=0; // No do } else // have encryption { if(CSD_1_baSnsOnMask[1] == 0x02) //power on with long pressing f1 botton { //ReEncryptOperation(); //including delete and reset password OnlyDoOneType=3; } else // DecryptOperation(); OnlyDoOneType=2; //Decrypt } I2Cm_SendCommand(0x20,OnlyDoOneType); break; default: break; } } |