got it working, just a small bug left

This commit is contained in:
Ellen Arvidsson 2025-06-14 17:17:00 +02:00
parent 4ade3a5f00
commit f3a619decc
7 changed files with 356 additions and 178 deletions

View file

@ -157,8 +157,9 @@ struct tft_driver_ili9341 {
enum class async_status {
INIT,
READY,
TX,
NO_TX,
TX_NONE,
TX_ACTIVE,
TX_INACTIVE,
DONE
};
@ -176,8 +177,6 @@ struct tft_driver_ili9341 {
SpiHandle spi;
SpiHandle::Config spi_conf;
Logger<LOGGER_EXTERNAL> *lg;
Pin dcx_pin;
GPIO dcx;
@ -186,6 +185,7 @@ struct tft_driver_ili9341 {
volatile async_wr _async_wr;
volatile async_on_finish_f _async_cb_fun;
volatile void *_async_cb_ctx;
int _async_id;
uint8_t *_async_dma_buf;
size_t _async_dma_sz;
@ -196,17 +196,11 @@ struct tft_driver_ili9341 {
/* general */
inline uint16_t width(void) { return (ILI9341_TFTWIDTH); }
inline uint16_t height(void) { return (ILI9341_TFTHEIGHT); }
inline size_t block_rows(void) {
return (sizeof(tft_color) * height() /
TFT_DRIVER_ILI9341_NBLOCKS);
}
inline size_t block_sz(void) {
return (sizeof(tft_color) * width() * height() /
TFT_DRIVER_ILI9341_NBLOCKS);
}
tft_driver_ili9341(void) : _async_hint(async_hint::NONE),
_async_stat(async_status::INIT), _async_wr(async_wr::END),
_async_cb_fun(NULL), _async_cb_ctx(NULL),
_async_id(-1),
_async_dma_buf(NULL), _async_dma_sz(0),
_async_curr_wr(NULL), _async_curr_rd(NULL) {};
@ -233,9 +227,19 @@ struct tft_driver_ili9341 {
void async_flush(void);
void async_tx(void);
void async_tx_try(void);
void async_finalize(void);
int async_ready(void);
inline int async_id(void) { return (_async_id); }
inline int async_id_next(void) {
_async_id++;
_async_id &= 0xffff;
return (_async_id);
}
int async_cmd_hint(async_hint hint);
int async_hline_row_bg_fill(tft_color *bg, tft_color *fg,
int async_hline_row_bg_fill(int async_id, tft_color *bg, tft_color *fg,
uint16_t hline_idx_st, uint16_t hline_idx_end, uint16_t row_idx);
static void async_tx_cmd_scb(void *ctx);
@ -255,8 +259,10 @@ struct tft_driver_ili9341 {
size_t dma_buf_sz_tx_pend(void);
size_t dma_buf_sz_used(void);
int dma_buf_reset(void);
tft_dma_cmd *dma_buf_curr_wr(void);
tft_dma_cmd *dma_buf_next_wr(void);
tft_dma_cmd *dma_buf_next_wr(size_t curr_sz);
const tft_dma_cmd *dma_buf_curr_rd(void);
const tft_dma_cmd *dma_buf_next_rd(void);