提交 67235737 编写于 作者: csdn_JZ_'s avatar csdn_JZ_ 提交者: guo

[bsp/stm32] format code

上级 b380bdf0
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
......
......@@ -167,7 +167,7 @@
#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
#define USE_RTOS 0U
#define USE_SD_TRANSCEIVER 0U /*!< use uSD Transceiver */
#define USE_SPI_CRC 0U /*!< use CRC in SPI */
#define USE_SPI_CRC 0U /*!< use CRC in SPI */
#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */
#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */
......
......@@ -153,7 +153,7 @@ void SystemInit (void)
if(FLASH_LATENCY_DEFAULT > (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)))
{
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
}
/* Set HSION bit */
......@@ -164,12 +164,12 @@ void SystemInit (void)
/* Reset HSEON, HSECSSON, CSION, HSI48ON, CSIKERON, PLL1ON, PLL2ON and PLL3ON bits */
RCC->CR &= 0xEAF6ED7FU;
/* Decreasing the number of wait states because of lower CPU frequency */
if(FLASH_LATENCY_DEFAULT < (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)))
{
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
}
#if defined(D3_SRAM_BASE)
......
/*
* Copyright (c) 2006-2020, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
......
/*
* Copyright (c) 2006-2020, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
......
/*
* Copyright (c) 2006-2020, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
......
/*
* Copyright (c) 2006-2020, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
......
/*
* Copyright (c) 2006-2020, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
......@@ -26,8 +26,8 @@
static int rt_hw_spi_flash_with_sfud_init(void)
{
rt_err_t err = RT_EOK;
rt_hw_spi_device_attach("spi1", "spi10", SPI_CS_GPIO, SPI_CS_PIN);
rt_err_t err = RT_EOK;
rt_hw_spi_device_attach("spi1", "spi10", SPI_CS_GPIO, SPI_CS_PIN);
/* init W25Q16 , And register as a block device */
if (RT_NULL == rt_sfud_flash_probe(FAL_USING_NOR_FLASH_DEV_NAME, "spi10"))
......
/*
* Copyright (c) 2006-2020, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
......
......@@ -12,14 +12,14 @@ static int32_t lcd_senddata(uint8_t* pdata,uint32_t length);
static int32_t lcd_recvdata(uint8_t* pdata,uint32_t length);
ST7735_IO_t st7735_pIO = {
lcd_init,
RT_NULL,
RT_NULL,
lcd_writereg,
lcd_readreg,
lcd_senddata,
lcd_recvdata,
RT_NULL
lcd_init,
RT_NULL,
RT_NULL,
lcd_writereg,
lcd_readreg,
lcd_senddata,
lcd_recvdata,
RT_NULL
};
ST7735_Object_t st7735_pObj;
uint32_t st7735_id;
......@@ -81,63 +81,63 @@ void LCD_ShowChar(uint16_t x,uint16_t y,uint8_t num,uint8_t size,uint8_t mode)
num=num-' ';//得到偏移后的值
count = 0;
if(!mode) //非叠加方式
{
for(t=0;t<size;t++)
{
if(size==12)temp=asc2_1206[num][t]; //调用1206字体
else temp=asc2_1608[num][t]; //调用1608字体
for(t1=0;t1<8;t1++)
{
if(temp&0x80)
write[count][t/2]=(BRUSH_POINT_COLOR&0xFF)<<8|BRUSH_POINT_COLOR>>8;
else
write[count][t/2]=(BRUSH_BACK_COLOR&0xFF)<<8|BRUSH_BACK_COLOR>>8;
count ++;
if(count >= size) count =0;
temp<<=1;
y++;
if(y>=h){return;}//超区域了
if((y-y0)==size)
{
y=y0;
x++;
if(x>=w){return;}//超区域了
break;
}
}
}
}
else//叠加方式
{
for(t=0;t<size;t++)
{
if(size==12)temp=asc2_1206[num][t]; //调用1206字体
else temp=asc2_1608[num][t]; //调用1608字体
for(t1=0;t1<8;t1++)
{
if(temp&0x80)
write[count][t/2]=(BRUSH_POINT_COLOR&0xFF)<<8|BRUSH_POINT_COLOR>>8;
count ++;
if(count >= size) count =0;
temp<<=1;
y++;
if(y>=h){return;}//超区域了
if((y-y0)==size)
{
y=y0;
x++;
if(x>=w){return;}//超区域了
break;
}
}
}
}
ST7735_FillRGBRect(&st7735_pObj,x0,y0,(uint8_t *)&write,size==12?6:8,size);
if(!mode) //非叠加方式
{
for(t=0;t<size;t++)
{
if(size==12)temp=asc2_1206[num][t]; //调用1206字体
else temp=asc2_1608[num][t]; //调用1608字体
for(t1=0;t1<8;t1++)
{
if(temp&0x80)
write[count][t/2]=(BRUSH_POINT_COLOR&0xFF)<<8|BRUSH_POINT_COLOR>>8;
else
write[count][t/2]=(BRUSH_BACK_COLOR&0xFF)<<8|BRUSH_BACK_COLOR>>8;
count ++;
if(count >= size) count =0;
temp<<=1;
y++;
if(y>=h){return;}//超区域了
if((y-y0)==size)
{
y=y0;
x++;
if(x>=w){return;}//超区域了
break;
}
}
}
}
else//叠加方式
{
for(t=0;t<size;t++)
{
if(size==12)temp=asc2_1206[num][t]; //调用1206字体
else temp=asc2_1608[num][t]; //调用1608字体
for(t1=0;t1<8;t1++)
{
if(temp&0x80)
write[count][t/2]=(BRUSH_POINT_COLOR&0xFF)<<8|BRUSH_POINT_COLOR>>8;
count ++;
if(count >= size) count =0;
temp<<=1;
y++;
if(y>=h){return;}//超区域了
if((y-y0)==size)
{
y=y0;
x++;
if(x>=w){return;}//超区域了
break;
}
}
}
}
ST7735_FillRGBRect(&st7735_pObj,x0,y0,(uint8_t *)&write,size==12?6:8,size);
}
//显示字符串
......@@ -147,9 +147,9 @@ void LCD_ShowChar(uint16_t x,uint16_t y,uint8_t num,uint8_t size,uint8_t mode)
//*p:字符串起始地址
void LCD_ShowString(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint8_t size,uint8_t *p)
{
uint8_t x0=x;
width+=x;
height+=y;
uint8_t x0=x;
width+=x;
height+=y;
while((*p<='~')&&(*p>=' '))//判断是不是非法字符!
{
if(x>=width){x=x0;y+=size;}
......@@ -167,58 +167,58 @@ void LCD_FillRGBRect(uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Widt
static int32_t lcd_init(void)
{
return ST7735_OK;
return ST7735_OK;
}
static int32_t lcd_writereg(uint8_t reg,uint8_t* pdata,uint32_t length)
{
int32_t result;
LCD_CS_RESET;
LCD_RS_RESET;
LCD_CS_RESET;
LCD_RS_RESET;
result = rt_spi_send(spi_dev_lcd, &reg, 1);
LCD_RS_SET;
if(length > 0)
LCD_RS_SET;
if(length > 0)
result += rt_spi_send(spi_dev_lcd, pdata, length);
LCD_CS_SET;
LCD_CS_SET;
return ((result == length+1)?0:-1);
}
static int32_t lcd_readreg(uint8_t reg,uint8_t* pdata)
{
int32_t result;
LCD_CS_RESET;
LCD_RS_RESET;
LCD_CS_RESET;
LCD_RS_RESET;
result = rt_spi_send(spi_dev_lcd, &reg, 1);
LCD_RS_SET;
result += rt_spi_recv(spi_dev_lcd, pdata, 1);
LCD_CS_SET;
result = rt_spi_send(spi_dev_lcd, &reg, 1);
LCD_RS_SET;
result += rt_spi_recv(spi_dev_lcd, pdata, 1);
LCD_CS_SET;
return ((result == 2)?0:-1);
}
static int32_t lcd_senddata(uint8_t* pdata,uint32_t length)
{
int32_t result;
LCD_CS_RESET;
//LCD_RS_SET;
result =rt_spi_send(spi_dev_lcd, pdata, length);
LCD_CS_SET;
LCD_CS_RESET;
//LCD_RS_SET;
result =rt_spi_send(spi_dev_lcd, pdata, length);
LCD_CS_SET;
return ((result == length)?0:-1);
}
static int32_t lcd_recvdata(uint8_t* pdata,uint32_t length)
{
int32_t result;
LCD_CS_RESET;
//LCD_RS_SET;
result = rt_spi_recv(spi_dev_lcd, pdata, length);
LCD_CS_SET;
LCD_CS_RESET;
//LCD_RS_SET;
result = rt_spi_recv(spi_dev_lcd, pdata, length);
LCD_CS_SET;
return ((result == length)?0:-1);
}
static int LCD_Init(void)
{
rt_pin_mode(WR_RS_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(WR_RS_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(CS_PIN, PIN_MODE_OUTPUT);
spi_dev_lcd = (struct rt_spi_device *)rt_device_find(LCD_SPI_DEVICE_NAME);
......@@ -229,13 +229,13 @@ static int LCD_Init(void)
}
ST7735_RegisterBusIO(&st7735_pObj,&st7735_pIO);
if(ST7735_ERROR == ST7735_LCD_Driver.Init(&st7735_pObj,ST7735_FORMAT_RBG565,ST7735_ORIENTATION_LANDSCAPE_ROT180))
if(ST7735_ERROR == ST7735_LCD_Driver.Init(&st7735_pObj,ST7735_FORMAT_RBG565,ST7735_ORIENTATION_LANDSCAPE_ROT180))
{
LOG_E("st7735 init failed!");
// return ;
}
ST7735_LCD_Driver.FillRect(&st7735_pObj,0,0,160,80,BLACK);
ST7735_LCD_Driver.ReadID(&st7735_pObj,&st7735_id);
ST7735_LCD_Driver.ReadID(&st7735_pObj,&st7735_id);
ST7735_LCD_Driver.DisplayOn(&st7735_pObj);
LOG_D("lcd id:0X%08X", st7735_id);
LOG_D("chip id:0X%08X", HAL_GetDEVID());
......@@ -263,21 +263,21 @@ INIT_COMPONENT_EXPORT(LCD_Init);
#ifdef FINSH_USING_MSH
static int show_logo(int argc, char **argv)
{
uint8_t text[20];
uint8_t text[20];
LCD_SetBrightness(MAX_BRIGHTNESS);
ST7735_LCD_Driver.DrawBitmap(&st7735_pObj,0,0,WeActStudiologo);
ST7735_LCD_Driver.DrawBitmap(&st7735_pObj,0,0,WeActStudiologo);
rt_thread_mdelay(1000);
ST7735_LCD_Driver.FillRect(&st7735_pObj,0,0,160,80,BLACK);
ST7735_LCD_Driver.FillRect(&st7735_pObj,0,0,160,80,BLACK);
sprintf((char *)&text,"WeAct Studio");
LCD_ShowString(4,4,160,16,16,text);
sprintf((char *)&text,"STM32H7xx 0x%X",HAL_GetDEVID());
LCD_ShowString(4,22,160,16,16,text);
sprintf((char *)&text,"LCD ID: 0x%X",st7735_id);
LCD_ShowString(4,40,160,16,16,text);
sprintf((char *)&text,"WeAct Studio");
LCD_ShowString(4,4,160,16,16,text);
sprintf((char *)&text,"STM32H7xx 0x%X",HAL_GetDEVID());
LCD_ShowString(4,22,160,16,16,text);
sprintf((char *)&text,"LCD ID: 0x%X",st7735_id);
LCD_ShowString(4,40,160,16,16,text);
return 0;
}
MSH_CMD_EXPORT(show_logo, show logo);
......
......@@ -7,23 +7,23 @@
#include "st7735.h"
#include <stdio.h>
#define WHITE 0xFFFF
#define BLACK 0x0000
#define BLUE 0x001F
#define WHITE 0xFFFF
#define BLACK 0x0000
#define BLUE 0x001F
#define BRED 0XF81F
#define GRED 0XFFE0
#define GBLUE 0X07FF
#define RED 0xF800
#define MAGENTA 0xF81F
#define GREEN 0x07E0
#define CYAN 0x7FFF
#define YELLOW 0xFFE0
#define BROWN 0XBC40 //棕色
#define BRRED 0XFC07 //棕红色
#define GRAY 0X8430 //灰色
#define DARKBLUE 0X01CF //深蓝色
#define LIGHTBLUE 0X7D7C //浅蓝色
#define GRAYBLUE 0X5458 //灰蓝色
#define GRED 0XFFE0
#define GBLUE 0X07FF
#define RED 0xF800
#define MAGENTA 0xF81F
#define GREEN 0x07E0
#define CYAN 0x7FFF
#define YELLOW 0xFFE0
#define BROWN 0XBC40 //棕色
#define BRRED 0XFC07 //棕红色
#define GRAY 0X8430 //灰色
#define DARKBLUE 0X01CF //深蓝色
#define LIGHTBLUE 0X7D7C //浅蓝色
#define GRAYBLUE 0X5458 //灰蓝色
// lcd spi
#define LCD_SPI_DEVICE_NAME "spi40"
......
......@@ -89,9 +89,9 @@ ST7735_LCD_Drv_t ST7735_LCD_Driver =
static uint32_t OrientationTab[4][2] =
{
{0x48U , 0xC8U}, /* Portrait orientation choice of LCD screen */
{0x88U , 0x08U}, /* Portrait rotated 180 orientation choice of LCD screen */
{0x88U , 0x08U}, /* Portrait rotated 180° orientation choice of LCD screen */
{0x28U , 0x68U}, /* Landscape orientation choice of LCD screen */
{0xE8U , 0xA8U} /* Landscape rotated 180 orientation choice of LCD screen */
{0xE8U , 0xA8U} /* Landscape rotated 180° orientation choice of LCD screen */
};
static ST7735_Ctx_t ST7735Ctx;
......@@ -177,16 +177,16 @@ int32_t ST7735_Init(ST7735_Object_t *pObj, uint32_t ColorCoding, uint32_t Orient
}
else
{
/* Out of sleep mode, 0 args, delay 120ms */
/* Out of sleep mode, 0 args, delay 120ms */
tmp = 0x00U;
ret = st7735_write_reg(&pObj->Ctx, ST7735_SW_RESET, &tmp, 0);
(void)ST7735_IO_Delay(pObj, 120);
(void)ST7735_IO_Delay(pObj, 120);
/* Out of sleep mode, 0 args, no delay */
tmp = 0x00U;
ret += st7735_write_reg(&pObj->Ctx, ST7735_SLEEP_OUT, &tmp, 1);
/* Frame rate ctrl - normal mode, 3 args:Rate = fosc/(1x2+40) * (LINE+2C+2D)*/
/* Frame rate ctrl - normal mode, 3 args:Rate = fosc/(1x2+40) * (LINE+2C+2D)*/
ret += st7735_write_reg(&pObj->Ctx, ST7735_FRAME_RATE_CTRL1, &tmp, 0);
tmp = 0x01U;
ret += st7735_send_data(&pObj->Ctx, &tmp, 1);
......@@ -384,7 +384,7 @@ int32_t ST7735_ReadID(ST7735_Object_t *pObj, uint32_t *Id)
{
ret = ST7735_ERROR;
}
else if(st7735_read_reg(&pObj->Ctx, ST7735_READ_ID3, &tmp[2]) != ST7735_OK)
else if(st7735_read_reg(&pObj->Ctx, ST7735_READ_ID3, &tmp[2]) != ST7735_OK)
{
ret = ST7735_ERROR;
}
......@@ -392,7 +392,7 @@ int32_t ST7735_ReadID(ST7735_Object_t *pObj, uint32_t *Id)
{
*Id = ((uint32_t)tmp[2])<<0| ((uint32_t)tmp[1])<<8 | ((uint32_t)tmp[0])<<16;
//*Id = __rbit(*Id);
//*Id = __rbit(*Id);
ret = ST7735_OK;
}
......@@ -501,7 +501,7 @@ int32_t ST7735_SetOrientation(ST7735_Object_t *pObj, uint32_t Orientation)
ST7735Ctx.Width = ST7735_HEIGHT;
ST7735Ctx.Height = ST7735_WIDTH;
}
ST7735Ctx.Orientation = Orientation;
ST7735Ctx.Orientation = Orientation;
ret = ST7735_SetDisplayWindow(pObj, 0U, 0U, ST7735Ctx.Width, ST7735Ctx.Height);
......@@ -545,27 +545,27 @@ int32_t ST7735_SetCursor(ST7735_Object_t *pObj, uint32_t Xpos, uint32_t Ypos)
int32_t ret;
uint8_t tmp;
/* Cursor calibration */
if(ST7735Ctx.Orientation <= ST7735_ORIENTATION_PORTRAIT_ROT180)
{
/* Cursor calibration */
if(ST7735Ctx.Orientation <= ST7735_ORIENTATION_PORTRAIT_ROT180)
{
#if IS_BOE_PANEL
Xpos += 24;
Ypos += 0;
Xpos += 24;
Ypos += 0;
#else
Xpos += 26;
Ypos += 1;
Xpos += 26;
Ypos += 1;
#endif
}
else
{
}
else
{
#if IS_BOE_PANEL
Xpos += 0;
Ypos += 24;
Xpos += 0;
Ypos += 24;
#else
Xpos += 1;
Ypos += 26;
Xpos += 1;
Ypos += 26;
#endif
}
}
ret = st7735_write_reg(&pObj->Ctx, ST7735_CASET, &tmp, 0);
tmp = (uint8_t)(Xpos >> 8U);
......@@ -949,27 +949,27 @@ static int32_t ST7735_SetDisplayWindow(ST7735_Object_t *pObj, uint32_t Xpos, uin
int32_t ret;
uint8_t tmp;
/* Cursor calibration */
if(ST7735Ctx.Orientation <= ST7735_ORIENTATION_PORTRAIT_ROT180)
{
/* Cursor calibration */
if(ST7735Ctx.Orientation <= ST7735_ORIENTATION_PORTRAIT_ROT180)
{
#if IS_BOE_PANEL
Xpos += 24;
Ypos += 0;
Xpos += 24;
Ypos += 0;
#else
Xpos += 26;
Ypos += 1;
Xpos += 26;
Ypos += 1;
#endif
}
else
{
}
else
{
#if IS_BOE_PANEL
Xpos += 0;
Ypos += 24;
Xpos += 0;
Ypos += 24;
#else
Xpos += 1;
Ypos += 26;
Xpos += 1;
Ypos += 26;
#endif
}
}
/* Column addr set, 4 args, no delay: XSTART = Xpos, XEND = (Xpos + Width - 1) */
ret = st7735_write_reg(&pObj->Ctx, ST7735_CASET, &tmp, 0);
......
......@@ -24,7 +24,7 @@
#ifdef __cplusplus
extern "C" {
#endif
#endif
/* Includes ------------------------------------------------------------------*/
#include "st7735_reg.h"
......@@ -32,12 +32,12 @@
/** @addtogroup BSP
* @{
*/
*/
/** @addtogroup Components
* @{
*/
*/
/** @defgroup ST7735 ST7735
* @{
*/
......@@ -58,19 +58,19 @@ typedef struct
{
ST7735_Init_Func Init;
ST7735_DeInit_Func DeInit;
uint16_t Address;
uint16_t Address;
ST7735_WriteReg_Func WriteReg;
ST7735_ReadReg_Func ReadReg;
ST7735_SendData_Func SendData;
ST7735_RecvData_Func RecvData;
ST7735_GetTick_Func GetTick;
ST7735_GetTick_Func GetTick;
} ST7735_IO_t;
typedef struct
{
ST7735_IO_t IO;
st7735_ctx_t Ctx;
st7735_ctx_t Ctx;
uint8_t IsInitialized;
} ST7735_Object_t;
......@@ -82,15 +82,15 @@ typedef struct
int32_t (*ReadID )(ST7735_Object_t*, uint32_t*);
int32_t (*DisplayOn )(ST7735_Object_t*);
int32_t (*DisplayOff )(ST7735_Object_t*);
int32_t (*SetBrightness )(ST7735_Object_t*, uint32_t);
int32_t (*GetBrightness )(ST7735_Object_t*, uint32_t*);
int32_t (*SetBrightness )(ST7735_Object_t*, uint32_t);
int32_t (*GetBrightness )(ST7735_Object_t*, uint32_t*);
int32_t (*SetOrientation )(ST7735_Object_t*, uint32_t);
int32_t (*GetOrientation )(ST7735_Object_t*, uint32_t*);
/* Drawing functions*/
int32_t ( *SetCursor ) (ST7735_Object_t*, uint32_t, uint32_t);
int32_t ( *SetCursor ) (ST7735_Object_t*, uint32_t, uint32_t);
int32_t ( *DrawBitmap ) (ST7735_Object_t*, uint32_t, uint32_t, uint8_t *);
int32_t ( *FillRGBRect ) (ST7735_Object_t*, uint32_t, uint32_t, uint8_t*, uint32_t, uint32_t);
int32_t ( *FillRGBRect ) (ST7735_Object_t*, uint32_t, uint32_t, uint8_t*, uint32_t, uint32_t);
int32_t ( *DrawHLine ) (ST7735_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *DrawVLine ) (ST7735_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t);
int32_t ( *FillRect ) (ST7735_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
......@@ -98,31 +98,31 @@ typedef struct
int32_t ( *SetPixel ) (ST7735_Object_t*, uint32_t, uint32_t, uint32_t);
int32_t ( *GetXSize ) (ST7735_Object_t*, uint32_t *);
int32_t ( *GetYSize ) (ST7735_Object_t*, uint32_t *);
}ST7735_LCD_Drv_t;
/**
* @}
*/
*/
/** @defgroup ST7735_Exported_Constants Exported Constants
* @{
*/
/**
* @brief ST7735 Size
*/
/**
* @brief ST7735 Size
*/
#define ST7735_OK (0)
#define ST7735_ERROR (-1)
/**
* @brief ST7735 ID
*/
/**
* @brief ST7735 ID
*/
#define ST7735_ID 0x5CU
/**
* @brief ST7735 Size
*/
/**
* @brief ST7735 Size
*/
#define ST7735_WIDTH 80U
#define ST7735_HEIGHT 160U
......@@ -131,24 +131,24 @@ typedef struct
* Possible values of Display Orientation
*/
#define ST7735_ORIENTATION_PORTRAIT 0x00U /* Portrait orientation choice of LCD screen */
#define ST7735_ORIENTATION_PORTRAIT_ROT180 0x01U /* Portrait rotated 180° orientation choice of LCD screen */
#define ST7735_ORIENTATION_PORTRAIT_ROT180 0x01U /* Portrait rotated 180° orientation choice of LCD screen */
#define ST7735_ORIENTATION_LANDSCAPE 0x02U /* Landscape orientation choice of LCD screen */
#define ST7735_ORIENTATION_LANDSCAPE_ROT180 0x03U /* Landscape rotated 180° orientation choice of LCD screen */
#define ST7735_ORIENTATION_LANDSCAPE_ROT180 0x03U /* Landscape rotated 180° orientation choice of LCD screen */
/**
* @brief Possible values of pixel data format (ie color coding)
* @brief Possible values of pixel data format (ie color coding)
*/
#define ST7735_FORMAT_RBG444 0x03U /* Pixel format chosen is RGB444 : 12 bpp */
#define ST7735_FORMAT_RBG444 0x03U /* Pixel format chosen is RGB444 : 12 bpp */
#define ST7735_FORMAT_RBG565 0x05U /* Pixel format chosen is RGB565 : 16 bpp */
#define ST7735_FORMAT_RBG666 0x06U /* Pixel format chosen is RGB666 : 18 bpp */
#define ST7735_FORMAT_DEFAULT ST7735_FORMAT_RBG565
/**
* @}
*/
/** @defgroup ST7735_Exported_Functions Exported Functions
* @{
*/
*/
int32_t ST7735_RegisterBusIO (ST7735_Object_t *pObj, ST7735_IO_t *pIO);
int32_t ST7735_Init(ST7735_Object_t *pObj, uint32_t ColorCoding, uint32_t Orientation);
int32_t ST7735_DeInit(ST7735_Object_t *pObj);
......@@ -175,8 +175,8 @@ extern ST7735_LCD_Drv_t ST7735_LCD_Driver;
/**
* @}
*/
*/
#ifdef __cplusplus
}
#endif
......@@ -185,14 +185,14 @@ extern ST7735_LCD_Drv_t ST7735_LCD_Driver;
/**
* @}
*/
*/
/**
* @}
*/
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
......@@ -22,19 +22,19 @@
/** @addtogroup BSP
* @{
*/
*/
/** @addtogroup Components
* @{
*/
*/
/** @addtogroup ST7735_REG
* @{
*/
/** @addtogroup ST7735_REG_Exported_Functions
* @{
*/
*/
/**
* @brief Read ST7735 register
......@@ -87,18 +87,18 @@ int32_t st7735_recv_data(st7735_ctx_t *ctx, uint8_t *pdata, uint32_t length)
/**
* @}
*/
*/
/**
* @}
*/
*/
/**
* @}
*/
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
......@@ -24,19 +24,19 @@
#ifdef __cplusplus
extern "C" {
#endif
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
*/
/** @addtogroup Components
* @{
*/
*/
/** @defgroup ST7735_REG ST7735 Registers
* @{
*/
......@@ -44,9 +44,9 @@
/** @defgroup ST7735_REG_Exported_Constants Exported Constants
* @{
*/
/**
* @brief ST7735 Registers
/**
* @brief ST7735 Registers
*/
#define ST7735_NOP 0x00U /* No Operation: NOP */
#define ST7735_SW_RESET 0x01U /* Software reset: SWRESET */
......@@ -54,49 +54,49 @@
#define ST7735_READ_STATUS 0x09U /* Read Display Statu: RDDST */
#define ST7735_READ_POWER_MODE 0x0AU /* Read Display Power: RDDPM */
#define ST7735_READ_MADCTL 0x0BU /* Read Display: RDDMADCTL */
#define ST7735_READ_PIXEL_FORMAT 0x0CU /* Read Display Pixel: RDDCOLMOD */
#define ST7735_READ_PIXEL_FORMAT 0x0CU /* Read Display Pixel: RDDCOLMOD */
#define ST7735_READ_IMAGE_MODE 0x0DU /* Read Display Image: RDDIM */
#define ST7735_READ_SIGNAL_MODE 0x0EU /* Read Display Signal: RDDSM */
#define ST7735_SLEEP_IN 0x10U /* Sleep in & booster off: SLPIN */
#define ST7735_READ_SIGNAL_MODE 0x0EU /* Read Display Signal: RDDSM */
#define ST7735_SLEEP_IN 0x10U /* Sleep in & booster off: SLPIN */
#define ST7735_SLEEP_OUT 0x11U /* Sleep out & booster on: SLPOUT */
#define ST7735_PARTIAL_DISPLAY_ON 0x12U /* Partial mode on: PTLON */
#define ST7735_PARTIAL_DISPLAY_ON 0x12U /* Partial mode on: PTLON */
#define ST7735_NORMAL_DISPLAY_OFF 0x13U /* Partial off (Normal): NORON */
#define ST7735_DISPLAY_INVERSION_OFF 0x20U /* Display inversion off: INVOFF */
#define ST7735_DISPLAY_INVERSION_ON 0x21U /* Display inversion on: INVON */
#define ST7735_GAMMA_SET 0x26U /* Gamma curve select: GAMSET */
#define ST7735_DISPLAY_OFF 0x28U /* Display off: DISPOFF */
#define ST7735_DISPLAY_ON 0x29U /* Display on: DISPON */
#define ST7735_CASET 0x2AU /* Column address set: CASET */
#define ST7735_CASET 0x2AU /* Column address set: CASET */
#define ST7735_RASET 0x2BU /* Row address set: RASET */
#define ST7735_WRITE_RAM 0x2CU /* Memory write: RAMWR */
#define ST7735_WRITE_RAM 0x2CU /* Memory write: RAMWR */
#define ST7735_RGBSET 0x2DU /* LUT for 4k,65k,262k color: RGBSET */
#define ST7735_READ_RAM 0x2EU /* Memory read: RAMRD */
#define ST7735_PTLAR 0x30U /* Partial start/end address set: PTLAR */
#define ST7735_TE_LINE_OFF 0x34U /* Tearing effect line off: TEOFF */
#define ST7735_TE_LINE_ON 0x35U /* Tearing effect mode set & on: TEON */
#define ST7735_MADCTL 0x36U /* Memory data access control: MADCTL */
#define ST7735_IDLE_MODE_OFF 0x38U /* Idle mode off: IDMOFF */
#define ST7735_IDLE_MODE_ON 0x39U /* Idle mode on: IDMON */
#define ST7735_PTLAR 0x30U /* Partial start/end address set: PTLAR */
#define ST7735_TE_LINE_OFF 0x34U /* Tearing effect line off: TEOFF */
#define ST7735_TE_LINE_ON 0x35U /* Tearing effect mode set & on: TEON */
#define ST7735_MADCTL 0x36U /* Memory data access control: MADCTL */
#define ST7735_IDLE_MODE_OFF 0x38U /* Idle mode off: IDMOFF */
#define ST7735_IDLE_MODE_ON 0x39U /* Idle mode on: IDMON */
#define ST7735_COLOR_MODE 0x3AU /* Interface pixel format: COLMOD */
#define ST7735_FRAME_RATE_CTRL1 0xB1U /* In normal mode (Full colors): FRMCTR1 */
#define ST7735_FRAME_RATE_CTRL2 0xB2U /* In Idle mode (8-colors): FRMCTR2 */
#define ST7735_FRAME_RATE_CTRL2 0xB2U /* In Idle mode (8-colors): FRMCTR2 */
#define ST7735_FRAME_RATE_CTRL3 0xB3U /* In partial mode + Full colors: FRMCTR3 */
#define ST7735_FRAME_INVERSION_CTRL 0xB4U /* Display inversion control: INVCTR */
#define ST7735_DISPLAY_SETTING 0xB6U /* Display function setting */
#define ST7735_PWR_CTRL1 0xC0U /* Power control setting: PWCTR1 */
#define ST7735_PWR_CTRL2 0xC1U /* Power control setting: PWCTR2 */
#define ST7735_PWR_CTRL1 0xC0U /* Power control setting: PWCTR1 */
#define ST7735_PWR_CTRL2 0xC1U /* Power control setting: PWCTR2 */
#define ST7735_PWR_CTRL3 0xC2U /* In normal mode (Full colors): PWCTR3 */
#define ST7735_PWR_CTRL4 0xC3U /* In Idle mode (8-colors): PWCTR4 */
#define ST7735_PWR_CTRL4 0xC3U /* In Idle mode (8-colors): PWCTR4 */
#define ST7735_PWR_CTRL5 0xC4U /* In partial mode + Full colors: PWCTR5 */
#define ST7735_VCOMH_VCOML_CTRL1 0xC5U /* VCOM control 1: VMCTR1 */
#define ST7735_VMOF_CTRL 0xC7U /* Set VCOM offset control: VMOFCTR */
#define ST7735_WRID2 0xD1U /* Set LCM version code: WRID2 */
#define ST7735_WRID3 0xD2U /* Customer Project code: WRID3 */
#define ST7735_VCOMH_VCOML_CTRL1 0xC5U /* VCOM control 1: VMCTR1 */
#define ST7735_VMOF_CTRL 0xC7U /* Set VCOM offset control: VMOFCTR */
#define ST7735_WRID2 0xD1U /* Set LCM version code: WRID2 */
#define ST7735_WRID3 0xD2U /* Customer Project code: WRID3 */
#define ST7735_NV_CTRL1 0xD9U /* NVM control status: NVCTR1 */
#define ST7735_READ_ID1 0xDAU /* Read ID1: RDID1 */
#define ST7735_READ_ID2 0xDBU /* Read ID2: RDID2 */
#define ST7735_READ_ID3 0xDCU /* Read ID3: RDID3 */
#define ST7735_NV_CTRL2 0xDEU /* NVM Read Command: NVCTR2 */
#define ST7735_READ_ID1 0xDAU /* Read ID1: RDID1 */
#define ST7735_READ_ID2 0xDBU /* Read ID2: RDID2 */
#define ST7735_READ_ID3 0xDCU /* Read ID3: RDID3 */
#define ST7735_NV_CTRL2 0xDEU /* NVM Read Command: NVCTR2 */
#define ST7735_NV_CTRL3 0xDFU /* NVM Write Command: NVCTR3 */
#define ST7735_PV_GAMMA_CTRL 0xE0U /* Set Gamma adjustment (+ polarity): GAMCTRP1 */
#define ST7735_NV_GAMMA_CTRL 0xE1U /* Set Gamma adjustment (- polarity): GAMCTRN1 */
......@@ -107,10 +107,10 @@
/**
* @}
*/
/** @defgroup ST7735_REG_Exported_Types Exported Types
* @{
*/
*/
typedef int32_t (*ST7735_Write_Func)(void *, uint8_t, uint8_t*, uint32_t);
typedef int32_t (*ST7735_Read_Func) (void *, uint8_t, uint8_t*);
typedef int32_t (*ST7735_Send_Func) (void *, uint8_t*, uint32_t);
......@@ -121,7 +121,7 @@ typedef struct
ST7735_Write_Func WriteReg;
ST7735_Read_Func ReadReg;
ST7735_Send_Func SendData;
ST7735_Recv_Func RecvData;
ST7735_Recv_Func RecvData;
void *handle;
} st7735_ctx_t;
......@@ -131,7 +131,7 @@ typedef struct
/** @defgroup ST7735_REG_Exported_Functions Exported Functions
* @{
*/
*/
int32_t st7735_write_reg(st7735_ctx_t *ctx, uint8_t reg, uint8_t *pdata, uint32_t length);
int32_t st7735_read_reg(st7735_ctx_t *ctx, uint8_t reg, uint8_t *pdata);
int32_t st7735_send_data(st7735_ctx_t *ctx, uint8_t *pdata, uint32_t length);
......@@ -139,8 +139,8 @@ int32_t st7735_recv_data(st7735_ctx_t *ctx, uint8_t *pdata, uint32_t length);
/**
* @}
*/
*/
#ifdef __cplusplus
}
#endif
......@@ -149,14 +149,14 @@ int32_t st7735_recv_data(st7735_ctx_t *ctx, uint8_t *pdata, uint32_t length);
/**
* @}
*/
*/
/**
* @}
*/
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册