ks0713 SPI library. This library includes a small 5x5 ascii font and line function.

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ks0713_spi.h Source File

ks0713_spi.h

00001 #ifndef MBED_KS0713_SPI_H
00002 #define MBED_KS0713_SPI_H
00003 
00004 #define MBED_KS0713_SPI_WIDTH  100
00005 #define MBED_KS0713_SPI_HEIGHT  32
00006 
00007 
00008 #include "mbed.h"
00009 //
00010 // KS0713 SPI driver for aitendo 100x32 LCD module.
00011 //
00012 // This driver is based on Tony Beck's KS0713 library. Thank you.
00013 //
00014 //  Website: http://www.aitendo.co.jp/product/3127
00015 //
00016 // LCD module pin assign
00017 //
00018 //    1.VSS(GND)
00019 //    2.VDD(3.3V)
00020 //    3.CS1B
00021 //    4.CS2(tie off to H)
00022 //    5.RS(1:data, 0:command)
00023 //    6.RD(tie off to H or L)
00024 //    7.WR(tie off to H or L)
00025 //    8.PS(1:parallel, 0:serial) (tie off to L)
00026 //    9.RESETN
00027 //    10.MI(1:6800, 0:8080) (tie off to H or L)
00028 //    11.DB7(serial data, MSB 1st)
00029 //    12.DB6(serial clock)
00030 //    13.DB5 NC
00031 //    14.DB4 NC
00032 //    15.DB3 NC
00033 //    16.DB2 NC
00034 //    17.DB1 NC
00035 //    18.DB0 NC
00036 //    19.NC
00037 
00038 
00039 class KS0713_SPI : public Stream {
00040 public:
00041     KS0713_SPI(PinName mosi, PinName sclk, PinName cs1b, PinName rs, PinName rstb);
00042     void init();
00043     void clear();
00044     void fill();
00045     void update();
00046     void locate(int x, int y);
00047     void line(int x1, int y1, int x2, int y2);
00048 private:
00049     SPI _spi;
00050     DigitalOut _cs1b;
00051     DigitalOut _rs;
00052     DigitalOut _rstb;
00053     int _x,_y;
00054 
00055 
00056     void writeCommand(unsigned char);
00057     void writeData(unsigned char);
00058 
00059     unsigned char vram[MBED_KS0713_SPI_WIDTH][MBED_KS0713_SPI_HEIGHT/8];
00060 
00061 protected:
00062     virtual int _putc(int value);
00063     virtual int _getc();
00064 
00065 
00066 };
00067 
00068 #endif