30 lines
1022 B
C
30 lines
1022 B
C
#ifndef ST7567_SPI_H
|
|
#define ST7567_SPI_H
|
|
|
|
#include "st7567-common.h"
|
|
#include "esp_err.h"
|
|
#include "driver/spi_master.h"
|
|
#include "driver/gpio.h"
|
|
|
|
// Configuration structure
|
|
typedef struct {
|
|
spi_host_device_t spi_host; // already-initialized SPI bus (spi_bus_initialize called by caller)
|
|
gpio_num_t cs_gpio; // chip select
|
|
gpio_num_t dc_gpio; // data/command select (required, no in-band control byte over SPI)
|
|
gpio_num_t rst_gpio; // hardware reset, GPIO_NUM_NC if not wired
|
|
uint32_t spi_clock_speed_hz; // 0 = use 8MHz default
|
|
uint8_t contrast; // 0-63, 0 = use a sane default (0x20)
|
|
} st7567_spi_config_t;
|
|
|
|
|
|
/**
|
|
* @brief Initialize ST7567 display
|
|
*
|
|
* @param config Configuration structure
|
|
* @param device Pointer to store device state (framebuffer etc, caller-owned)
|
|
* @return esp_err_t ESP_OK on success
|
|
*/
|
|
esp_err_t st7567_init(const st7567_spi_config_t *config, st7567_device_t *device);
|
|
|
|
#endif // ST7567_SPI_H
|