Files
fun_gen_amp_test/app/drivers/st7565/st7565.h
2023-09-25 21:32:15 +02:00

62 lines
1.6 KiB
C

#pragma once
#include "spi.h"
#include "display_gfx.h"
#define ST7565_WIDTH 128
#define ST7565_HEIGHT 64
#define ST7565_BUFFER_SIZE ST7565_WIDTH *ST7565_HEIGHT / 8
#define CMD_DISPLAY_OFF 0xAE
#define CMD_DISPLAY_ON 0xAF
#define CMD_SET_DISP_START_LINE 0x40
#define CMD_SET_PAGE 0xB0
#define CMD_SET_COLUMN_UPPER 0x10
#define CMD_SET_COLUMN_LOWER 0x00
#define CMD_SET_ADC_NORMAL 0xA0
#define CMD_SET_ADC_REVERSE 0xA1
#define CMD_SET_DISP_NORMAL 0xA6
#define CMD_SET_DISP_REVERSE 0xA7
#define CMD_SET_ALLPTS_NORMAL 0xA4
#define CMD_SET_ALLPTS_ON 0xA5
#define CMD_SET_BIAS_9 0xA2
#define CMD_SET_BIAS_7 0xA3
#define CMD_RMW 0xE0
#define CMD_RMW_CLEAR 0xEE
#define CMD_INTERNAL_RESET 0xE2
#define CMD_SET_COM_NORMAL 0xC0
#define CMD_SET_COM_REVERSE 0xC8
#define CMD_SET_POWER_CONTROL 0x28
#define CMD_SET_RESISTOR_RATIO 0x20
#define CMD_SET_VOLUME_FIRST 0x81
#define CMD_SET_VOLUME_SECOND 0
#define CMD_SET_STATIC_OFF 0xAC
#define CMD_SET_STATIC_ON 0xAD
#define CMD_SET_STATIC_REG 0x0
#define CMD_SET_BOOSTER_FIRST 0xF8
#define CMD_SET_BOOSTER_234 0
#define CMD_SET_BOOSTER_5 1
#define CMD_SET_BOOSTER_6 3
#define CMD_NOP 0xE3
#define CMD_TEST 0xF0
typedef struct
{
SPI_HandleTypeDef *hspi;
GPIO_TypeDef *cs_port; // ST7565_CS_GPIO_Port
GPIO_TypeDef *a0_port; // ST7565_A0_GPIO_Port
GPIO_TypeDef *rst_port; // ST7565_RST_GPIO_Port
uint16_t cs_pin; // ST7565_CS_Pin
uint16_t a0_pin; // ST7565_A0_Pin
uint16_t rst_pin; // ST7565_RST_Pin
} st7565_handle_t;
void ST7565_Init(st7565_handle_t *hdisp, GFX_display_t *disp);
void ST7565_DisplayAll(st7565_handle_t *hdisp);