qp_st7789.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2021 Paul Cotter (@gr1mr3aver)
  2. // Copyright 2021 Nick Brassel (@tzarc)
  3. // SPDX-License-Identifier: GPL-2.0-or-later
  4. #pragma once
  5. #include "gpio.h"
  6. #include "qp_internal.h"
  7. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  8. // Quantum Painter ST7789 configurables (add to your keyboard's config.h)
  9. #ifndef ST7789_NUM_DEVICES
  10. /**
  11. * @def This controls the maximum number of ST7789 devices that Quantum Painter can communicate with at any one time.
  12. * Increasing this number allows for multiple displays to be used.
  13. */
  14. # define ST7789_NUM_DEVICES 1
  15. #endif
  16. // Additional configuration options to be copied to your keyboard's config.h (don't change here):
  17. // If you know exactly which offsets should be used on your panel with respect to selected rotation, then this config
  18. // option allows you to save some flash space -- you'll need to invoke qp_set_viewport_offsets() instead from your keyboard.
  19. // #define ST7789_NO_AUTOMATIC_VIEWPORT_OFFSETS
  20. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  21. // Quantum Painter ST7789 device factories
  22. #ifdef QUANTUM_PAINTER_ST7789_SPI_ENABLE
  23. /**
  24. * Factory method for an ST7789 SPI LCD device.
  25. *
  26. * @param panel_width[in] the width of the display panel
  27. * @param panel_height[in] the height of the display panel
  28. * @param chip_select_pin[in] the GPIO pin used for SPI chip select
  29. * @param dc_pin[in] the GPIO pin used for D/C control
  30. * @param reset_pin[in] the GPIO pin used for RST
  31. * @param spi_divisor[in] the SPI divisor to use when communicating with the display
  32. * @param spi_mode[in] the SPI mode to use when communicating with the display
  33. * @return the device handle used with all drawing routines in Quantum Painter
  34. */
  35. painter_device_t qp_st7789_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);
  36. #endif // QUANTUM_PAINTER_ST7789_SPI_ENABLE