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

spioled96x64.h

Committer:
TETSUYA
Date:
2011-01-11
Revision:
0:94eac1a165ab
Child:
2:e331851128c1

File content as of revision 0:94eac1a165ab:

// ALO-095BWNN-J9 test program
// See also "http://www.aitendo.co.jp/product/2099"


#ifndef __SPIOLED96x64_H__
#define __SPIOLED96x64_H__

#include "mbed.h"
#include "small_font.h"

#define Dis_X_MAX 96-1      // Max X axial direction in screen
#define Dis_Y_MAX 64-1      // Max Y axial direction in screen
#define X_Witch 8           // character's width
#define Y_Witch 8           // character's height

#define CS_NORMAL  0
#define CS_WIDE    1
#define CS_HIGH    2
#define CS_WH      3
#define CS_WHx36   4

class SPIOLED96x64 : public Stream {
public:
    // constructor
    SPIOLED96x64(PinName cs_pin, PinName rst_pin, PinName a0_pin, PinName mosi_pin, PinName miso_pin, PinName sclk_pin);
 #if DOXYGEN_ONLY
     int putc(int c);
     int printf(const char* format, ...);
 #endif
    void  RegWrite(unsigned char Command);
    void  DataWrite(unsigned char c);
    void  DataWrite_to(unsigned int Dat);

    void Draw_Dot(int x,int y,unsigned int Color);

    void Box(int x1,int y1, int x2, int y2, unsigned int Color, int fill);
    void Fill_Screen(unsigned int Color);
    
    void CS_Conv(int *lpx, int *lpy);
    unsigned int ColorConv(unsigned int R,unsigned int G,unsigned int B);
    void ChangeFontColor(unsigned int color);
    void ChangeBGColor(unsigned int color);
    void SetFontSize(int);
    //void putc(unsigned char c);
    void locate(int column, int row);
    int row();
    int column();
    void puts( char *s );

    void line( int x0,int y0,int x1,int y1, unsigned int fore_col ,int pat  );
    void circle (int radius, int x, int y , unsigned int col, int fill);

protected:
     // Stream implementation functions
     virtual int _putc( int c );
     virtual int _getc();
private:
    DigitalOut  CS,  RES,  DC;
    SPI spi; // mosi, miso, sclk

    unsigned int Char_Color;    // character's color
    unsigned int BGround_Color;
    int x_locate;
    int y_locate;
    int chr_size;
    void Init(void);
    void PutChar(int x,int y,unsigned int a);
    unsigned int findface(unsigned short c);


};


#endif