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

TextDisplay.h

Committer:
kenjiArai
Date:
2020-08-05
Revision:
23:233a0d635d9d
Parent:
17:1c3011afe95d

File content as of revision 23:233a0d635d9d:

/* mbed TextDisplay Library Base Class
 * Copyright (c) 2007-2009 sford
 * Released under the MIT License: http://mbed.org/license/mit
 *
 * A common base class for Text displays
 * To port a new display, derive from this class and implement
 * the constructor (setup the display), character (put a character
 * at a location), rows and columns (number of rows/cols) functions.
 * Everything else (locate, printf, putc, cls) will come for free
 *
 * The model is the display will wrap at the right and bottom, so you can
 * keep writing and will always get valid characters. The location is 
 * maintained internally to the class to make this easy
 */

#ifndef MBED_TEXTDISPLAY_H
#define MBED_TEXTDISPLAY_H

#include "mbed.h"
#include "Stream.h"     // need on mbed-os-6.2.0, Aug. 5th, 2020 by JH1PJL

/**
 * TextDisplay interface
 */
class TextDisplay : public Stream {
public:

    /**
     * Create a TextDisplay interface
     *
     * @param name The name used in the path to access the strean through the filesystem
     */
    TextDisplay(const char *name = NULL);

    /**
     * Output a character at the given position
     *
     * @param column column where charater must be written
     * @param  row where character must be written
     * @param c the character to be written to the TextDisplay
     */
    virtual void character(int column, int row, int c) = 0;

    /**
     * Return number of rows on TextDisplay
     *
     * @results number of rows
     */
    virtual int rows() = 0;

    /**
     * Return number if columns on TextDisplay\
     *
     * @results number of rows
     */
    virtual int columns() = 0;
    
    // functions that come for free, but can be overwritten

    /**
     * Redirect output from a stream (stoud, sterr) to  display
     *
     * @param stream stream that shall be redirected to the TextDisplay
     */
    virtual bool claim (FILE *stream);

    /**
     * Clear screen
     */
    virtual void cls();
    
    /**
     * Change the cursor position to column, row (in pixels)
     */
    virtual void locate(int column, int row);
    
    virtual void foreground(uint16_t colour);
    virtual void background(uint16_t colour);
    // putc (from Stream)
    // printf (from Stream)
    
protected:

    virtual int _putc(int value);
    virtual int _getc();

    // character location
    uint16_t _column;
    uint16_t _row;

    // colours
    uint16_t _foreground;
    uint16_t _background;
    char *_path;
};

#endif