added ssd1289_lld

This commit is contained in:
Tectu 2012-06-10 22:28:02 +02:00
parent 7122ec3d1c
commit b008620171
5 changed files with 92 additions and 43 deletions

View File

@ -0,0 +1,58 @@
#include "ssd1289_lld.h"
#ifdef LCD_USE_SSD1289
extern uint16_t lcd_width, lcd_height;
void lld_lcdWriteIndex(uint16_t index) {
Clr_RS;
Set_RD;
palWritePort(LCD_DATA_PORT, index);
Clr_WR;
Set_WR;
}
void lld_lcdWriteData(uint16_t data) {
Set_RS;
palWritePort(LCD_DATA_PORT, data);
Clr_WR;
Set_WR;
}
uint16_t lld_lcdReadData(void) {
uint16_t value;
Set_RS;
Set_WR;
Clr_RD;
// change pin mode to digital input
LCD_DATA_PORT->CRH = 0x44444444;
LCD_DATA_PORT->CRL = 0x44444444;
value = palReadPort(LCD_DATA_PORT); // dummy
value = palReadPort(LCD_DATA_PORT);
// change pin mode back to digital output
LCD_DATA_PORT->CRH = 0x33333333;
LCD_DATA_PORT->CRL = 0x33333333;
Set_RD;
return value;
}
uint16_t lld_lcdGetHeight(void) {
return lcd_height;
}
uint16_t lld_lcdGetWidth(void) {
return lcd_width;
}
#endif

View File

@ -0,0 +1,15 @@
#ifndef SSD1289_H
#define SSD1289_H
#include "glcd.h"
#ifndef LCD_USE_SSD1289
void lld_lcdWriteIndex(uint16_t index);
void lld_lcdWriteData(uint16_t data);
void lld_lcdWriteData(uint16_t data);
uint16_t lld_lcdGetHeight(void);
uint16_t lld_lcdGetWidth(void);
#endif
#endif

45
glcd.c
View File

@ -8,46 +8,15 @@ static uint8_t font_width = 8, font_height = 16;
uint16_t lcd_width, lcd_height;
static __inline void lcdWriteIndex(uint16_t index) {
Clr_RS;
Set_RD;
palWritePort(LCD_DATA_PORT, index);
Clr_WR;
Set_WR;
lld_lcdWriteIndex(index);
}
static __inline void lcdWriteData(uint16_t data) {
Set_RS;
palWritePort(LCD_DATA_PORT, data);
Clr_WR;
Set_WR;
lld_lcdWriteData(data);
}
static __inline uint16_t lcdReadData(void) {
uint16_t value;
Set_RS;
Set_WR;
Clr_RD;
// change pin mode to digital input
LCD_DATA_PORT->CRH = 0x44444444;
LCD_DATA_PORT->CRL = 0x44444444;
value = palReadPort(LCD_DATA_PORT); // dummy
value = palReadPort(LCD_DATA_PORT);
// change pin mode back to digital output
LCD_DATA_PORT->CRH = 0x33333333;
LCD_DATA_PORT->CRL = 0x33333333;
Set_RD;
return value;
return lld_lcdReadData();
}
static __inline void lcdWriteReg(uint16_t lcdReg,uint16_t lcdRegValue) {
@ -70,11 +39,11 @@ static __inline uint16_t lcdReadReg(uint16_t lcdReg) {
}
uint16_t lcdGetHeight(void) {
return lcd_height;
return lld_lcdGetHeight();
}
uint16_t lcdGetWidth(void) {
return lcd_width;
return lld_lcdGetWidth();
}
static void lcdSetCursor(uint16_t x, uint16_t y) {
@ -744,5 +713,9 @@ void lcdInit() {
lcdWriteReg(0x004e,0);
}
lcdDelay(5);
lcd_height = SCREEN_HEIGHT;
lcd_width = SCREEN_WIDTH;
}

5
glcd.h
View File

@ -1,8 +1,9 @@
#ifndef GLCD_H
#define GLCD_H
#include <ch.h>
#include <hal.h>
#include "ch.h"
#include "hal.h"
#include "drivers/ssd1289_lld.h"
#define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 320

12
lcd.mk
View File

@ -1,8 +1,10 @@
# LCD files.
LCDSRC = ${CHIBIOS}/ext/lcd/glcd.c \
${CHIBIOS}/ext/fonts.c \
${CHIBIOS}/ext/touchpad.c \
${CHIBIOS}/ext/graph.c \
${CHIBIOS}/ext/gui.c
${CHIBIOS}/ext/lcd/fonts.c \
${CHIBIOS}/ext/lcd/touchpad.c \
${CHIBIOS}/ext/lcd/graph.c \
${CHIBIOS}/ext/lcd/gui.c \
${CHIBIOS}/ext/lcd/drivers/ssd1289_lld.c
LCDINC = ${CHIBIOS}/ext/lcd
LCDINC = ${CHIBIOS}/ext/lcd \
${CHIBIOS}/etc/lcd/drivers