Capture working with DMA, waterfall still hangs

tinySA
erikkaashoek 6 years ago
parent 9c129b1310
commit 4ffb6072b7

@ -384,39 +384,6 @@ void ili9341_bulk(int x, int y, int w, int h)
}
}
#else
static uint8_t ssp_sendrecvdata(void)
{
// Start RX clock (by sending data)
SPI_WRITE_8BIT(0);
while (SPI_RX_IS_EMPTY && SPI_IS_BUSY)
;
return SPI_READ_DATA;
}
void ili9341_read_memory(int x, int y, int w, int h, int len, uint16_t *out)
{
// uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
// uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
uint32_t xx = __REV16(x | ((x + w - 1) << 16));
uint32_t yy = __REV16(y | ((y + h - 1) << 16));
send_command(ILI9341_COLUMN_ADDRESS_SET, 4, (uint8_t *)&xx);
send_command(ILI9341_PAGE_ADDRESS_SET, 4, (uint8_t*)&yy);
send_command(ILI9341_MEMORY_READ, 0, NULL);
// Skip data from rx buffer
while (SPI_RX_IS_NOT_EMPTY)
(void) SPI_READ_DATA;
// require 8bit dummy clock
ssp_sendrecvdata();
while (len-- > 0) {
// read data is always 18bit
uint8_t r = ssp_sendrecvdata();
uint8_t g = ssp_sendrecvdata();
uint8_t b = ssp_sendrecvdata();
*out++ = RGB565(r, g, b);
}
CS_HIGH;
}
//
// Use DMA for send data
@ -469,7 +436,7 @@ void ili9341_bulk(int x, int y, int w, int h)
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_MINC);
dmaStreamFlush(w * h);
}
#if 0 // Read DMA hangs
#if 1 // Read DMA hangs
// Copy screen data to buffer
// Warning!!! buffer size must be greater then 3*len + 1 bytes
void ili9341_read_memory(int x, int y, int w, int h, int len, uint16_t *out)
@ -515,6 +482,41 @@ void ili9341_read_memory(int x, int y, int w, int h, int len, uint16_t *out)
rgbbuf += 3;
}
}
#else
static uint8_t ssp_sendrecvdata(void)
{
// Start RX clock (by sending data)
SPI_WRITE_8BIT(0);
while (SPI_RX_IS_EMPTY && SPI_IS_BUSY)
;
return SPI_READ_DATA;
}
void ili9341_read_memory(int x, int y, int w, int h, int len, uint16_t *out)
{
// uint8_t xx[4] = { x >> 8, x, (x+w-1) >> 8, (x+w-1) };
// uint8_t yy[4] = { y >> 8, y, (y+h-1) >> 8, (y+h-1) };
uint32_t xx = __REV16(x | ((x + w - 1) << 16));
uint32_t yy = __REV16(y | ((y + h - 1) << 16));
send_command(ILI9341_COLUMN_ADDRESS_SET, 4, (uint8_t *)&xx);
send_command(ILI9341_PAGE_ADDRESS_SET, 4, (uint8_t*)&yy);
send_command(ILI9341_MEMORY_READ, 0, NULL);
// Skip data from rx buffer
while (SPI_RX_IS_NOT_EMPTY)
(void) SPI_READ_DATA;
// require 8bit dummy clock
ssp_sendrecvdata();
while (len-- > 0) {
// read data is always 18bit
uint8_t r = ssp_sendrecvdata();
uint8_t g = ssp_sendrecvdata();
uint8_t b = ssp_sendrecvdata();
*out++ = RGB565(r, g, b);
}
CS_HIGH;
}
#endif
#endif

@ -1461,8 +1461,8 @@ draw_menu_buttons(const menuitem_t *menu)
ili9341_set_foreground(fg);
ili9341_set_background(bg);
if (menu[i].type & MT_FORM) {
ili9341_fill(320-active_button_width+3, y+8, active_button_width-6, 2+FONT_GET_HEIGHT*2+2, bg);
ili9341_drawstring_size(text, 320-active_button_width+5, y+10, 2);
ili9341_fill(320-active_button_width+3, y+6, active_button_width-6, 2+FONT_GET_HEIGHT*2+2, bg);
ili9341_drawstring_size(text, 320-active_button_width+5, y+8, 2);
} else {
if (menu_is_multiline(menu[i].label, &l1, &l2)) {
ili9341_fill(320-active_button_width+3, y+5, active_button_width-6, 2+FONT_GET_HEIGHT+1+FONT_GET_HEIGHT+2, bg);

Loading…
Cancel
Save

Powered by TurnKey Linux.