new structure
This commit is contained in:
1 parent
56f130a34b
commit
28a24a1274
12 files changed
+17
-20
No files matched your search
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
+5
-12
@@ -43,21 +43,14 @@ int main()
|
|||||||
sleep_ms(100);
|
sleep_ms(100);
|
||||||
tft_start_pixels(lcd_config.pio, lcd_config.sm);
|
tft_start_pixels(lcd_config.pio, lcd_config.sm);
|
||||||
while (true){
|
while (true){
|
||||||
for(size_t i = 0; i < 8; i++) {
|
|
||||||
tft_fill(0);
|
|
||||||
dma_channel_wait_for_finish_blocking(dma_chan);
|
|
||||||
}
|
|
||||||
tft_start_pixels(lcd_config.pio, lcd_config.sm);
|
tft_start_pixels(lcd_config.pio, lcd_config.sm);
|
||||||
absolute_time_t start = get_absolute_time();
|
tft_fill(0);
|
||||||
for(size_t i = 0; i < 8; i++) {
|
dma_channel_wait_for_finish_blocking(dma_chan);
|
||||||
tft_fill(31807);
|
sleep_ms(1000);
|
||||||
dma_channel_wait_for_finish_blocking(dma_chan);
|
tft_start_pixels(lcd_config.pio, lcd_config.sm);
|
||||||
}
|
|
||||||
absolute_time_t end = get_absolute_time();
|
|
||||||
volatile int64_t diff = absolute_time_diff_us(start, end);
|
|
||||||
tft_fill(31807);
|
tft_fill(31807);
|
||||||
dma_channel_wait_for_finish_blocking(dma_chan);
|
dma_channel_wait_for_finish_blocking(dma_chan);
|
||||||
// actual refresh rate ~25hz
|
sleep_ms(1000);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,13 +60,17 @@ void tft_init(const struct tft_config* config, int dma_channel) {
|
|||||||
gpio_put(tft_cfg.gpio_bl, 1);
|
gpio_put(tft_cfg.gpio_bl, 1);
|
||||||
}
|
}
|
||||||
void tft_fill(uint16_t color) {
|
void tft_fill(uint16_t color) {
|
||||||
uint32_t color_left = ((uint32_t)color) << 16;
|
for(size_t i = 0; i < 8; i++) {
|
||||||
uint32_t two = 0;
|
dma_channel_wait_for_finish_blocking(dma_chan);
|
||||||
two |= color_left;
|
uint32_t color_left = ((uint32_t)color) << 16;
|
||||||
two |= color;
|
uint32_t two = 0;
|
||||||
uint32_t pix_buf[320*480/4];
|
two |= color_left;
|
||||||
for(size_t i = 0; i < 320*480/4; i++) {
|
two |= color;
|
||||||
pix_buf[i] = two;
|
uint32_t pix_buf[320*480/4];
|
||||||
|
for(size_t i = 0; i < 320*480/4; i++) {
|
||||||
|
pix_buf[i] = two;
|
||||||
|
}
|
||||||
|
dma_channel_set_read_addr(dma_chan, pix_buf, true);
|
||||||
}
|
}
|
||||||
dma_channel_set_read_addr(dma_chan, pix_buf, true);
|
|
||||||
}
|
}
|
||||||
File renamed without changes.
File renamed without changes.
Whitespace-only changes.
Whitespace-only changes.
Reference in new issue
Block a user