blob: 327bca62d411f0f50eeaf8ce2c449116ae211b46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include "mbed.h"
#if defined(TARGET_LPC1768)
#define UART_TX p9
#define UART_RX p10
#define FLOW_CONTROL_RTS p30
#define FLOW_CONTROL_CTS p29
#define RTS_CHECK_PIN p8
#else
#error This test is not supported on this target
#endif
Serial pc(UART_TX, UART_RX);
#ifdef RTS_CHECK_PIN
InterruptIn in(RTS_CHECK_PIN);
DigitalOut led(LED1);
static void checker(void) {
led = !led;
}
#endif
int main() {
char buf[256];
pc.set_flow_control(Serial::RTSCTS, FLOW_CONTROL_RTS, FLOW_CONTROL_CTS);
#ifdef RTS_CHECK_PIN
in.fall(checker);
#endif
while (1) {
pc.gets(buf, 256);
pc.printf("%s", buf);
}
}
|