1 |
|
2 | Status = SPI_GetHiSpeedDeviceNameLocIDChannel(dwHiSpeedDeviceIndex, szHiSpeedDeviceName, 100, &dwLocationHiSpeedID, szHiSpeedChannel, 5, &dwHiSpeedDeviceType);
|
3 |
|
4 | Status = SPI_OpenHiSpeedDevice(szHiSpeedDeviceName, dwLocationHiSpeedID, szHiSpeedChannel, &ftHandle);
|
5 |
|
6 | Status = SPI_InitDevice(ftHandle, 0);
|
7 |
|
8 | Sleep(500);
|
9 |
|
10 | //Lesen des akt. GPIOH-Status nach Initialisierung
|
11 | Status = SPI_GetHiSpeedDeviceGPIOs(ftHandle, &HighPinsInputData);
|
12 |
|
13 | Sleep(500);
|
14 |
|
15 | //Ergebnisse ausgeben
|
16 | MessageBox::Show(
|
17 | "Status after Init" +
|
18 | "n_____________________________" +
|
19 | "nStatus from GPIOH0= " + HighPinsInputData.bPin1LowHighState +
|
20 | "nStatus from GPIOH1= " + HighPinsInputData.bPin2LowHighState +
|
21 | "nStatus from GPIOH2= " + HighPinsInputData.bPin3LowHighState +
|
22 | "nStatus from GPIOH3= " + HighPinsInputData.bPin4LowHighState +
|
23 | "nStatus from GPIOH4= " + HighPinsInputData.bPin5LowHighState +
|
24 | "nStatus from GPIOH5= " + HighPinsInputData.bPin6LowHighState +
|
25 | "nStatus from GPIOH6= " + HighPinsInputData.bPin7LowHighState +
|
26 | "nStatus from GPIOH7= " + HighPinsInputData.bPin8LowHighState
|
27 | );
|
28 |
|
29 | //Steht so im FTDI-Beispielcode
|
30 | ChipSelectsDisableStates.bADBUS3ChipSelectPinState = true;
|
31 | ChipSelectsDisableStates.bADBUS4GPIOL1PinState = false;
|
32 | ChipSelectsDisableStates.bADBUS5GPIOL2PinState = false;
|
33 | ChipSelectsDisableStates.bADBUS6GPIOL3PinState = false;
|
34 | ChipSelectsDisableStates.bADBUS7GPIOL4PinState = false;
|
35 |
|
36 | //GPIOHs als Outputs einstellen und Status festlegen
|
37 | HighInputOutputPins.bPin1InputOutputState = true;
|
38 | HighInputOutputPins.bPin2InputOutputState = true;
|
39 | HighInputOutputPins.bPin3InputOutputState = true;
|
40 | HighInputOutputPins.bPin4InputOutputState = true;
|
41 | HighInputOutputPins.bPin5InputOutputState = true;
|
42 | HighInputOutputPins.bPin6InputOutputState = true;
|
43 | HighInputOutputPins.bPin7InputOutputState = true;
|
44 | HighInputOutputPins.bPin8InputOutputState = true;
|
45 |
|
46 | HighInputOutputPins.bPin1LowHighState = true;
|
47 | HighInputOutputPins.bPin2LowHighState = false;
|
48 | HighInputOutputPins.bPin3LowHighState = true;
|
49 | HighInputOutputPins.bPin4LowHighState = false;
|
50 | HighInputOutputPins.bPin5LowHighState = true;
|
51 | HighInputOutputPins.bPin6LowHighState = false;
|
52 | HighInputOutputPins.bPin7LowHighState = true;
|
53 | HighInputOutputPins.bPin8LowHighState = false;
|
54 |
|
55 | //Setzen der GPIOH-Einstellungen
|
56 | Status = SPI_SetHiSpeedDeviceGPIOs(ftHandle, &ChipSelectsDisableStates, &HighInputOutputPins);
|
57 |
|
58 | Sleep(500);
|
59 |
|
60 | ////Lesen des akt. GPIOH-Status nach Setzen
|
61 | Status = SPI_GetHiSpeedDeviceGPIOs(ftHandle, &HighPinsInputData);
|
62 |
|
63 | ////Ergebnisse erneut ausgeben
|
64 | MessageBox::Show(
|
65 | "Status after Setting" +
|
66 | "n_____________________________" +
|
67 | "nStatus from GPIOH0= " + HighPinsInputData.bPin1LowHighState +
|
68 | "nStatus from GPIOH1= " + HighPinsInputData.bPin2LowHighState +
|
69 | "nStatus from GPIOH2= " + HighPinsInputData.bPin3LowHighState +
|
70 | "nStatus from GPIOH3= " + HighPinsInputData.bPin4LowHighState +
|
71 | "nStatus from GPIOH4= " + HighPinsInputData.bPin5LowHighState +
|
72 | "nStatus from GPIOH5= " + HighPinsInputData.bPin6LowHighState +
|
73 | "nStatus from GPIOH6= " + HighPinsInputData.bPin7LowHighState +
|
74 | "nStatus from GPIOH7= " + HighPinsInputData.bPin8LowHighState
|
75 | );
|