Kenji Arai
/
LPC1114_SPI_LCD_ST7565family_test
Controller chip is ST7565
SPI LCD: AQM1248A (Akizuki) or AD-12864-SPI (antendo)
Revision 4:9d99684c6373, committed 2020-08-08
- Comitter:
- kenjiArai
- Date:
- Sat Aug 08 04:20:39 2020 +0000
- Parent:
- 3:031024851a8d
- Child:
- 5:9b4d9c139186
- Commit message:
- changed UART I/F, redirect to stdio
Changed in this revision
--- a/main.cpp Wed Aug 05 05:11:23 2020 +0000 +++ b/main.cpp Sat Aug 08 04:20:39 2020 +0000 @@ -6,7 +6,7 @@ * https://os.mbed.com/users/kenjiArai/ * Created: September 14th, 2014 * Revised: September 21st, 2014 - * Revised: August 5th, 2020 + * Revised: August 8th, 2020 */ /* Tested LCD @@ -27,6 +27,7 @@ // Include -------------------------------------------------------------------- #include "mbed.h" #include "ST7565_SPI_LCD.h" +#include "redirect_stdio.h" // Definition ----------------------------------------------------------------- //#define AITENDO @@ -49,8 +50,7 @@ // Object --------------------------------------------------------------------- // LED DigitalOut myled(dp28); -// com -BufferedSerial pc(dp16,dp15); + // SPI LCD #if defined(AITENDO) # if 1 @@ -147,21 +147,3 @@ lcd.printf("JH1PJL" ); } } - -uint8_t getc(void) -{ - uint8_t bf; - pc.read(&bf,1); - return bf; -} - -void putc(uint8_t c) -{ - uint8_t bf = c; - pc.write(&bf,1); -} - -FileHandle *mbed::mbed_override_console(int fd) -{ - return &pc; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/redirect_stdio/redirect_stdio.cpp Sat Aug 08 04:20:39 2020 +0000 @@ -0,0 +1,21 @@ +/* + * mbed Application program + * Redirect Standard Input/Output + * + * Copyright (c) 2020 Kenji Arai / JH1PJL + * http://www7b.biglobe.ne.jp/~kenjia/ + * https://os.mbed.com/users/kenjiArai/ + * Created: August 7th, 2020 + * Revised: August 7th, 2020 + */ + +#include "mbed.h" + +// Create a BufferedSerial object to be used by the system I/O retarget code +BufferedSerial pc(USBTX, USBRX, 9600); + +// the system I/O retarget +FileHandle *mbed::mbed_override_console(int fd) +{ + return &pc; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/redirect_stdio/redirect_stdio.h Sat Aug 08 04:20:39 2020 +0000 @@ -0,0 +1,36 @@ +/* + * mbed Application program + * Redirect Standard Input/Output + * + * Copyright (c) 2020 Kenji Arai / JH1PJL + * http://www7b.biglobe.ne.jp/~kenjia/ + * https://os.mbed.com/users/kenjiArai/ + * Created: August 7th, 2020 + * Revised: August 7th, 2020 + */ + +extern BufferedSerial pc; + +FileHandle *mbed::mbed_override_console(int fd); + +inline uint8_t readable(void) +{ + return pc.readable(); +} + +inline void putc(uint8_t c) +{ + char dt = c; + pc.write(&dt, 1); +} + +inline uint8_t getc(void) +{ + int c = getchar(); + return (uint8_t)c; +} + +inline void puts_wo_cr(char *bf, uint32_t len) +{ + pc.write(bf, len); +}