ALO-095BWNN-J9 aitendo OLED 96x64 SPI model Ver1.04

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers spioled96x64.h Source File

spioled96x64.h

00001 // ALO-095BWNN-J9 test program
00002 // See also "http://www.aitendo.co.jp/product/2099"
00003 
00004 
00005 #ifndef __SPIOLED96x64_H__
00006 #define __SPIOLED96x64_H__
00007 
00008 #include "mbed.h"
00009 #include "ascii_font6x8.h"
00010 #include "small_font.h"
00011 
00012 //#define __USE_GAC__     // use SSD1331/1332 Graphi Accelaration Command
00013 
00014 #define Dis_X_MAX 96-1      // Max X axial direction in screen
00015 #define Dis_Y_MAX 64-1      // Max Y axial direction in screen
00016 #define X_WitchASC 6        // character's width
00017 #define X_Witch 8           // character's width
00018 #define Y_Witch 8           // character's height
00019 
00020 #define CS_NORMAL  0
00021 #define CS_WIDE    1
00022 #define CS_HIGH    2
00023 #define CS_WH      3
00024 #define CS_WHx36   4
00025 
00026 
00027 
00028 #define GAC_FILL_ENABLE_DISABLE  0x26   // �h��‚Ԃ��”ۃR�}���h
00029 #define GAC_DRAW_RECTANGLE       0x22   // Rectangle cmd
00030 
00031 #define GAC_COPY_AREA            0x23   // Copy Area
00032 #define GAC_SCROLL_SETUP         0x27
00033 #define GAC_SCROLL_STOP          0x2E
00034 #define GAC_SCROLL_START         0x2F
00035 
00036 class SPIOLED96x64 : public Stream {
00037 public:
00038     // constructor
00039     SPIOLED96x64(PinName cs_pin, PinName rst_pin, PinName a0_pin, PinName mosi_pin, PinName miso_pin, PinName sclk_pin);
00040  #if DOXYGEN_ONLY
00041      int putc(int c);
00042      int printf(const char* format, ...);
00043  #endif
00044     void  RegWrite(unsigned char Command);
00045     void  RegWriteM(unsigned char *Command, int count);
00046     void  DataWrite(unsigned char c);
00047     void  DataWrite_to(unsigned int Dat);
00048 
00049     void Draw_Dot(int x,int y,unsigned int Color);
00050 
00051     void Box(int x1,int y1, int x2, int y2, unsigned int Color, int fill);
00052     void Fill_Screen(unsigned int Color);
00053     
00054     void CS_Conv(int *lpx, int *lpy);
00055     unsigned int ColorConv(unsigned int R,unsigned int G,unsigned int B);
00056     void ChangeFontColor(unsigned int color);
00057     void ChangeBGColor(unsigned int color);
00058     void SetFontSize(int);
00059     void locate(int column, int row);
00060     int row();
00061     int column();
00062 
00063     void line( int x0,int y0,int x1,int y1, unsigned int fore_col ,int pat  );
00064     void circle (int radius, int x, int y , unsigned int col, int fill);
00065     void Pattern(int x,int y,int width, int height, unsigned int *p);
00066     void GACEnable(int enable);
00067     
00068     void Copy(int src_x1,int src_y1,int src_x2,int src_y2, int dst_x,int dst_y);
00069     void ScrollSet(int a, int b, int c, int d , int frame_interval);
00070     void Scroll(int enable);
00071     
00072 protected:
00073      // Stream implementation functions
00074      virtual int _putc( int c );
00075      virtual int _getc();
00076 private:
00077     DigitalOut  CS,  RES,  DC;
00078     SPI spi; // mosi, miso, sclk
00079 
00080     unsigned int Char_Color;    // character's color
00081     unsigned int BGround_Color;
00082     int GAC_Useflag;
00083     int x_locate;
00084     int y_locate;
00085     int chr_size;
00086     void Init(void);
00087     void PutChar(int x,int y,unsigned int a);
00088     unsigned int findface(unsigned short c);
00089 
00090 
00091 };
00092 
00093 
00094 #endif