键值读取部分的驱动程序如下 int8_t Read_Byte(){ uint8_t i=0; uint8_t temp=0x00; Reset(STB); for(i=0;i<8;i++){ Reset(CLK1); temp>>=1; if(Get(DIO)){ temp|=0x80; } Set(CLK1); } return temp; } int8_t Read_Key(){ uint8_t i=0; uint8_t key1=0x00; uint16_t key2=0x00; Write_Cmd(0x42); Set(DIO); //this is obligatory, check the data sheet,GPIO for(i=0;i<4;i++){ key1=Read_Byte(); key2|=(key1<<i);} key2>>=1; for(i=0;i<8;i++){ if(0x01<<i==key2)return i+1; } return 0; } |
数码港驱动正常就是不能获得键值。 |