PS/2
Dependents: Synth Lab3Translator PS2_Keyboard CLI ... more
Diff: PS2MS_INIT.cpp
- Revision:
- 2:a57bbbec16b1
- Parent:
- 1:823c2798e398
--- a/PS2MS_INIT.cpp Wed Sep 29 14:11:44 2010 +0000 +++ b/PS2MS_INIT.cpp Wed Sep 29 22:15:03 2010 +0000 @@ -16,6 +16,14 @@ clk.write(1); dat.write(1); + /* + * 0xFF: Reset command. + * 0xF3: Set sample rate. + * 0xF2: Read device type. + * 0xE8: Set resolution. + * 0xE6: Set scaling. + * 0xF4: Enable device. + */ char txdat[17] = "\xFF\xFF\xFF\xF3\xC8\xF3\x64\xF3\x50\xF2\xE8\x03\xE6\xF3\x28\xF4"; const int n = sizeof(txdat); int txerrcnt = 0; @@ -27,6 +35,11 @@ if (recv() < 0) { rxerrcnt++; } + if (txdat[i] == 0xF2) { + if (recv() < 0) { + rxerrcnt++; + } + } if (txdat[i] == 0xFF) { if (recv() < 0) { rxerrcnt++;