sed1335.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef SED1335_H
  2. #define SED1335_H
  3. // value definitions, don't change this
  4. #define SED1335_SYSTEM_SET 0x40
  5. #define SED1335_SLEEP_IN 0x53
  6. #define SED1335_DISP_OFF 0x58
  7. #define SED1335_DISP_ON 0x59
  8. #define SED1335_SCROLL 0x44
  9. #define SED1335_CSRFORM 0x5d
  10. #define SED1335_CGRAM_ADR 0x5c
  11. #define SED1335_CSRDIR_U 0x4e
  12. #define SED1335_CSRDIR_D 0x4f
  13. #define SED1335_CSRDIR_L 0x4d
  14. #define SED1335_CSRDIR_R 0x4c
  15. #define SED1335_HDOT_SCR 0x5a
  16. #define SED1335_OVLAY 0x5b
  17. #define SED1335_CSRW 0x46
  18. #define SED1335_CSRR 0x47
  19. #define SED1335_MWRITE 0x42
  20. #define SED1335_MREAD 0x43
  21. #define SED1335_GRAYSCALE 0x60
  22. #define SED1335_OFF 0x0
  23. #define SED1335_ON 0x1
  24. #define SED1335_FLASH_2HZ 0x2
  25. #define SED1335_FLASH_16HZ 0x3
  26. //pin/port definitions
  27. #define SED1335_DATA_PORT PORTA
  28. #define SED1335_DATA_DIR DDRA
  29. #define SED1335_DATA_PIN PINA
  30. #define SED1335_CONTROL_PORT PORTB
  31. #define SED1335_CONTROL_DIR DDRB
  32. #define SED1335_CONTROL_PIN PINB
  33. #define SED1335_RST_PORT PORTD
  34. #define SED1335_RST_DIR DDRD
  35. #define SED1335_A0 (1 << PB0)
  36. #define SED1335_WR (1 << PB1)
  37. #undef SED1335_RD
  38. #undef SED1335_CS
  39. #define SED1335_RES (1 << PD0)
  40. //disable interrupts when driving LCD
  41. #undef SED1335_DISABLE_INT
  42. // LCD config values
  43. #define SED1335_M0 0 //character generator select, 0=cgrom, 1=cgram
  44. #define SED1335_M2 0 //character height, 0=8px, 1=16px
  45. #define SED1335_WS 0 //panel drive select, 0=single, 1=dual
  46. #define SED1335_IV 1 //screen origin compensation, 1=shift text down by 1px
  47. #define SED1335_FX 7 //horizontal size of characters minus one
  48. #define SED1335_FY 7 //vertical size of characters minus one
  49. #define SED1335_WF 1 //ac drive waveform period, 0=16-line ac drive, 1=two-frame ac drive
  50. #define SED1335_CR 59 //character bytes per row minus one
  51. #define SED1335_TCR 61 //total character bytes per row >= CR+2
  52. #define SED1335_LF 159 //frame height minus one
  53. #define SED1335_AP 80 //horizontal address range -----------tu chyba powinno być 60, ale nie działa!
  54. #define SED1335_CRX 0x04 //cursor width, pixels minus one
  55. #define SED1335_CRY 0x07 //cursor height, pixels minus one
  56. #define SED1335_CM 0 //cursor mode, 0=underscore, 1=block
  57. #define SED1335_MX 0 //layer composition method, 0=or, 1=xor, 2=and
  58. #define SED1335_DM1 1 //display mode for screen block 3, 0=text, 1=graphic
  59. #define SED1335_DM0 1 //display mode for screen block 1, 0=text, 1=graphic
  60. #define SED1335_OV 1 //3 layer overlay select, 0=two layers, 1=three layers
  61. #define SED1335_SAG 0x7000 //character generator start address
  62. #define SED1335_SCRD 0 //horizontal pixel scroll
  63. #define SED1335_FLASH (SED1335_OFF | (SED1335_OFF<<2) | (SED1335_ON<<4) | (SED1335_ON<<6)) //off-on-flash; cursor, sad1, sad2, sad3
  64. //#define SED1335_TEXTSIZE ((SED1335_SAD2H << 8) + SED1335_SAD2L)
  65. #define SED1335_BPP 1 //bits per pixel, 0=1, 1=2, 2=4
  66. #define SED1335_GRAPHICSIZE ((long int)(SED1335_LF+1)*SED1335_AP)
  67. #define SED1335_SAD1 0x0000 //first display memory page addr
  68. #define SED1335_SL1 SED1335_LF //size of block screen 1 in lines minus one
  69. #define SED1335_SAD2 0x0000 //second display memory page addr
  70. #define SED1335_SL2 SED1335_LF //size of block screen 2 in lines minus one
  71. #define SED1335_SAD3 (SED1335_SAD2 + SED1335_GRAPHICSIZE) //third display memory page addr
  72. #define SED1335_SAD4 0x0000 //fourth display memory page addr
  73. #define SED1335_GRAPHICSTART SED1335_SAD2
  74. #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
  75. //#define SED1335_GRAPHICSIZE ((SED1335_SL2+1) * (SED1335_SCR_WIDTH+1))>>3
  76. //#define SED1335_MEM_END 10800 /// ????
  77. #define SED1335_SYS_P1 0x00 | (SED1335_IV << 5) | (1 << 4) | (SED1335_WS << 3) | (SED1335_M2 << 2) | SED1335_M0
  78. #define SED1335_SYS_P2 0x00 | (SED1335_WF << 7) | SED1335_FX
  79. #define SED1335_CSRF_P2 0x00 | (SED1335_CM << 7) | SED1335_CRY
  80. #define SED1335_OVLAY_P1 0x00 | (SED1335_OV << 4) | (SED1335_DM0 << 2) | (SED1335_DM1 << 3) | SED1335_MX
  81. void GLCD_Initialize(void);
  82. void GLCD_Clear(void);
  83. void GLCD_WriteCommand(unsigned char);
  84. void GLCD_WriteData(unsigned char);
  85. unsigned char GLCD_ReadData(void);
  86. void GLCD_InitializePorts(void);
  87. void GLCD_ClearText(void);
  88. void GLCD_ClearGraphic(void);
  89. void GLCD_TextGoTo(unsigned char, unsigned char);
  90. void GLCD_WriteText(char *);
  91. void GLCD_SetPixel(unsigned int x,unsigned int y, int color);
  92. void GLCD_SetCursorAddress(unsigned int address);
  93. void GLCD_GraphicGoTo(unsigned int x, unsigned int y);
  94. void GLCD_Bitmap(char * bmp, int x, int y, int dx, int dy);
  95. void GLCD_HardReset(void);
  96. #endif