Floyd-Fish / ST7789-STM32

using STM32's Hardware SPI to drive a ST7789 based IPS displayer
GNU General Public License v3.0
276 stars 55 forks source link

additional configuration for no chip select case. #13

Closed legath closed 2 years ago

legath commented 3 years ago

for aliexpress displays.

deividAlfa commented 2 years ago

define ST7789_Select() asm("nop")

define ST7789_UnSelect() asm("nop")

You can just leave it blank, no asm("nop") is needed.

Also instead the //#define CFG_NO_CS, you can make it simpler:

// For displays without CS pin, comment next 2 lines:

define ST7789_CS_PORT ST7789_CS_GPIO_Port

define ST7789_CS_PIN ST7789_CS_Pin

Then:

if defined ST7789_CS_PORT && defined ST7789_CS_PORT

define ST7789_Select() HAL_GPIO_WritePin(ST7789_CS_PORT, ST7789_CS_PIN, GPIO_PIN_RESET)

define ST7789_UnSelect() HAL_GPIO_WritePin(ST7789_CS_PORT, ST7789_CS_PIN, GPIO_PIN_SET)

else

define ST7789_Select()

define ST7789_UnSelect()

endif