ssd1306.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # MicroPython SSD1306 OLED driver, I2C and SPI interfaces
  2. from micropython import const
  3. import time
  4. import framebuf
  5. # register definitions
  6. SET_CONTRAST = const(0x81)
  7. SET_ENTIRE_ON = const(0xa4)
  8. SET_NORM_INV = const(0xa6)
  9. SET_DISP = const(0xae)
  10. SET_MEM_ADDR = const(0x20)
  11. SET_COL_ADDR = const(0x21)
  12. SET_PAGE_ADDR = const(0x22)
  13. SET_DISP_START_LINE = const(0x40)
  14. SET_SEG_REMAP = const(0xa0)
  15. SET_MUX_RATIO = const(0xa8)
  16. SET_COM_OUT_DIR = const(0xc0)
  17. SET_DISP_OFFSET = const(0xd3)
  18. SET_COM_PIN_CFG = const(0xda)
  19. SET_DISP_CLK_DIV = const(0xd5)
  20. SET_PRECHARGE = const(0xd9)
  21. SET_VCOM_DESEL = const(0xdb)
  22. SET_CHARGE_PUMP = const(0x8d)
  23. class SSD1306:
  24. def __init__(self, width, height, external_vcc):
  25. pass
  26. def init_display(self):
  27. pass
  28. def poweroff(self):
  29. pass
  30. def contrast(self, contrast):
  31. pass
  32. def invert(self, invert):
  33. pass
  34. def show(self):
  35. pass
  36. def fill(self, col):
  37. pass
  38. def pixel(self, x, y, col):
  39. pass
  40. def scroll(self, dx, dy):
  41. pass
  42. def text(self, string, x, y, col=1):
  43. pass
  44. class SSD1306_I2C(SSD1306):
  45. def __init__(self, width, height, i2c, addr=0x3c, external_vcc=False):
  46. pass
  47. def write_cmd(self, cmd):
  48. pass
  49. def write_data(self, buf):
  50. pass
  51. def poweron(self):
  52. pass
  53. class SSD1306_SPI(SSD1306):
  54. def __init__(self, width, height, spi, dc, res, cs, external_vcc=False):
  55. pass
  56. def write_cmd(self, cmd):
  57. pass
  58. def write_data(self, buf):
  59. pass
  60. def poweron(self):
  61. pass