OK,
hier also der hochkomplexe Sourcecode :
Zeigt endlos die Position an bis der Schalter an Pin P0.0 gedrückt wird
int main(int argc, char* argv[])
{
IOWKIT_HANDLE ioHandle;
int nWritten;
int nRead;
unsigned long bits;
IOWKIT_REPORT rep;
// Open device
ioHandle = IowKitOpenDevice();
// Check for failure
if (ioHandle == NULL)
{
printf("Failed to open device\n");
return 1;
}
// Init report
// Report ID 0 für Daten Ein/Ausgabe
rep.ReportID = 0;
// alle Pins zu Eingängen machen
rep.Value = 0xFFFFFFFF;
nWritten = IowKitWrite(ioHandle, 0, (PCHAR) &rep, sizeof(rep));
do
{
// blockierendes Read wartet auf nächsten Report
nRead = IowKitRead(ioHandle, 0, (PCHAR) &rep, sizeof(rep));
// Bits sortieren und Ausgeben
printf("Read, Data %d %X\n", nRead, rep.Value);
printf(" CSCAN : %d \n",((rep.Value & 0x00010000)>>16));
printf(" SCAN : %d \n",((rep.Value & 0x00008000)>>15));
printf(" END : %d \n",((rep.Value & 0x00004000)>>14));
printf(" TOUCH : %d \n",((rep.Value & 0x00002000)>>13));
bits = ((rep.Value & 0x00020000)>>15)
+((rep.Value & 0x00040000)>>17)
+((rep.Value & 0x00080000)>>19);
printf(" Zeile : %d \n",bits);
bits = ((rep.Value & 0x00100000)>>17)
+((rep.Value & 0x00200000)>>19)
+((rep.Value & 0x00400000)>>21)
+((rep.Value & 0x00800000)>>23);
printf(" Spalte : %d \n",bits);
}
while ((rep.Value & 0x00000001)==1);
// Close device
IowKitCloseDevice(ioHandle);
return 0;
}