logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

qp_sh1107.h (2675B)


  1. #pragma once
  2. #include "gpio.h"
  3. #include "qp_internal.h"
  4. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  5. // Quantum Painter SH1107 configurables (add to your keyboard's config.h)
  6. #if defined(QUANTUM_PAINTER_SH1107_SPI_ENABLE) && !defined(SH1107_NUM_SPI_DEVICES)
  7. /**
  8. * @def This controls the maximum number of SPI SH1107 devices that Quantum Painter can communicate with at any one time.
  9. * Increasing this number allows for multiple displays to be used.
  10. */
  11. # define SH1107_NUM_SPI_DEVICES 1
  12. #else
  13. # define SH1107_NUM_SPI_DEVICES 0
  14. #endif
  15. #if defined(QUANTUM_PAINTER_SH1107_I2C_ENABLE) && !defined(SH1107_NUM_I2C_DEVICES)
  16. /**
  17. * @def This controls the maximum number of I2C SH1107 devices that Quantum Painter can communicate with at any one time.
  18. * Increasing this number allows for multiple displays to be used.
  19. */
  20. # define SH1107_NUM_I2C_DEVICES 1
  21. #else
  22. # define SH1107_NUM_I2C_DEVICES 0
  23. #endif
  24. #define SH1107_NUM_DEVICES ((SH1107_NUM_SPI_DEVICES) + (SH1107_NUM_I2C_DEVICES))
  25. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  26. // Quantum Painter SH1107 device factories
  27. #ifdef QUANTUM_PAINTER_SH1107_SPI_ENABLE
  28. /**
  29. * Factory method for an SH1107 SPI LCD device.
  30. *
  31. * @param panel_width[in] the width of the display in pixels (usually 64)
  32. * @param panel_height[in] the height of the display in pixels (usually 128)
  33. * @param chip_select_pin[in] the GPIO pin used for SPI chip select
  34. * @param dc_pin[in] the GPIO pin used for D/C control
  35. * @param reset_pin[in] the GPIO pin used for RST
  36. * @param spi_divisor[in] the SPI divisor to use when communicating with the display
  37. * @param spi_mode[in] the SPI mode to use when communicating with the display
  38. * @return the device handle used with all drawing routines in Quantum Painter
  39. */
  40. painter_device_t qp_sh1107_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
  41. #endif // QUANTUM_PAINTER_SH1107_SPI_ENABLE
  42. #ifdef QUANTUM_PAINTER_SH1107_I2C_ENABLE
  43. /**
  44. * Factory method for an SH1107 I2C LCD device.
  45. *
  46. * @param panel_width[in] the width of the display in pixels (usually 64)
  47. * @param panel_height[in] the height of the display in pixels (usually 128)
  48. * @param i2c_address[in] the I2C address to use
  49. * @return the device handle used with all drawing routines in Quantum Painter
  50. */
  51. painter_device_t qp_sh1107_make_i2c_device(uint16_t panel_width, uint16_t panel_height, uint8_t i2c_address);
  52. #endif // QUANTUM_PAINTER_SH1107_I2C_ENABLE