123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- #ifndef SED1335_H
- #define SED1335_H
- // value definitions, don't change this
- #define SED1335_SYSTEM_SET 0x40
- #define SED1335_SLEEP_IN 0x53
- #define SED1335_DISP_OFF 0x58
- #define SED1335_DISP_ON 0x59
- #define SED1335_SCROLL 0x44
- #define SED1335_CSRFORM 0x5d
- #define SED1335_CGRAM_ADR 0x5c
- #define SED1335_CSRDIR_U 0x4e
- #define SED1335_CSRDIR_D 0x4f
- #define SED1335_CSRDIR_L 0x4d
- #define SED1335_CSRDIR_R 0x4c
- #define SED1335_HDOT_SCR 0x5a
- #define SED1335_OVLAY 0x5b
- #define SED1335_CSRW 0x46
- #define SED1335_CSRR 0x47
- #define SED1335_MWRITE 0x42
- #define SED1335_MREAD 0x43
- #define SED1335_GRAYSCALE 0x60
- #define SED1335_OFF 0x0
- #define SED1335_ON 0x1
- #define SED1335_FLASH_2HZ 0x2
- #define SED1335_FLASH_16HZ 0x3
- //pin/port definitions
- #define SED1335_DATA_PORT PORTA
- #define SED1335_DATA_DIR DDRA
- #define SED1335_DATA_PIN PINA
- #define SED1335_CONTROL_PORT PORTB
- #define SED1335_CONTROL_DIR DDRB
- #define SED1335_CONTROL_PIN PINB
- #define SED1335_RST_PORT PORTD
- #define SED1335_RST_DIR DDRD
- #define SED1335_A0 (1 << PB0)
- #define SED1335_WR (1 << PB1)
- #undef SED1335_RD
- #undef SED1335_CS
- #define SED1335_RES (1 << PD0)
- //disable interrupts when driving LCD
- #undef SED1335_DISABLE_INT
- // LCD config values
- #define SED1335_M0 0 //character generator select, 0=cgrom, 1=cgram
- #define SED1335_M2 0 //character height, 0=8px, 1=16px
- #define SED1335_WS 0 //panel drive select, 0=single, 1=dual
- #define SED1335_IV 1 //screen origin compensation, 1=shift text down by 1px
- #define SED1335_FX 7 //horizontal size of characters minus one
- #define SED1335_FY 7 //vertical size of characters minus one
- #define SED1335_WF 1 //ac drive waveform period, 0=16-line ac drive, 1=two-frame ac drive
- #define SED1335_CR 59 //character bytes per row minus one
- #define SED1335_TCR 61 //total character bytes per row >= CR+2
- #define SED1335_LF 159 //frame height minus one
- #define SED1335_AP 80 //horizontal address range -----------tu chyba powinno być 60, ale nie działa!
- #define SED1335_CRX 0x04 //cursor width, pixels minus one
- #define SED1335_CRY 0x07 //cursor height, pixels minus one
- #define SED1335_CM 0 //cursor mode, 0=underscore, 1=block
- #define SED1335_MX 0 //layer composition method, 0=or, 1=xor, 2=and
- #define SED1335_DM1 1 //display mode for screen block 3, 0=text, 1=graphic
- #define SED1335_DM0 1 //display mode for screen block 1, 0=text, 1=graphic
- #define SED1335_OV 1 //3 layer overlay select, 0=two layers, 1=three layers
- #define SED1335_SAG 0x7000 //character generator start address
- #define SED1335_SCRD 0 //horizontal pixel scroll
- #define SED1335_FLASH (SED1335_OFF | (SED1335_OFF<<2) | (SED1335_ON<<4) | (SED1335_ON<<6)) //off-on-flash; cursor, sad1, sad2, sad3
- //#define SED1335_TEXTSIZE ((SED1335_SAD2H << 8) + SED1335_SAD2L)
- #define SED1335_BPP 1 //bits per pixel, 0=1, 1=2, 2=4
- #define SED1335_GRAPHICSIZE ((long int)(SED1335_LF+1)*SED1335_AP)
- #define SED1335_SAD1 0x0000 //first display memory page addr
- #define SED1335_SL1 SED1335_LF //size of block screen 1 in lines minus one
- #define SED1335_SAD2 0x0000 //second display memory page addr
- #define SED1335_SL2 SED1335_LF //size of block screen 2 in lines minus one
- #define SED1335_SAD3 (SED1335_SAD2 + SED1335_GRAPHICSIZE) //third display memory page addr
- #define SED1335_SAD4 0x0000 //fourth display memory page addr
- #define SED1335_GRAPHICSTART SED1335_SAD2
- #define SED1335_TGRAPHICSTART SED1335_SAD3 //używane przez gtext.c; jak ustawiłem OV=0 i używałem strony 1 zamiast 3, były dziwne zjawiska przy zapisie do GRAM na zielonych wyświetlaczach
- //#define SED1335_GRAPHICSIZE ((SED1335_SL2+1) * (SED1335_SCR_WIDTH+1))>>3
- //#define SED1335_MEM_END 10800 /// ????
- #define SED1335_SYS_P1 0x00 | (SED1335_IV << 5) | (1 << 4) | (SED1335_WS << 3) | (SED1335_M2 << 2) | SED1335_M0
- #define SED1335_SYS_P2 0x00 | (SED1335_WF << 7) | SED1335_FX
- #define SED1335_CSRF_P2 0x00 | (SED1335_CM << 7) | SED1335_CRY
- #define SED1335_OVLAY_P1 0x00 | (SED1335_OV << 4) | (SED1335_DM0 << 2) | (SED1335_DM1 << 3) | SED1335_MX
- void GLCD_Initialize(void);
- void GLCD_Clear(void);
- void GLCD_WriteCommand(unsigned char);
- void GLCD_WriteData(unsigned char);
- unsigned char GLCD_ReadData(void);
- void GLCD_InitializePorts(void);
- void GLCD_ClearText(void);
- void GLCD_ClearGraphic(void);
- void GLCD_TextGoTo(unsigned char, unsigned char);
- void GLCD_WriteText(char *);
- void GLCD_SetPixel(unsigned int x,unsigned int y, int color);
- void GLCD_SetCursorAddress(unsigned int address);
- void GLCD_GraphicGoTo(unsigned int x, unsigned int y);
- void GLCD_Bitmap(char * bmp, int x, int y, int dx, int dy);
- void GLCD_HardReset(void);
- #endif
|