This commit is contained in:
Tectu 2012-05-23 16:10:03 +02:00
parent 0eea8db0f3
commit 94322d769e
2 changed files with 16 additions and 16 deletions

16
glcd.c
View File

@ -8,7 +8,7 @@ static __inline void lcdWriteIndex(uint16_t index) {
Clr_Rs; Clr_Rs;
Set_nRd; Set_nRd;
palWritePort(LCD_PORT, index); LCD_DATA_PORT->ODR = index;
Clr_nWr; Clr_nWr;
Set_nWr; Set_nWr;
@ -17,7 +17,7 @@ static __inline void lcdWriteIndex(uint16_t index) {
static __inline void lcdWriteData(uint16_t data) { static __inline void lcdWriteData(uint16_t data) {
Set_Rs; Set_Rs;
palWritePort(LCD_PORT, data); LCD_DATA_PORT->ODR = data;
Clr_nWr; Clr_nWr;
Set_nWr; Set_nWr;
@ -31,15 +31,15 @@ static __inline uint16_t lcdReadData(void) {
Clr_nRd; Clr_nRd;
// change pin mode to digital input // change pin mode to digital input
LCD_PORT->CRH = 0x44444444; LCD_DATA_PORT->CRH = 0x44444444;
LCD_PORT->CRL = 0x44444444; LCD_DATA_PORT->CRL = 0x44444444;
value = LCD_PORT->IDR; value = LCD_DATA_PORT->IDR;
value = LCD_PORT->IDR; value = LCD_DATA_PORT->IDR;
// change pin mode back to digital output // change pin mode back to digital output
LCD_PORT->CRH = 0x33333333; LCD_DATA_PORT->CRH = 0x33333333;
LCD_PORT->CRL = 0x33333333; LCD_DATA_PORT->CRL = 0x33333333;
Set_nRd; Set_nRd;

16
glcd.h
View File

@ -7,14 +7,14 @@
#define SCREEN_WIDTH 320 #define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240 #define SCREEN_HEIGHT 240
#define Set_Cs LCD_PORT->ODR |= ( 1<<12 ); #define Set_Cs LCD_CMD_PORT->ODR |= (1 << GPIOD_LCD_CS);
#define Clr_Cs LCD_PORT->ODR &= ~( 1<<12 ); #define Clr_Cs LCD_CMD_PORT->ODR &= ~(1 << GPIOD_LCD_CS);
#define Set_Rs LCD_PORT->ODR |= ( 1<<13 ); #define Set_Rs LCD_CMD_PORT->ODR |= (1 << GPIOD_LCD_RS);
#define Clr_Rs LCD_PORT->ODR &= ~( 1<<13 ); #define Clr_Rs LCD_CMD_PORT->ODR &= ~(1 << GPIOD_LCD_RS);
#define Set_nWr LCD_PORT->ODR |= ( 1<<14 ); #define Set_nWr LCD_CMD_PORT->ODR |= (1 << GPIOD_LCD_WR);
#define Clr_nWr LCD_PORT->ODR &= ~( 1<<14 ); #define Clr_nWr LCD_CMD_PORT->ODR &= ~(1 << GPIOD_LCD_WR);
#define Set_nRd LCD_PORT->ODR |= ( 1<<15 ); #define Set_nRd LCD_CMD_PORT->ODR |= (1 << GPIOD_LCD_RD);
#define Clr_nRd LCD_PORT->ODR &= ~( 1<<15 ); #define Clr_nRd LCD_CMD_PORT->ODR &= ~(1 << GPIOD_LCD_RD);
/* LCD color */ /* LCD color */
#define White 0xFFFF #define White 0xFFFF