86 lines
2.3 KiB
C++
86 lines
2.3 KiB
C++
/*
|
|
sys64738.h - Library from sys64738.
|
|
Created by Paolo Iocco, October 20, 2014.
|
|
Released into the public domain.
|
|
*/
|
|
#ifndef sys64738_h
|
|
#define sys64738_h
|
|
|
|
//#if ARDUINO >= 100
|
|
#include "Arduino.h"
|
|
//#else
|
|
//#include "WProgram.h"
|
|
//#endif
|
|
#include "font.h"
|
|
|
|
/*
|
|
* Classe generale per la grafica
|
|
*/
|
|
|
|
class graphic{
|
|
public:
|
|
graphic(void);
|
|
virtual void Init(void);
|
|
virtual void Clear(void);
|
|
virtual void Fillscreen(unsigned char FillData);
|
|
virtual void Locate (unsigned char x, unsigned char y);
|
|
virtual void WriteChar(char character, char font);
|
|
void WriteCharXY(unsigned char x, unsigned char y, char character, char font);
|
|
void WriteString(char *characters, char font);
|
|
void WriteStringXY(unsigned char x, unsigned char y, char *characters, char font);
|
|
virtual void Draw_BMP(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1,const char BMP[]);
|
|
|
|
protected:
|
|
byte _MaxX, _MaxY;
|
|
const byte *_font;
|
|
byte _ch_width;
|
|
};
|
|
|
|
//********************************************************************************************************************
|
|
//** NOKIA 5110 Display over SPI
|
|
|
|
#define LCD_C LOW
|
|
#define LCD_D HIGH
|
|
class Display5110 : public graphic {
|
|
public:
|
|
Display5110(char PIN_SCE,char PIN_RESET,char PIN_DC,char PIN_SDIN,char PIN_SCLK);
|
|
void Init(void);
|
|
void Clear (void);
|
|
void Locate (unsigned char x, unsigned char y);
|
|
void WriteChar(char character, char font);
|
|
private:
|
|
void WriteByte(byte dc, byte data);
|
|
void SetContrast(unsigned char contrast);
|
|
char _PIN_SCE;
|
|
char _PIN_RESET;
|
|
char _PIN_DC;
|
|
char _PIN_SDIN;
|
|
char _PIN_SCLK;
|
|
};
|
|
|
|
//********************************************************************************************************************
|
|
//** OLED 2 Colors display over I2C
|
|
|
|
#define BLACK 0
|
|
#define WHITE 1
|
|
class DisplayIIC : public graphic{
|
|
public:
|
|
DisplayIIC(int sda, int scl);
|
|
void Init();
|
|
void Clear();
|
|
void FillScreen(unsigned char fill_Data);
|
|
void Locate(unsigned char x, unsigned char y);
|
|
void WriteChar(char character, char font);
|
|
void Draw_BMP(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1,const char BMP[]);
|
|
private:
|
|
void IIC_Start();
|
|
void IIC_Stop();
|
|
void IIC_WriteByte(unsigned char IIC_Byte);
|
|
void IIC_Command(unsigned char IIC_Command);
|
|
void IIC_Data();
|
|
int _sda;
|
|
int _scl;
|
|
};
|
|
|
|
#endif
|