GPIO interfacing rewrite
This commit is contained in:
parent
ccf2780be9
commit
484daa395a
@ -8,13 +8,6 @@ extern uint16_t lcd_width, lcd_height;
|
||||
|
||||
#ifdef LCD_USE_GPIO
|
||||
|
||||
static __inline void lld_lcdWriteGPIO(uint16_t d) {
|
||||
palWriteGroup(LCD_DATA_PORT_1, PAL_GROUP_MASK(4), LCD_DATA_PORT_1_BASE, d >> 0);
|
||||
palWriteGroup(LCD_DATA_PORT_2, PAL_GROUP_MASK(4), LCD_DATA_PORT_2_BASE, d >> 4);
|
||||
palWriteGroup(LCD_DATA_PORT_3, PAL_GROUP_MASK(4), LCD_DATA_PORT_3_BASE, d >> 8);
|
||||
palWriteGroup(LCD_DATA_PORT_4, PAL_GROUP_MASK(4), LCD_DATA_PORT_4_BASE, d >> 12);
|
||||
}
|
||||
|
||||
static __inline void lld_lcdWriteIndex(uint16_t index) {
|
||||
Clr_RS;
|
||||
Set_RD;
|
||||
@ -48,16 +41,7 @@ static __inline uint16_t lld_lcdReadData(void) {
|
||||
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;
|
||||
value = lld_lcdReadGPIO(LCD_DATA_PORT);
|
||||
|
||||
Set_RD;
|
||||
|
||||
|
30
readme
30
readme
@ -4,32 +4,6 @@ Chibios LCD Driver
|
||||
cd chibios/ext
|
||||
git clone https://github.com/tectu/Chibios-LCD-Driver lcd
|
||||
|
||||
### Edit boardfiles:
|
||||
add the following to your board.h file, matching to your pinconfig:
|
||||
#define TP_PORT GPIOC
|
||||
#define TP_IRQ 4
|
||||
#define TP_CS 6
|
||||
|
||||
#define LCD_DATA_PORT_1 GPIOB
|
||||
#define LCD_DATA_PORT_2 GPIOB
|
||||
#define LCD_DATA_PORT_3 GPIOC
|
||||
#define LCD_DATA_PORT_4 GPIOE
|
||||
#define LCD_DATA_PORT_1_BASE 0
|
||||
#define LCD_DATA_PORT_2_BASE 4
|
||||
#define LCD_DATA_PORT_3_BASE 8
|
||||
#define LCD_DATA_PORT_4_BASE 12
|
||||
#define LCD_CMD_PORT GPIOD
|
||||
#define LCD_CS 12
|
||||
#define LCD_RS 13
|
||||
#define LCD_WR 14
|
||||
#define LCD_RD 15
|
||||
|
||||
in this example we use the following pin config for 16-bit GPIO interfacing:
|
||||
|
||||
GPIOB 8-15
|
||||
GPIOC 4-7
|
||||
GPIOE 0-3
|
||||
|
||||
### Edit Makefile:
|
||||
include lcd.mk:
|
||||
include $(CHIBIOS)/ext/lcd/lcd.mk
|
||||
@ -54,9 +28,7 @@ Add $(LCDINC) to INCDIR:
|
||||
$(CHIBIOS)/os/various ../common
|
||||
|
||||
### Use
|
||||
1. include header files wherever you need it.
|
||||
|
||||
2. select the controller type you want to use in glcdconf.h
|
||||
read here: http://chibios.org/dokuwiki/doku.php?id=chibios:community:introduction
|
||||
|
||||
### Maintainer & Contributors
|
||||
Contributors: - Badger
|
||||
|
Loading…
Reference in New Issue
Block a user