]>
git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/tests/mbed/portout_portin/main.cpp
3 #if defined(TARGET_K64F) || defined(TARGET_KL05Z)
12 #elif defined(TARGET_LPC11U24)
13 #define P1_1 (1 << 9) // p0.9
14 #define P1_2 (1 << 8) // p0.8
17 #define P2_1 (1 << 24) // p1.24
18 #define P2_2 (1 << 25) // p1.25
21 #elif defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
22 #define P1_1 (1 << 9) // p0.9 -> p5
23 #define P1_2 (1 << 8) // p0.8 -> p6
26 #define P2_1 (1 << 1) // p2.1 -> p25
27 #define P2_2 (1 << 0) // p2.0 -> p26
30 #elif defined(TARGET_LPC4088)
31 #define P1_1 (1 << 7) // p0.7 -> p13
32 #define P1_2 (1 << 6) // p0.6 -> p14
35 #define P2_1 (1 << 2) // p1.2 -> p30
36 #define P2_2 (1 << 3) // p1.3 -> p29
39 #elif defined(TARGET_LPC1114)
40 #define P1_1 (1 << 9) // p0.9
41 #define P1_2 (1 << 8) // p0.8
44 #define P2_1 (1 << 1) // p1.1
45 #define P2_2 (1 << 0) // p1.0
48 #elif defined(TARGET_KL25Z)
49 #define P1_1 (1 << 4) // PTA4
50 #define P1_2 (1 << 5) // PTA5
53 #define P2_1 (1 << 5) // PTC5
54 #define P2_2 (1 << 6) // PTC6
57 #elif defined(TARGET_nRF51822)
58 #define P1_1 (1 << 4) // p4
59 #define P1_2 (1 << 5) // p5
62 #define P2_1 (1 << 24) // p24
63 #define P2_2 (1 << 25) // p25
66 #elif defined(TARGET_MAXWSNENV)
75 #elif defined(TARGET_MAX32600MBED)
76 #define P1_1 (1 << 0) // P1_0
77 #define P1_2 (1 << 1) // P1_1
80 #define P2_1 (1 << 7) // P4_7
81 #define P2_2 (1 << 6) // P4_6
84 #elif defined(TARGET_NUCLEO_F030R8) || \
85 defined(TARGET_NUCLEO_F070RB) || \
86 defined(TARGET_NUCLEO_F072RB) || \
87 defined(TARGET_NUCLEO_F091RC) || \
88 defined(TARGET_NUCLEO_F103RB) || \
89 defined(TARGET_NUCLEO_F302R8) || \
90 defined(TARGET_NUCLEO_F303RE) || \
91 defined(TARGET_NUCLEO_F334R8) || \
92 defined(TARGET_NUCLEO_F401RE) || \
93 defined(TARGET_NUCLEO_F411RE) || \
94 defined(TARGET_NUCLEO_L053R8) || \
95 defined(TARGET_NUCLEO_L073RZ) || \
96 defined(TARGET_NUCLEO_L152RE)
97 #define P1_1 (1 << 6) // PC_6
98 #define P1_2 (1 << 5) // PC_5
101 #define P2_1 (1 << 8) // PB_8
102 #define P2_2 (1 << 9) // PB_9
106 #define MASK_1 (P1_1 | P1_2)
107 #define MASK_2 (P2_1 | P2_2)
109 PortOut
port_out(PORT_1
, MASK_1
);
110 PortIn
port_in (PORT_2
, MASK_2
);
113 MBED_HOSTTEST_TIMEOUT(20);
114 MBED_HOSTTEST_SELECT(default_auto
);
115 MBED_HOSTTEST_DESCRIPTION(PortOut PortIn
);
116 MBED_HOSTTEST_START("MBED_A10");
120 int value
= port_in
.read();
121 if (value
!= MASK_2
) {
122 printf("[Test high] expected (0x%x) received (0x%x)\n", MASK_2
, value
);
123 notify_completion(false);
128 value
= port_in
.read();
130 printf("[Test low] expected (0x%x) received (0x%x)\n", 0, value
);
131 notify_completion(false);
134 notify_completion(true);