display.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Motenpoche
  2. *
  3. * (c) 2023 Daniele Lacamera <root@danielinux.net>
  4. *
  5. *
  6. * Motenpoche is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Motenpoche is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  19. *
  20. */
  21. #ifndef DISPLAY_H_INCLUDED
  22. #define DISPLAY_H_INCLUDED
  23. #include <stdint.h>
  24. #define WIDTH 128
  25. #define PIXEL_HEIGHT 64
  26. #define HEIGHT (PIXEL_HEIGHT / 8)
  27. extern const unsigned char fb_font[256][8];
  28. #define SSD1306_MEMORYMODE 0x20
  29. #define SSD1306_COLUMNADDR 0x21
  30. #define SSD1306_PAGEADDR 0x22
  31. #define SSD1306_SETCONTRAST 0x81
  32. #define SSD1306_CHARGEPUMP 0x8D
  33. #define SSD1306_SEGREMAP 0xA0
  34. #define SSD1306_DISPLAYALLON_RESUME 0xA4
  35. #define SSD1306_DISPLAYALLON 0xA5
  36. #define SSD1306_NORMALDISPLAY 0xA6
  37. #define SSD1306_INVERTDISPLAY 0xA7
  38. #define SSD1306_SETMULTIPLEX 0xA8
  39. #define SSD1306_DISPLAYOFF 0xAE
  40. #define SSD1306_DISPLAYON 0xAF
  41. #define SSD1306_COMSCANINC 0xC0
  42. #define SSD1306_COMSCANDEC 0xC8
  43. #define SSD1306_SETDISPLAYOFFSET 0xD3
  44. #define SSD1306_SETDISPLAYCLOCKDIV 0xD5
  45. #define SSD1306_SETPRECHARGE 0xD9
  46. #define SSD1306_SETCOMPINS 0xDA
  47. #define SSD1306_SETVCOMDETECT 0xDB
  48. #define SSD1306_SETLOWCOLUMN 0x00
  49. #define SSD1306_SETHIGHCOLUMN 0x10
  50. #define SSD1306_SETSTARTLINE 0x40
  51. #define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26
  52. #define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27
  53. #define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29
  54. #define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A
  55. #define SSD1306_DEACTIVATE_SCROLL 0x2E
  56. #define SSD1306_ACTIVATE_SCROLL 0x2F
  57. #define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3
  58. int display_init(void *priv);
  59. void display_text(int row, const char *text);
  60. void display_text_inverse(int row, int col, const char *text);
  61. void display_scroll(uint8_t line);
  62. void display_setcontrast(uint8_t c);
  63. uint8_t display_getcontrast();
  64. void display_clear();
  65. #endif