Oliver Broad / Adafruit-GP9002-Grayscale-VFD-Library

Dependencies:   bitreversetable256

Dependents:   GP9002af_gray

Fork of Adafruit-GP9002-Graphic-VFD-Library by Oliver Broad

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Adafruit_GP9002.h Source File

Adafruit_GP9002.h

00001 #ifndef _ADAFRUIT_GP9002_H
00002 #define _ADAFRUIT_GP9002_H
00003 
00004 #include "mbed.h"
00005 
00006 #include "Adafruit_GFX.h"
00007 
00008 #define BLACK  0
00009 #define GRAY   1
00010 #define LTGRAY 2
00011 #define WHITE  3
00012 
00013 #define GP9002_DISPLAYSOFF 0x00
00014 #define GP9002_DISPLAY1ON 0x01
00015 #define GP9002_DISPLAY2ON 0x02
00016 #define GP9002_ADDRINCR 0x04
00017 #define GP9002_ADDRHELD 0x05
00018 #define GP9002_CLEARSCREEN 0x06
00019 #define GP9002_CONTROLPOWER 0x07
00020 #define GP9002_DATAWRITE 0x08
00021 #define GP9002_DATAREAD 0x09
00022 #define GP9002_LOWERADDR1 0x0A
00023 #define GP9002_HIGHERADDR1 0x0B
00024 #define GP9002_LOWERADDR2 0x0C
00025 #define GP9002_HIGHERADDR2 0x0D
00026 #define GP9002_ADDRL 0x0E
00027 #define GP9002_ADDRH 0x0F
00028 #define GP9002_OR 0x10
00029 #define GP9002_XOR 0x11
00030 #define GP9002_AND 0x12
00031 #define GP9002_BRIGHT 0x13
00032 #define GP9002_DISPLAY 0x14
00033 #define GP9002_DISPLAY_MONOCHROME 0x10
00034 #define GP9002_DISPLAY_GRAYSCALE 0x14
00035 #define GP9002_INTMODE 0x15
00036 #define GP9002_DRAWCHAR 0x20
00037 #define GP9002_CHARRAM 0x21
00038 #define GP9002_CHARSIZE 0x22
00039 #define GP9002_CHARBRIGHT 0x24
00040 
00041 
00042 class Adafruit_GP9002 : public Adafruit_GFX {
00043  public:
00044 /*  Adafruit_GP9002(int8_t SCLK, int8_t MISO, int8_t MOSI, 
00045           int8_t CS, int8_t DC);
00046 */
00047   Adafruit_GP9002(SPI &SPIport, PinName CS, PinName DC);
00048 
00049   // particular to this display
00050   void begin(void);
00051 //  uint8_t slowSPIread();
00052 //  uint8_t fastSPIread();
00053 //  void slowSPIwrite(uint8_t);
00054 //  void fastSPIwrite(uint8_t);
00055 
00056   void command(uint8_t c);
00057   void dataWrite(uint8_t c);
00058   uint8_t dataRead(void);
00059   void setBrightness(uint8_t val);
00060   void invert(bool i);
00061 
00062   void displayOn();
00063   void displayOff();
00064   void clearDisplay(void);
00065 
00066   virtual void drawPixel(int16_t x, int16_t y, uint16_t color);
00067   virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
00068 
00069  private:
00070 //  int8_t _miso, _mosi, _sclk, _dc, _cs;
00071  SPI _spi;
00072  DigitalOut _dc, _cs;
00073  int addrcache,bytecache;
00074 
00075 //  volatile uint8_t *mosiport, *misopin, *clkport, *csport, *dcport;
00076 //  uint8_t mosipinmask, misopinmask, clkpinmask, cspinmask, dcpinmask;
00077 
00078 //  bool hwSPI;
00079 
00080   void spiwrite(uint8_t c);
00081 };
00082 
00083 #endif