I have no idea where I left off. Committing so I don't lose it.
This commit is contained in:
parent
c9e7284a9f
commit
111e907813
6 changed files with 4963 additions and 4958 deletions
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -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);
|
||||
|
|
|
@ -311,6 +311,28 @@ void configDMA(SPI_HandleTypeDef *hspi)
|
|||
|
||||
hdma_tx.Instance = SPIx_TX_DMA_STREAM;
|
||||
|
||||
/* Configure the DMA handler for Transmission process */
|
||||
hdma_rx.Instance = SPIx_RX_DMA_STREAM;
|
||||
|
||||
hdma_rx.Init.Channel = SPIx_RX_DMA_CHANNEL;
|
||||
hdma_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_rx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_rx.Init.Mode = DMA_NORMAL;
|
||||
hdma_rx.Init.Priority = DMA_PRIORITY_HIGH;
|
||||
hdma_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||
hdma_rx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
|
||||
hdma_rx.Init.MemBurst = DMA_MBURST_INC4;
|
||||
hdma_rx.Init.PeriphBurst = DMA_PBURST_INC4;
|
||||
|
||||
HAL_DMA_Init(&hdma_rx);
|
||||
|
||||
/* 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;
|
||||
|
@ -318,7 +340,7 @@ void configDMA(SPI_HandleTypeDef *hspi)
|
|||
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.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;
|
||||
|
@ -329,26 +351,7 @@ void configDMA(SPI_HandleTypeDef *hspi)
|
|||
/* 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;
|
||||
|
||||
hdma_rx.Init.Channel = SPIx_RX_DMA_CHANNEL;
|
||||
hdma_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_rx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_rx.Init.Mode = DMA_NORMAL;
|
||||
hdma_rx.Init.Priority = DMA_PRIORITY_HIGH;
|
||||
hdma_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||
hdma_rx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
|
||||
hdma_rx.Init.MemBurst = DMA_MBURST_INC4;
|
||||
hdma_rx.Init.PeriphBurst = DMA_PBURST_INC4;
|
||||
|
||||
HAL_DMA_Init(&hdma_rx);
|
||||
|
||||
/* Associate the initialized DMA handle to the the SPI handle */
|
||||
__HAL_LINKDMA(hspi, hdmarx, hdma_rx);
|
||||
|
||||
/*##-4- Configure the NVIC for DMA #########################################*/
|
||||
/* NVIC configuration for DMA transfer complete interrupt (SPI3_TX) */
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue