1 /** 2 ****************************************************************************** 3 * @file st7735_reg.h 4 * @author MCD Application Team 5 * @brief This file contains all the functions prototypes for the st7735_regs.c 6 * driver. 7 ****************************************************************************** 8 * @attention 9 * 10 * <h2><center>© Copyright (c) 2018 STMicroelectronics. 11 * All rights reserved.</center></h2> 12 * 13 * This software component is licensed by ST under BSD 3-Clause license, 14 * the "License"; You may not use this file except in compliance with the 15 * License. You may obtain a copy of the License at: 16 * opensource.org/licenses/BSD-3-Clause 17 * 18 ****************************************************************************** 19 */ 20 21 /* Define to prevent recursive inclusion -------------------------------------*/ 22 #ifndef ST7735_REG_H 23 #define ST7735_REG_H 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 /* Includes ------------------------------------------------------------------*/ 30 #include <stdint.h> 31 32 /** @addtogroup BSP 33 * @{ 34 */ 35 36 /** @addtogroup Components 37 * @{ 38 */ 39 40 /** @defgroup ST7735_REG ST7735 Registers 41 * @{ 42 */ 43 44 /** @defgroup ST7735_REG_Exported_Constants Exported Constants 45 * @{ 46 */ 47 48 /** 49 * @brief ST7735 Registers 50 */ 51 #define ST7735_NOP 0x00U /* No Operation: NOP */ 52 #define ST7735_SW_RESET 0x01U /* Software reset: SWRESET */ 53 #define ST7735_READ_ID 0x04U /* Read Display ID: RDDID */ 54 #define ST7735_READ_STATUS 0x09U /* Read Display Statu: RDDST */ 55 #define ST7735_READ_POWER_MODE 0x0AU /* Read Display Power: RDDPM */ 56 #define ST7735_READ_MADCTL 0x0BU /* Read Display: RDDMADCTL */ 57 #define ST7735_READ_PIXEL_FORMAT 0x0CU /* Read Display Pixel: RDDCOLMOD */ 58 #define ST7735_READ_IMAGE_MODE 0x0DU /* Read Display Image: RDDIM */ 59 #define ST7735_READ_SIGNAL_MODE 0x0EU /* Read Display Signal: RDDSM */ 60 #define ST7735_SLEEP_IN 0x10U /* Sleep in & booster off: SLPIN */ 61 #define ST7735_SLEEP_OUT 0x11U /* Sleep out & booster on: SLPOUT */ 62 #define ST7735_PARTIAL_DISPLAY_ON 0x12U /* Partial mode on: PTLON */ 63 #define ST7735_NORMAL_DISPLAY_OFF 0x13U /* Partial off (Normal): NORON */ 64 #define ST7735_DISPLAY_INVERSION_OFF 0x20U /* Display inversion off: INVOFF */ 65 #define ST7735_DISPLAY_INVERSION_ON 0x21U /* Display inversion on: INVON */ 66 #define ST7735_GAMMA_SET 0x26U /* Gamma curve select: GAMSET */ 67 #define ST7735_DISPLAY_OFF 0x28U /* Display off: DISPOFF */ 68 #define ST7735_DISPLAY_ON 0x29U /* Display on: DISPON */ 69 #define ST7735_CASET 0x2AU /* Column address set: CASET */ 70 #define ST7735_RASET 0x2BU /* Row address set: RASET */ 71 #define ST7735_WRITE_RAM 0x2CU /* Memory write: RAMWR */ 72 #define ST7735_RGBSET 0x2DU /* LUT for 4k,65k,262k color: RGBSET */ 73 #define ST7735_READ_RAM 0x2EU /* Memory read: RAMRD */ 74 #define ST7735_PTLAR 0x30U /* Partial start/end address set: PTLAR */ 75 #define ST7735_TE_LINE_OFF 0x34U /* Tearing effect line off: TEOFF */ 76 #define ST7735_TE_LINE_ON 0x35U /* Tearing effect mode set & on: TEON */ 77 #define ST7735_MADCTL 0x36U /* Memory data access control: MADCTL */ 78 #define ST7735_IDLE_MODE_OFF 0x38U /* Idle mode off: IDMOFF */ 79 #define ST7735_IDLE_MODE_ON 0x39U /* Idle mode on: IDMON */ 80 #define ST7735_COLOR_MODE 0x3AU /* Interface pixel format: COLMOD */ 81 #define ST7735_FRAME_RATE_CTRL1 0xB1U /* In normal mode (Full colors): FRMCTR1 */ 82 #define ST7735_FRAME_RATE_CTRL2 0xB2U /* In Idle mode (8-colors): FRMCTR2 */ 83 #define ST7735_FRAME_RATE_CTRL3 0xB3U /* In partial mode + Full colors: FRMCTR3 */ 84 #define ST7735_FRAME_INVERSION_CTRL 0xB4U /* Display inversion control: INVCTR */ 85 #define ST7735_DISPLAY_SETTING 0xB6U /* Display function setting */ 86 #define ST7735_PWR_CTRL1 0xC0U /* Power control setting: PWCTR1 */ 87 #define ST7735_PWR_CTRL2 0xC1U /* Power control setting: PWCTR2 */ 88 #define ST7735_PWR_CTRL3 0xC2U /* In normal mode (Full colors): PWCTR3 */ 89 #define ST7735_PWR_CTRL4 0xC3U /* In Idle mode (8-colors): PWCTR4 */ 90 #define ST7735_PWR_CTRL5 0xC4U /* In partial mode + Full colors: PWCTR5 */ 91 #define ST7735_VCOMH_VCOML_CTRL1 0xC5U /* VCOM control 1: VMCTR1 */ 92 #define ST7735_VMOF_CTRL 0xC7U /* Set VCOM offset control: VMOFCTR */ 93 #define ST7735_WRID2 0xD1U /* Set LCM version code: WRID2 */ 94 #define ST7735_WRID3 0xD2U /* Customer Project code: WRID3 */ 95 #define ST7735_NV_CTRL1 0xD9U /* NVM control status: NVCTR1 */ 96 #define ST7735_READ_ID1 0xDAU /* Read ID1: RDID1 */ 97 #define ST7735_READ_ID2 0xDBU /* Read ID2: RDID2 */ 98 #define ST7735_READ_ID3 0xDCU /* Read ID3: RDID3 */ 99 #define ST7735_NV_CTRL2 0xDEU /* NVM Read Command: NVCTR2 */ 100 #define ST7735_NV_CTRL3 0xDFU /* NVM Write Command: NVCTR3 */ 101 #define ST7735_PV_GAMMA_CTRL 0xE0U /* Set Gamma adjustment (+ polarity): GAMCTRP1 */ 102 #define ST7735_NV_GAMMA_CTRL 0xE1U /* Set Gamma adjustment (- polarity): GAMCTRN1 */ 103 #define ST7735_EXT_CTRL 0xF0U /* Extension command control */ 104 #define ST7735_PWR_CTRL6 0xFCU /* In partial mode + Idle mode: PWCTR6 */ 105 #define ST7735_VCOM4_LEVEL 0xFFU /* VCOM 4 level control */ 106 107 /** 108 * @} 109 */ 110 111 /** @defgroup ST7735_REG_Exported_Types Exported Types 112 * @{ 113 */ 114 typedef int32_t (*ST7735_Write_Func)(void *, uint8_t, uint8_t*, uint32_t); 115 typedef int32_t (*ST7735_Read_Func) (void *, uint8_t, uint8_t*); 116 typedef int32_t (*ST7735_Send_Func) (void *, uint8_t*, uint32_t); 117 typedef int32_t (*ST7735_Recv_Func) (void *, uint8_t*, uint32_t); 118 119 typedef struct 120 { 121 ST7735_Write_Func WriteReg; 122 ST7735_Read_Func ReadReg; 123 ST7735_Send_Func SendData; 124 ST7735_Recv_Func RecvData; 125 void *handle; 126 } st7735_ctx_t; 127 128 /** 129 * @} 130 */ 131 132 /** @defgroup ST7735_REG_Exported_Functions Exported Functions 133 * @{ 134 */ 135 int32_t st7735_write_reg(st7735_ctx_t *ctx, uint8_t reg, uint8_t *pdata, uint32_t length); 136 int32_t st7735_read_reg(st7735_ctx_t *ctx, uint8_t reg, uint8_t *pdata); 137 int32_t st7735_send_data(st7735_ctx_t *ctx, uint8_t *pdata, uint32_t length); 138 int32_t st7735_recv_data(st7735_ctx_t *ctx, uint8_t *pdata, uint32_t length); 139 140 /** 141 * @} 142 */ 143 144 #ifdef __cplusplus 145 } 146 #endif 147 148 #endif /* ST7735_REG_H */ 149 150 /** 151 * @} 152 */ 153 154 /** 155 * @} 156 */ 157 158 /** 159 * @} 160 */ 161 162 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 163