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