2013-12-04 17:46:51 +00:00
|
|
|
#include "mbed.h"
|
|
|
|
|
|
|
|
#if defined(TARGET_LPC1768)
|
2013-12-19 13:05:36 +00:00
|
|
|
#define UART_TX p9
|
|
|
|
#define UART_RX p10
|
2013-12-11 14:31:59 +00:00
|
|
|
#define FLOW_CONTROL_RTS p30
|
2013-12-19 13:05:36 +00:00
|
|
|
#define FLOW_CONTROL_CTS p29
|
|
|
|
#define RTS_CHECK_PIN p8
|
2013-12-04 17:46:51 +00:00
|
|
|
#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);
|
|
|
|
}
|
|
|
|
}
|