mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
boards/arm/stm32/stm32f429i-disco/src/stm32_ili93414ws.c: Appease nxstyle
This commit is contained in:
committed by
Xiang Xiao
parent
7b31315879
commit
048e1aab9c
@@ -109,8 +109,7 @@
|
||||
# define ILI93414WS_BAUD_DIVISOR 256
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Permitted clock delay for a pixel transmission from the LCD gram.
|
||||
/* Permitted clock delay for a pixel transmission from the LCD gram.
|
||||
* Calculated by cpu clock / (spi clock / baud divisor)
|
||||
*/
|
||||
|
||||
@@ -126,9 +125,10 @@
|
||||
#define ILI93414WS_SPI_SR (ILI93414WS_SPI_BASE + STM32_SPI_SR_OFFSET)
|
||||
#define ILI93414WS_SPI_DR (ILI93414WS_SPI_BASE + STM32_SPI_DR_OFFSET)
|
||||
|
||||
/* Activates the usage of the spi interface structure if several active devices
|
||||
* connected on the SPI5 bus, e.g. LCD Display, MEMS. This will perform locking
|
||||
* of the spi bus by SPI_LOCK at each selection of the SPI5 device.
|
||||
/* Activates the usage of the spi interface structure if several active
|
||||
* devices connected on the SPI5 bus, e.g. LCD Display, MEMS. This will
|
||||
* perform locking of the spi bus by SPI_LOCK at each selection of the SPI5
|
||||
* device.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_STM32_SPI5
|
||||
@@ -482,12 +482,11 @@ static int stm32_ili93414ws_sendblock(FAR struct ili93414ws_lcd_s *lcd,
|
||||
word = *src++;
|
||||
stm32_ili93414ws_sndword((uint16_t)word);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Wait until transmit is not busy after the last word is transmitted, marked
|
||||
* by the BSY flag in the cr1 register. This is necessary if entering in halt
|
||||
* mode or disable the spi periphery.
|
||||
/* Wait until transmit is not busy after the last word is transmitted,
|
||||
* marked by the BSY flag in the cr1 register. This is necessary if
|
||||
* entering in halt mode or disable the spi periphery.
|
||||
*/
|
||||
|
||||
while ((getreg16(ILI93414WS_SPI_SR) & SPI_SR_BSY) != 0);
|
||||
@@ -526,9 +525,9 @@ static uint16_t stm32_ili93414ws_recvword(void)
|
||||
* immediately after enabling it. If the pixel data stream is interrupted
|
||||
* during receiving, a synchronized transfer can not ensure. Especially on
|
||||
* higher frequency it can happen that the interrupted driver isn't fast
|
||||
* enough to stop transmitting by disabling the spi device. So pixels lost but
|
||||
* not recognized by the driver. This results in a big lock because the driver
|
||||
* wants to receive missing pixel data.
|
||||
* enough to stop transmitting by disabling the spi device. So pixels lost
|
||||
* but not recognized by the driver. This results in a big lock because
|
||||
* the driver wants to receive missing pixel data.
|
||||
* The critical section here ensures that the spi device is disabled fast
|
||||
* enough during a pixel is transmitted.
|
||||
*/
|
||||
@@ -541,9 +540,10 @@ static uint16_t stm32_ili93414ws_recvword(void)
|
||||
|
||||
/* Enable spi device followed by disable the spi device.
|
||||
*
|
||||
* Ensure that the spi is disabled within 8 or 16 spi clock cycles depending
|
||||
* on the configured spi bit mode. This is necessary to prevent that the next
|
||||
* data word is transmitted by the slave before the RX buffer is cleared.
|
||||
* Ensure that the spi is disabled within 8 or 16 spi clock cycles
|
||||
* depending on the configured spi bit mode. This is necessary to prevent
|
||||
* that the next data word is transmitted by the slave before the RX
|
||||
* buffer is cleared.
|
||||
* Otherwise the RX buffer will be overwritten.
|
||||
*
|
||||
* Physically the spi clock is disabled after the current 8/16 clock cycles
|
||||
@@ -562,12 +562,13 @@ static uint16_t stm32_ili93414ws_recvword(void)
|
||||
|
||||
leave_critical_section(flags);
|
||||
|
||||
/* Waits until the RX buffer is filled with the received data word signalized
|
||||
* by the spi hardware through the RXNE flag.
|
||||
/* Waits until the RX buffer is filled with the received data word
|
||||
* signalized by the spi hardware through the RXNE flag.
|
||||
* A busy loop is preferred against interrupt driven receiving method here
|
||||
* because this happened fairly often. Also we have to ensure to avoid a big
|
||||
* lock if the lcd driver doesn't send data anymore.
|
||||
* A latency of CPU clock / SPI clock * 16 SPI clocks should be enough here.
|
||||
* because this happened fairly often. Also we have to ensure to avoid a
|
||||
* big lock if the lcd driver doesn't send data anymore.
|
||||
* A latency of CPU clock / SPI clock * 16 SPI clocks should be enough
|
||||
* here.
|
||||
*/
|
||||
|
||||
for (n = 0; n < ILI93414WS_RECV_CLK * 16; n++)
|
||||
@@ -634,9 +635,11 @@ static int stm32_ili93414ws_recvblock(FAR struct ili93414ws_lcd_s *lcd,
|
||||
/* Discard the first 8 bit dummy */
|
||||
|
||||
/* 00000000 RRRRRR00 */
|
||||
|
||||
w1 = stm32_ili93414ws_recvword();
|
||||
|
||||
/* GGGGGG00 BBBBBB00 */
|
||||
|
||||
w2 = stm32_ili93414ws_recvword();
|
||||
|
||||
*dest++ = (((w1 << 8) & 0xf800) |
|
||||
@@ -696,7 +699,10 @@ static int stm32_ili93414ws_recvblock(FAR struct ili93414ws_lcd_s *lcd,
|
||||
|
||||
while (nwords--)
|
||||
{
|
||||
uint8_t r, g, b;
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
|
||||
r = (uint8_t)(stm32_ili93414ws_recvword() >> 3);
|
||||
g = (uint8_t)(stm32_ili93414ws_recvword() >> 2);
|
||||
b = (uint8_t)(stm32_ili93414ws_recvword() >> 3);
|
||||
@@ -804,7 +810,6 @@ static void stm32_ili93414ws_spiconfig(FAR struct ili9341_lcd_s *lcd)
|
||||
|
||||
uint16_t setbitscr2 = 0;
|
||||
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Disable spi */
|
||||
@@ -817,8 +822,8 @@ static void stm32_ili93414ws_spiconfig(FAR struct ili9341_lcd_s *lcd)
|
||||
|
||||
#ifdef ILI93414WS_SPI
|
||||
/* Backup cr1 and cr2 register to be sure they will be usable
|
||||
* by default spi interface. Disable spi device here is necessary at the time
|
||||
* restoring the register during deselection.
|
||||
* by default spi interface. Disable spi device here is necessary at the
|
||||
* time restoring the register during deselection.
|
||||
*/
|
||||
|
||||
priv->cr2 = getreg16(ILI93414WS_SPI_CR2);
|
||||
@@ -887,7 +892,8 @@ static inline void stm32_ili93414ws_cmddata(
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int stm32_ili93414ws_backlight(FAR struct ili9341_lcd_s *lcd, int level)
|
||||
static int stm32_ili93414ws_backlight(FAR struct ili9341_lcd_s *lcd,
|
||||
int level)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
@@ -1147,8 +1153,8 @@ static int stm32_ili93414ws_recvgram(FAR struct ili9341_lcd_s *lcd,
|
||||
*
|
||||
* Returned Value:
|
||||
* On success, this function returns a reference to the LCD control object
|
||||
* for the specified ILI9341 LCD Single chip driver connected as 4 wire serial
|
||||
* (spi). NULL is returned on any failure.
|
||||
* for the specified ILI9341 LCD Single chip driver connected as 4 wire
|
||||
* serial (spi). NULL is returned on any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -1217,7 +1223,6 @@ FAR struct ili9341_lcd_s *stm32_ili93414ws_initialize(void)
|
||||
priv->dev.recvgram = stm32_ili93414ws_recvgram;
|
||||
priv->dev.backlight = stm32_ili93414ws_backlight;
|
||||
|
||||
|
||||
/* Configure to bidirectional transfer mode */
|
||||
|
||||
lcdinfo("Configure spi device %d to bidirectional transfer mode\n",
|
||||
|
||||
Reference in New Issue
Block a user