Skip to content

Commit a3d1fac

Browse files
author
unknown
committed
added Renesas R63400 library
1 parent 05647ab commit a3d1fac

File tree

9 files changed

+2228
-0
lines changed

9 files changed

+2228
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ All libraries depends on lib_STM32F10x_StdPeriph.
1818
* <b>lib_MFRC522</b> - RFID Chip MFRC522 driver. Depends on lib_delay.
1919
* <b>lib_PCF8833</b> - Philips PCF8833 LCD library (Nokia 3100,6100,6020,6030). Depends on lib_delay.
2020
* <b>lib_R61523</b> - Renesas R61523 LCD library (Sony Ericsson U5 Vivaz). Depends on lib_delay.
21+
* <b>lib_R63400</b> - Renesas R63400 LCD library (Sony Ericsson K800i). Depends on lib_delay.
2122
* <b>lib_S6B33BG</b> - Samsung S6B33BG LCD library (Samsung GT-E1050). Depends on lib_delay.
2223
* <b>lib_rtc</b> - RTC
2324
* <b>lib_SD_FatFs</b> - FatFs lower layer API (SD support). Depends on lib_FatFs,lib_rtc,lib_SD_SDIO.

lib_R63400/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# README #
2+
3+
* lib_R63400
4+
5+
Renesas R63400 LCD library. Depends on lib_delay.
6+
Tested with Sony Ericsson K800i LCD.
7+
Standard LCD size is 320x240. Connected through 8bit FSMC peripheral.
8+
Supports 16bit and 18bit color, landscape and portrait orientation.
9+
10+
### How do I get set up? ###
11+
12+
See code example below
13+
14+
### Usage example ###
15+
```C
16+
...
17+
R63400_Init(0,2);// FSMC write/read timings
18+
19+
R63400_ColorMode(COLOR_18BIT);
20+
R63400_OrientationMode(ORIENTATION_PORTRAIT);
21+
R63400_ClearScreen(BLACK);
22+
...
23+
```

lib_R63400/inc/R63400.h

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
/*
2+
* R63400.h
3+
*
4+
* Library for Renesas R63400.
5+
* Tested with LCD from Sony Ericsson K800i mobile phone.
6+
*
7+
* Author: Kestutis Bivainis
8+
*
9+
*/
10+
#ifndef R63400_H
11+
#define R63400_H
12+
13+
#include "stm32f10x_conf.h"
14+
15+
typedef enum _COLOR_MODE {
16+
COLOR_16BIT = 0x0000,// 2 bytes/px (RRRRRGGG GGGBBBBB)
17+
COLOR_18BIT = 0xE000 // 3 bytes/px (RRRRRRxx GGGGGGxx BBBBBBxx)
18+
} COLOR_MODE;
19+
20+
typedef enum _ORIENTATION_MODE {
21+
ORIENTATION_PORTRAIT = 0x0000,
22+
ORIENTATION_LANDSCAPE = 0x0018,
23+
ORIENTATION_PORTRAIT_REV = 0x0030,
24+
ORIENTATION_LANDSCAPE_REV = 0x0028
25+
} ORIENTATION_MODE;
26+
27+
typedef enum _FONT_SIZE {
28+
FONT_6x8 = 0,
29+
FONT_8x8 = 1,
30+
FONT_8x14 = 2
31+
} FONT_SIZE;
32+
33+
enum COMMANDS {
34+
ENTRY_MODE = 0x0003,
35+
DISPLAY_CONTROL_1 = 0x0007,
36+
GRAM_ADDRESS_HORZ = 0x0200,
37+
GRAM_ADDRESS_VERT = 0x0201,
38+
MEMORY_READ_WRITE = 0x0202,
39+
WINDOW_HORZ_START = 0x0210,
40+
WINDOW_HORZ_END = 0x0211,
41+
WINDOW_VERT_START = 0x0212,
42+
WINDOW_VERT_END = 0x0213,
43+
};
44+
45+
enum {
46+
R63400_OK = 1,
47+
R63400_ERROR = 0
48+
};
49+
50+
#define DB0_Pin GPIO_Pin_14
51+
#define DB0_Speed GPIO_Speed_50MHz
52+
#define DB0_Mode GPIO_Mode_AF_PP
53+
#define DB0_Port GPIOD
54+
#define DB0_Bus RCC_APB2Periph_GPIOD
55+
56+
#define DB1_Pin GPIO_Pin_15
57+
#define DB1_Speed GPIO_Speed_50MHz
58+
#define DB1_Mode GPIO_Mode_AF_PP
59+
#define DB1_Port GPIOD
60+
#define DB1_Bus RCC_APB2Periph_GPIOD
61+
62+
#define DB2_Pin GPIO_Pin_0
63+
#define DB2_Speed GPIO_Speed_50MHz
64+
#define DB2_Mode GPIO_Mode_AF_PP
65+
#define DB2_Port GPIOD
66+
#define DB2_Bus RCC_APB2Periph_GPIOD
67+
68+
#define DB3_Pin GPIO_Pin_1
69+
#define DB3_Speed GPIO_Speed_50MHz
70+
#define DB3_Mode GPIO_Mode_AF_PP
71+
#define DB3_Port GPIOD
72+
#define DB3_Bus RCC_APB2Periph_GPIOD
73+
74+
#define DB4_Pin GPIO_Pin_7
75+
#define DB4_Speed GPIO_Speed_50MHz
76+
#define DB4_Mode GPIO_Mode_AF_PP
77+
#define DB4_Port GPIOE
78+
#define DB4_Bus RCC_APB2Periph_GPIOE
79+
80+
#define DB5_Pin GPIO_Pin_8
81+
#define DB5_Speed GPIO_Speed_50MHz
82+
#define DB5_Mode GPIO_Mode_AF_PP
83+
#define DB5_Port GPIOE
84+
#define DB5_Bus RCC_APB2Periph_GPIOE
85+
86+
#define DB6_Pin GPIO_Pin_9
87+
#define DB6_Speed GPIO_Speed_50MHz
88+
#define DB6_Mode GPIO_Mode_AF_PP
89+
#define DB6_Port GPIOE
90+
#define DB6_Bus RCC_APB2Periph_GPIOE
91+
92+
#define DB7_Pin GPIO_Pin_10
93+
#define DB7_Speed GPIO_Speed_50MHz
94+
#define DB7_Mode GPIO_Mode_AF_PP
95+
#define DB7_Port GPIOE
96+
#define DB7_Bus RCC_APB2Periph_GPIOE
97+
98+
#define RW_Pin GPIO_Pin_5
99+
#define RW_Speed GPIO_Speed_50MHz
100+
#define RW_Mode GPIO_Mode_AF_PP
101+
#define RW_Port GPIOD
102+
#define RW_Bus RCC_APB2Periph_GPIOD
103+
104+
#define RD_Pin GPIO_Pin_4
105+
#define RD_Speed GPIO_Speed_50MHz
106+
#define RD_Mode GPIO_Mode_AF_PP
107+
#define RD_Port GPIOD
108+
#define RD_Bus RCC_APB2Periph_GPIOD
109+
110+
#define RS_Pin GPIO_Pin_11
111+
#define RS_Speed GPIO_Speed_50MHz
112+
#define RS_Mode GPIO_Mode_AF_PP
113+
#define RS_Port GPIOD
114+
#define RS_Bus RCC_APB2Periph_GPIOD
115+
116+
#define CS_Pin GPIO_Pin_7
117+
#define CS_Speed GPIO_Speed_50MHz
118+
#define CS_Mode GPIO_Mode_AF_PP
119+
#define CS_Port GPIOD
120+
#define CS_Bus RCC_APB2Periph_GPIOD
121+
122+
#define RST_Pin GPIO_Pin_1
123+
#define RST_Speed GPIO_Speed_50MHz
124+
#define RST_Mode GPIO_Mode_Out_PP
125+
#define RST_Port GPIOE
126+
#define RST_Bus RCC_APB2Periph_GPIOE
127+
128+
typedef struct _PIN {
129+
GPIO_InitTypeDef GPIO_InitStructure;
130+
GPIO_TypeDef* GPIOx;
131+
uint32_t GPIO_Bus;
132+
} PIN;
133+
134+
135+
#define LCD_REG8 (*((volatile uint8_t*)0x60000000))
136+
#define LCD_DAT8 (*((volatile uint8_t*)0x60010000))
137+
138+
uint8_t R63400_Init(uint8_t AddressSetupTime,uint8_t DataSetupTime);
139+
void R63400_ColorMode(COLOR_MODE color_mode);
140+
void R63400_OrientationMode(ORIENTATION_MODE orientation_mode);
141+
142+
void R63400_ClearScreen(uint32_t color);
143+
void R63400_SetPixel(uint16_t x, uint16_t y, uint32_t color);
144+
void R63400_FillPixel(uint16_t x0,uint16_t y0,uint16_t x1,uint16_t y1,uint32_t *color);
145+
void R63400_FillFromBuffer(uint16_t x0,uint16_t y0,uint16_t x1,uint16_t y1,uint8_t *data);
146+
void R63400_Fill(uint16_t x0,uint16_t y0,uint16_t x1,uint16_t y1,uint32_t color);
147+
148+
void R63400_Shutdown(void);
149+
150+
void R63400_SetWindow(uint16_t x0,uint16_t y0,uint16_t x1,uint16_t y1);
151+
152+
uint16_t R63400_GetWidth(void);
153+
uint16_t R63400_GetHeight(void);
154+
155+
void R63400_SetFont(FONT_SIZE font_size);
156+
void R63400_SetTextColors(uint32_t fColor, uint32_t bColor);
157+
void R63400_PutChar(char c, uint16_t x, uint16_t y);
158+
void R63400_PutStr(char *pString, uint16_t x, uint16_t y);
159+
void R63400_PutStrCEOL(char *pString, uint16_t x, uint16_t y);
160+
void R63400_PutStrCentered(char *pString, uint16_t y);
161+
162+
void R63400_ReadMemory(uint16_t x0,uint16_t y0,uint16_t x1,uint16_t y1,uint16_t *buf);
163+
uint16_t R63400_ReadID(void);
164+
165+
#endif

0 commit comments

Comments
 (0)