add KPU and mobilenet demo, fix LCD bug

This commit is contained in:
Neucrack
2019-04-01 18:41:25 +08:00
parent eb16336cae
commit c19cb56c1a
17 changed files with 1535 additions and 10 deletions

View File

@@ -174,7 +174,7 @@ void lcd_set_area(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
void lcd_draw_point(uint16_t x, uint16_t y, uint16_t color)
{
lcd_set_area(x, y, x, y);
tft_write_byte((uint8_t*)&color, 2);
tft_write_half(&color, 1);
}
void lcd_clear(uint16_t color)
@@ -204,13 +204,13 @@ void lcd_draw_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint
*p++ = data;
lcd_set_area(x1, y1, x2, y1 + width - 1);
tft_write_byte((uint8_t*)data_buf, ((x2 - x1 + 1) * width + 1) * 2);
tft_write_word(data_buf, ((x2 - x1 + 1) * width + 1) / 2);
lcd_set_area(x1, y2 - width + 1, x2, y2);
tft_write_byte((uint8_t*)data_buf, ((x2 - x1 + 1) * width + 1) * 2);
tft_write_word(data_buf, ((x2 - x1 + 1) * width + 1) / 2);
lcd_set_area(x1, y1, x1 + width - 1, y2);
tft_write_byte((uint8_t*)data_buf, ((y2 - y1 + 1) * width + 1) * 2);
tft_write_word(data_buf, ((y2 - y1 + 1) * width + 1) / 2);
lcd_set_area(x2 - width + 1, y1, x2, y2);
tft_write_byte((uint8_t*)data_buf, ((y2 - y1 + 1) * width + 1) * 2);
tft_write_word(data_buf, ((y2 - y1 + 1) * width + 1) / 2);
}
#define SWAP_16(x) ((x >> 8 & 0xff) | (x << 8))

View File

@@ -73,7 +73,7 @@ void tft_write_byte(uint8_t *data_buf, uint32_t length)
{
set_dcx_data();
spi_init(g_spi_num, SPI_WORK_MODE_0, SPI_FF_OCTAL, 8, 0);
spi_init_non_standard(g_spi_num, 0 /*instrction length*/, 8 /*address length*/, 0 /*wait cycles*/,
spi_init_non_standard(g_spi_num, 8 /*instrction length*/, 0 /*address length*/, 0 /*wait cycles*/,
SPI_AITM_AS_FRAME_FORMAT /*spi address trans mode*/);
spi_send_data_normal_dma(g_dma_ch, g_spi_num, g_ss, data_buf, length, SPI_TRANS_CHAR);
}
@@ -82,7 +82,7 @@ void tft_write_half(uint16_t *data_buf, uint32_t length)
{
set_dcx_data();
spi_init(g_spi_num, SPI_WORK_MODE_0, SPI_FF_OCTAL, 16, 0);
spi_init_non_standard(g_spi_num, 0 /*instrction length*/, 16 /*address length*/, 0 /*wait cycles*/,
spi_init_non_standard(g_spi_num, 16 /*instrction length*/, 0 /*address length*/, 0 /*wait cycles*/,
SPI_AITM_AS_FRAME_FORMAT /*spi address trans mode*/);
spi_send_data_normal_dma(g_dma_ch, g_spi_num, g_ss, data_buf, length, SPI_TRANS_SHORT);
}