mirror of
https://github.com/sipeed/Maixduino.git
synced 2026-03-19 00:16:56 +01:00
add KPU and mobilenet demo, fix LCD bug
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user