E-Paper Device (EPD) based MiniNote module, powered by mbed on LPC1114FBD48. Shared in public domain with enclosure in 3D step format, hardware interface compatible with microBUS interface. Anyone can contribute on this project.

Dependencies:   mbed _24LCXXX

E-Badge MiniNote Project on mbed/NXP LPC1114 platform

SSD1606/ssd1606.h

Committer:
allankliu
Date:
2014-06-09
Revision:
2:bb9f154ea2f4
Parent:
0:33994cfad0c2
Child:
3:1fa000d4da94

File content as of revision 2:bb9f154ea2f4:

#ifndef __SSD1606_H__
#define __SSD1606_H__

#include "mbed.h"
#define MODE1

#define IRAM_8KB            0
#define BPP_2bit            1

#define INT_FB_3K           0
#define INT_FB_1K           0
#define EXT_FB_3K           1

/*
    The width/height parameters depend on different vendor. The max is 180x128
    http://www.solomon-systech.com.cn/cn/product/advanced-display/bistable-display-driver-controller/
 */
#define SSD1606_LCDWIDTH 172
#define SSD1606_LCDHEIGHT 72
#define SSD1606_GREYLEVEL   2

#define FRAMEBUF_SIZE_1bpp      (SSD1606_LCDWIDTH * SSD1606_LCDHEIGHT / 8)
#define FRAMEBUF_SIZE_2bpp      (SSD1606_LCDWIDTH * SSD1606_LCDHEIGHT * SSD1606_GREYLEVEL / 8)

#define FRAMEBUF_SIZE       FRAMEBUF_SIZE_1bpp

#define PIC_ONE                 1
#define PIC_NOKIA               2
#define PIC_SUNING          3
#define PIC_SHOUSI          4
#define PIC_BAZHE           5
#define PIC_CHESSBOARD  6
#define PIC_JIFEN               7
#define PIC_FU                  8
#define PIC_GC4                 9
#define PIC_SAVE                10
#define PIC_GL1                 20
#define PIC_GL2                 21
#define PIC_BLACK               22
#define PIC_WHITE               23

#define TEST_GREY1          1
#define TEST_GREY2          2
#define TEST_BLK                3
#define TEST_WHT                4
#define TEST_HALF               5
#define TEST_STRIP1         6
#define TEST_STRIP2         7

#define SPI_BUS_DELAY       10

class SSD1606
{
    public:
        SSD1606(PinName cs, PinName rst, PinName dc, PinName busy, PinName data, PinName clk);
        void reset();
        void initialize();
        void update();
        void off();
        void on();
        void deepsleep();
        void sleep();
        void wake();
        void set_inverse();
        void set_lut();
        void set_command_between_images();
        void set_display_start_line(unsigned char val);
        void nop();
        void set_charge_pump_enable(unsigned char enable);
        void clear();
        void set_pixel(int x, int y);
        void clear_pixel(int x, int y);
        void set_font(unsigned char *font, unsigned char width);
        void set_double_height_text(unsigned int double_height);
        void putc(unsigned char c);
        void printf(const char *format,...);
        void read_busy(void);
        void rom_image(const unsigned char *bitmap);
        void test_image(unsigned char idx);
        
    private:
        //SPI &_mspi;   //Software SPI used
        DigitalOut _cs, _reset, _dc;        
        DigitalIn _busy;
        DigitalOut _data, _clk;
        //unsigned char _screen[3096];
        unsigned char _screen[1548];
        //unsigned char _buf[128];
    int _cursor_x, _cursor_y;

    void _send_command(unsigned char code);
    void _send_data(unsigned char value);
        void _vspi_write(unsigned char value);
        void _draw_pattern(unsigned char value, unsigned int pix);
    
    unsigned char *_console_font_data;  
    unsigned int _console_font_width;
    unsigned int _double_height_text;   
};


#endif