measured tft refresh rate see main() for results

This commit is contained in:
matthias wagner
2023-07-31 12:04:24 +02:00
parent ea1fc9bf71
commit 56f130a34b
3 changed files with 9 additions and 2 deletions

View File

@@ -19,5 +19,5 @@
"cmake.buildBeforeRun": true, "cmake.buildBeforeRun": true,
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"C_Cpp.errorSquiggles": "disabled", "C_Cpp.errorSquiggles": "disabled",
"cortex-debug.variableUseNaturalFormat": false "cortex-debug.variableUseNaturalFormat": true
} }

View File

@@ -47,10 +47,17 @@ int main()
tft_fill(0); tft_fill(0);
dma_channel_wait_for_finish_blocking(dma_chan); dma_channel_wait_for_finish_blocking(dma_chan);
} }
tft_start_pixels(lcd_config.pio, lcd_config.sm);
absolute_time_t start = get_absolute_time();
for(size_t i = 0; i < 8; i++) { for(size_t i = 0; i < 8; i++) {
tft_fill(31807); tft_fill(31807);
dma_channel_wait_for_finish_blocking(dma_chan); dma_channel_wait_for_finish_blocking(dma_chan);
} }
absolute_time_t end = get_absolute_time();
volatile int64_t diff = absolute_time_diff_us(start, end);
tft_fill(31807);
dma_channel_wait_for_finish_blocking(dma_chan);
// actual refresh rate ~25hz
} }
return 0; return 0;
} }

View File

@@ -41,7 +41,7 @@ static inline void tft_program_init(PIO pio, uint sm, uint offset, uint data_pin
// Making use of the narrow store replication behaviour on RP2040 to get the // Making use of the narrow store replication behaviour on RP2040 to get the
// data left-justified (as we are using shift-to-left to get MSB-first serial) // data left-justified (as we are using shift-to-left to get MSB-first serial)
// => command gets sent 4 times // => command gets sent 4 times if out shift is set to 32
static inline void tft_put(PIO pio, uint sm, uint8_t x) { static inline void tft_put(PIO pio, uint sm, uint8_t x) {
while (pio_sm_is_tx_fifo_full(pio, sm)) while (pio_sm_is_tx_fifo_full(pio, sm))