Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(MiscDrivers): Refactor TFT SPI transmit for tft_ssd2119. #943

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Libraries/MiscDrivers/Display/tft_ssd2119.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,9 @@ static void spi_transmit(void *datain, unsigned int count)
volatile uint16_t *u16ptrin = (volatile uint16_t *)datain;
unsigned int start = 0;

MXC_SPI_SetFrequency((mxc_spi_regs_t *)spi, tft_spi_freq);
MXC_SPI_SetDataSize((mxc_spi_regs_t *)spi, 9);

// HW requires disabling/renabling SPI block at end of each transaction (when SS is inactive).
spi->ctrl0 &= ~(MXC_F_SPI_CTRL0_EN);

// Setup the slave select
MXC_SETFIELD(spi->ctrl0, MXC_F_SPI_CTRL0_SS_ACTIVE,
((1 << ssel) << MXC_F_SPI_CTRL0_SS_ACTIVE_POS));

// number of RX Char is 0xffff
spi->ctrl1 &= ~(MXC_F_SPI_CTRL1_RX_NUM_CHAR);

Expand Down Expand Up @@ -526,6 +519,10 @@ static void tft_spi_init(void)
MXC_GPIO_SetVSSEL(g_spi_gpio.port, g_spi_gpio.vssel, g_spi_gpio.mask);
MXC_SPI_SetDataSize((mxc_spi_regs_t *)spi, 9);
MXC_SPI_SetWidth((mxc_spi_regs_t *)spi, SPI_WIDTH_STANDARD);
MXC_SPI_SetFrequency((mxc_spi_regs_t *)spi, tft_spi_freq);
// Setup the slave select
MXC_SETFIELD(spi->ctrl0, MXC_F_SPI_CTRL0_SS_ACTIVE,
((1 << ssel) << MXC_F_SPI_CTRL0_SS_ACTIVE_POS));
}

static void displayInit(void)
Expand Down
Loading