Kenji Arai
/
LPC1114_SPI_LCD_ST7565family_test
Controller chip is ST7565
SPI LCD: AQM1248A (Akizuki) or AD-12864-SPI (antendo)
Diff: uart_as_stdio/uart_as_stdio.cpp
- Revision:
- 5:9b4d9c139186
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uart_as_stdio/uart_as_stdio.cpp Sat Feb 27 01:14:00 2021 +0000 @@ -0,0 +1,46 @@ +/* + * mbed Application program + * Redirect Standard Input/Output + * + * Copyright (c) 2021 Kenji Arai / JH1PJL + * http://www7b.biglobe.ne.jp/~kenjia/ + * https://os.mbed.com/users/kenjiArai/ + * Created: January 13th, 2021 + * Revised: January 14th, 2021 + */ + +// Include -------------------------------------------------------------------- +#include "mbed.h" + +// Definition ----------------------------------------------------------------- + +// Constructor ---------------------------------------------------------------- +static BufferedSerial pc(USBTX, USBRX, 115200); + +// RAM ------------------------------------------------------------------------ + +// ROM / Constant data -------------------------------------------------------- + +// Function prototypes -------------------------------------------------------- + +//------------------------------------------------------------------------------ +// Control Program +//------------------------------------------------------------------------------ +uint8_t readable() +{ + return pc.readable(); +} + +void putc(uint8_t c) +{ + char dt[4]; + dt[0] = (char)c; + pc.write(dt, 1); +} + +uint8_t getc() +{ + char dt[4]; + pc.read(dt, 1); + return (uint8_t)dt[0]; +}