#ifndef TFT_H
#define TFT_H

#include "hardware/gpio.h"
#include "hardware/spi.h"
#include "hardware/divider.h"
#include "pico/stdlib.h"
#include <stdio.h>

struct tft_config {
    spi_inst_t* spi;
    uint gpio_din;
    uint gpio_clk;
    int gpio_cs;
    uint gpio_dc;
    uint gpio_rst;
    uint gpio_bl;
    uint16_t width;
    uint16_t height;
};

void tft_cmd(uint8_t cmd, const uint8_t* data, size_t len);
void tft_caset(uint16_t xs, uint16_t xe);
void tft_raset(uint16_t ys, uint16_t ye);
void tft_init(const struct tft_config* config);
void tft_ramwr();
void tft_write(const void* data, size_t len);
void tft_put(uint16_t pixel);
void tft_fill(uint16_t pixel);
void tft_set_cursor(uint16_t x, uint16_t y);
void tft_vertical_scroll(uint16_t row);

#endif // TFT_H