qp_st7735.h 2.1 KB

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