remotes/origin_old/ugfx_release_2.6
Tectu 2012-06-01 11:46:30 +02:00
parent 08511c7839
commit f96700a1fe
7 changed files with 14 additions and 17 deletions

0
fonts.c 100755 → 100644
View File

0
fonts.h 100755 → 100644
View File

8
glcd.c 100755 → 100644
View File

@ -69,16 +69,16 @@ static __inline uint16_t lcdReadReg(uint16_t lcdReg) {
}
uint16_t lcdGetHeight(void) {
if(orientation == portrait || orientation == portraitInv)
if(PORTRAIT)
return lcd_height;
else if(orientation == landscape || orientation == landscapeInv)
else if(LANDSCAPE)
return lcd_width;
}
uint16_t lcdGetWidth(void) {
if(orientation == portrait || orientation == portraitInv)
if(PORTRAIT)
return lcd_width;
else if(orientation == landscape || orientation == landscapeInv)
else if(LANDSCAPE)
return lcd_height;
}

3
glcd.h 100755 → 100644
View File

@ -7,6 +7,9 @@
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define PORTRAIT (orientation == portrait || orientation == portraitInv)
#define LANDSCAPE (orientation == landscape || orientation == landscapeInv)
/* uncomment if no board.h file used
#define LCD_DATA_PORT GPIOE
#define LCD_CMD_PORT GPIOD

1
lcd.mk
View File

@ -1,6 +1,7 @@
# LCD files.
LCDSRC = ${CHIBIOS}/ext/lcd/glcd.c \
${CHIBIOS}/ext/fonts.c \
${CHIBIOS}/ext/touchpad.c \
${CHIBIOS}/ext/graph.c
LCDINC = ${CHIBIOS}/ext/lcd

19
touchpad.c 100755 → 100644
View File

@ -1,4 +1,5 @@
#include "touchpad.h"
#include "glcd.h"
static void spicb(SPIDriver *spip);
static const SPIConfig spicfg = {
@ -12,18 +13,6 @@ void tpInit(void) {
spiStart(&SPID1, &spicfg);
}
void tpWriteData(uint8_t data) {
uint16_t tx = 0xAA;
SET_CS(0);
spiSend(&SPID1, 1, &tx);
SET_CS(1);
}
uint16_t tpReadData(void) {
}
uint16_t tpReadX(void) {
uint8_t txbuf[1];
uint8_t rxbuf[2];
@ -37,6 +26,8 @@ uint16_t tpReadX(void) {
x = rxbuf[0] << 4;
x |= rxbuf[1] >> 4;
x = (((lcdGetWidth()-1) * x)/2048);
return x;
}
@ -55,6 +46,8 @@ uint16_t tpReadY(void) {
y = rxbuf[0] << 4;
y |= rxbuf[1] >> 4;
return y;
y = (((lcdGetHeight()-1) * y)/2048);
return y;
}

0
touchpad.h 100755 → 100644
View File