Adafruit ssd1331 OLED 96x64 SPI model
Fork of OledLib by
Diff: spioled96x64.h
- Revision:
- 2:e331851128c1
- Parent:
- 0:94eac1a165ab
- Child:
- 4:b68843c0269c
--- a/spioled96x64.h Wed Jan 12 02:43:37 2011 +0000 +++ b/spioled96x64.h Wed Jan 12 07:47:32 2011 +0000 @@ -1,74 +1,76 @@ -// 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); - - -}; - - +// ALO-095BWNN-J9 test program +// See also "http://www.aitendo.co.jp/product/2099" + + +#ifndef __SPIOLED96x64_H__ +#define __SPIOLED96x64_H__ + +#include "mbed.h" +#include "ascii_font6x8.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_WitchASC 6 // character's width +#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 RegWriteM(unsigned char *Command, int count); + 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 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); + void Pattern(int x,int y,int width, int height, unsigned int *p); +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 \ No newline at end of file