Extended library from C12832 Lib. by Peter Drescher, Chris Styles & Mihail Stoyanov. LCD in the market such as AQM1248A (Akizuki), AD-12864-SPI (antendo), NHD-C12832 (Newhaven), ST7565 (adafruit) and so on

Dependents:   CW_Decoder_using_FFT_on_F446 LPC1114_SPI_LCD_ST7565family_test

Fork of C12832 by Components

Original library is below link.
http://mbed.org/teams/components/code/C12832/
https://mbed.org/users/dreschpe/code/C12832_lcd/

I extended applicable LCD's not only 128 x 32 but also 128 x 48 and 128 x 64 type of SPI LCD using ST7565 controller.
I have checked AD-12864-SPI and AQM1248 LCD.
/media/uploads/kenjiArai/ad-12864-spi_12.png /media/uploads/kenjiArai/aqm12848_2.png

Import programLPC1114_SPI_LCD_ST7565family_test

Controller chip is ST7565

Revision:
23:233a0d635d9d
Parent:
21:a1fc999cd8f3
--- a/ST7565_SPI_LCD.h	Sat Dec 13 05:29:11 2014 +0000
+++ b/ST7565_SPI_LCD.h	Wed Aug 05 05:08:59 2020 +0000
@@ -1,16 +1,17 @@
 /*
     EXTEND for SPI interface LCD which is using ST7565 controller
-        Modified by Kenji Arai / JH1PJL  
-        http://www.page.sannet.ne.jp/kenjia/index.html
-        http://mbed.org/users/kenjiArai/
+        Modified by Kenji Arai / JH1PJL
+         http://www7b.biglobe.ne.jp/~kenjia/
+         https://os.mbed.com/users/kenjiArai/
             Started: September 20th, 2014
             Revised: November  29th, 2014
+            Revised: August     5th, 2020
 
     original file: C12832.h
     original Library name: C12832
 */
 
-//---------- ORIGINAL Header ----------------------------------------------------
+//---------- ORIGINAL Header ---------------------------------------------------
 /* mbed library for the mbed Lab Board  128*32 pixel LCD
  * use C12832 controller
  * Copyright (c) 2012 Peter Drescher - DC2PD
@@ -33,12 +34,12 @@
 
 /** Bitmap
  */
-struct Bitmap{
+struct Bitmap {
     int xSize;
     int ySize;
     int Byte_in_Line;
     char* data;
-    };
+};
 
 /** SPI LCD control library for ST7565 Controller
  *      http://www.ladyada.net/learn/lcd/st7565.html
@@ -48,12 +49,14 @@
  *
  * @code
  * #include "mbed.h"
- * 
- * #if 1  
- * ST7565   lcd(dp2, dp6, dp10, dp4, dp9, ST7565::AD12864SPI); // mosi, sck, reset, a0, ncs
+ *
+ * #if 1
+ * //           mosi, sck, reset, a0, ncs
+ * ST7565   lcd(dp2, dp6, dp10, dp4, dp9, ST7565::AD12864SPI);
  * #else
  * SPI      spi_lcd(dp2, dp1, dp6); // mosi, miso, sck
- * ST7565   lcd(spi_lcd, dp10, dp4, dp9, ST7565::AD12864SPI);  // spi, reset, a0, ncs
+ * //           spi, reset, a0, ncs
+ * ST7565   lcd(spi_lcd, dp10, dp4, dp9, ST7565::AD12864SPI);
  * #endif
  *
  * int main() {
@@ -69,26 +72,37 @@
  * @endcode
  */
 
-class ST7565 : public GraphicsDisplay{
+class ST7565 : public GraphicsDisplay
+{
 public:
 
     /** LCD panel format */
     enum LCDType {
-        LCD128x32,    
+        LCD128x32,
         LCD128x48,
         LCD128x64,
         AQM1248A   = LCD128x48,
         AD12864SPI = LCD128x64,
-        ST7565LCD  = LCD128x64                        
+        ST7565LCD  = LCD128x64
     };
-    
+
     /**
      * Create a ST7565 object connected to SPI1
      */
     ST7565(PinName mosi, PinName sck,
-           PinName reset, PinName a0, PinName ncs, LCDType type, const char* name = "LCD");
+           PinName reset,
+           PinName a0,
+           PinName ncs,
+           LCDType type,
+           const char* name = "LCD"
+          );
     ST7565(SPI& _spi,
-           PinName reset, PinName a0, PinName ncs, LCDType type, const char* name = "LCD");
+           PinName reset,
+           PinName a0,
+           PinName ncs,
+           LCDType type,
+           const char* name = "LCD"
+          );
 
     /**
      * Get the width of the screen in pixel
@@ -224,13 +238,13 @@
      * @param y y-position
      */
     virtual void locate(int x, int y);
-    
+
     /**
-     * Setup auto update of screen 
+     * Setup auto update of screen
      *
      * @param up 1 = on , 0 = off
      *
-     * if switched off the program has to call copy_to_lcd() 
+     * if switched off the program has to call copy_to_lcd()
      * to update screen from framebuffer
      */
     void set_auto_up(unsigned int up);
@@ -247,8 +261,8 @@
      *
      * @param f pointer to font array
      *
-     *   font array can created with GLCD Font Creator from http://www.mikroe.com
-     *   you have to add 4 parameter at the beginning of the font array to use:
+     * font array can created with GLCD Font Creator from http://www.mikroe.com
+     * you have to add 4 parameter at the beginning of the font array to use:
      *   - the number of byte / char
      *   - the vertial size in pixel
      *   - the horizontal size in pixel
@@ -256,7 +270,7 @@
      *   you also have to change the array to char[]
      */
     void set_font(unsigned char* f);
-    
+
     /**
      * Print bitmap to buffer
      *
@@ -290,15 +304,16 @@
     /** Draw color
       */
     enum {WHITE = 0,BLACK};
-    
+
     /** Draw mode
       * NORMAl
       * XOR set pixel by xor the screen
       */
     enum {NORMAL,XOR};
-    
+
     /** Vars     */
-    SPI _spi;
+    SPI *_spi_p;
+    SPI &_spi;
     DigitalOut _reset;
     DigitalOut _A0;
     DigitalOut _CS;
@@ -314,7 +329,7 @@
     void initialize(LCDType type);
 
     virtual int _putc(int value);
-        
+
     unsigned int lcd_width;
     unsigned int lcd_height;
     unsigned int char_x;