I have no idea where I left off. Committing so I don't lose it.

This commit is contained in:
Michael Colton 2018-03-30 00:53:14 -06:00
parent c9e7284a9f
commit 111e907813
6 changed files with 4963 additions and 4958 deletions

File diff suppressed because it is too large Load diff

View file

@ -416,8 +416,12 @@ void Adafruit_ILI9340_pushColor(uint16_t color) {
//uint16_t rxBuf[10];
//uint16_t txBuf[2] = {color >> 8, color};
txBuf[0] = color;
spi_readWrite(SpiHandle, rxBuf, txBuf, 1);
uint8_t txBuf3[2];
txBuf3[1] = color & 0xFF;
txBuf3[0] = color >> 8;
//spi_readWrite(SpiHandle, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&SpiHandle, txBuf3, 2 /*cnt * 2*/, 1);
//while(SpiHandle.State != HAL_SPI_STATE_READY);
//SET_BIT(csport, cspinmask);
@ -444,7 +448,8 @@ void Adafruit_ILI9340_drawPixel(int16_t x, int16_t y, uint16_t color) {
//uint8_t rxBuf[10];
//uint8_t txBuf[2] = {color >> 8, color};
txBuf[0] = color;
spi_readWrite(SpiHandle, rxBuf, txBuf, 1);
//spi_readWrite(SpiHandle, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&SpiHandle, txBuf, 1 /*cnt * 2*/, 1);
//SET_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
@ -467,7 +472,8 @@ void Adafruit_ILI9340_drawNextPixel(uint16_t color) {
//uint8_t rxBuf[10];
//uint8_t txBuf[2] = {color >> 8, color};
txBuf[0] = color;
spi_readWrite(SpiHandle, rxBuf, txBuf, 1);
//spi_readWrite(SpiHandle, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&SpiHandle, txBuf, 1 /*cnt * 2*/, 1);
//SET_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
@ -502,7 +508,8 @@ void Adafruit_ILI9340_drawFastVLine(int16_t x, int16_t y, int16_t h,
//txBuf[0] = hi;
//txBuf[1] = lo;
txBuf[0] = color;
spi_readWrite(SpiHandle, rxBuf, txBuf, 1);
//spi_readWrite(SpiHandle, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&SpiHandle, txBuf, 1 /*cnt * 2*/, 1);
}
//SET_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
@ -532,7 +539,8 @@ void Adafruit_ILI9340_drawFastHLine(int16_t x, int16_t y, int16_t w,
//txBuf[0] = hi;
//txBuf[1] = lo;
txBuf[0] = color;
spi_readWrite(SpiHandle, rxBuf, txBuf, 1);
//spi_readWrite(SpiHandle, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&SpiHandle, txBuf, 1 /*cnt * 2*/, 1);
}
//SET_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);

View file

@ -311,24 +311,6 @@ void configDMA(SPI_HandleTypeDef *hspi)
hdma_tx.Instance = SPIx_TX_DMA_STREAM;
hdma_tx.Init.Channel = SPIx_TX_DMA_CHANNEL;
hdma_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_tx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_tx.Init.MemInc = DMA_MINC_ENABLE;
hdma_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_tx.Init.Mode = DMA_NORMAL;
hdma_tx.Init.Priority = DMA_PRIORITY_LOW;
hdma_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
hdma_tx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
hdma_tx.Init.MemBurst = DMA_MBURST_INC4;
hdma_tx.Init.PeriphBurst = DMA_PBURST_INC4;
HAL_DMA_Init(&hdma_tx);
/* Associate the initialized DMA handle to the the SPI handle */
__HAL_LINKDMA(hspi, hdmatx, hdma_tx);
/* Configure the DMA handler for Transmission process */
hdma_rx.Instance = SPIx_RX_DMA_STREAM;
@ -350,6 +332,27 @@ void configDMA(SPI_HandleTypeDef *hspi)
/* Associate the initialized DMA handle to the the SPI handle */
__HAL_LINKDMA(hspi, hdmarx, hdma_rx);
hdma_tx.Init.Channel = SPIx_TX_DMA_CHANNEL;
hdma_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_tx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_tx.Init.MemInc = DMA_MINC_ENABLE;
hdma_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_tx.Init.Mode = DMA_NORMAL;
hdma_tx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
hdma_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
hdma_tx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
hdma_tx.Init.MemBurst = DMA_MBURST_INC4;
hdma_tx.Init.PeriphBurst = DMA_PBURST_INC4;
HAL_DMA_Init(&hdma_tx);
/* Associate the initialized DMA handle to the the SPI handle */
__HAL_LINKDMA(hspi, hdmatx, hdma_tx);
/*##-4- Configure the NVIC for DMA #########################################*/
/* NVIC configuration for DMA transfer complete interrupt (SPI3_TX) */
HAL_NVIC_SetPriority(15/*SPIx_DMA_TX_IRQn*/, 0, 1);

View file

@ -150,7 +150,7 @@ void spi_readWrite(SPI_HandleTypeDef SpiH, uint16_t* rxBuf, uint16_t* txBuf, uin
//HAL_SPI_TransmitReceive(&SpiHandle, txBuf, rxBuf, cnt, 1000);
//HAL_SPI_Transmit(&SpiHandle, txTmp, 2 /*cnt * 2*/, 1);
//while(HAL_SPI_GetState(&SpiH) != HAL_SPI_STATE_READY);
HAL_SPI_Transmit_DMA(&SpiHandle, txTmp, 2/*cnt*/);
HAL_SPI_Transmit_DMA(&SpiH, txTmp, cnt);
while(SpiHandle.State != HAL_SPI_STATE_READY);
//while(HAL_SPI_GetState(&SpiH) != HAL_SPI_STATE_READY);