commit
90f5e85146
5 changed files with 137 additions and 12 deletions
|
@ -40,6 +40,8 @@
|
||||||
#include "gdisp_lld_board.h"
|
#include "gdisp_lld_board.h"
|
||||||
#elif defined(BOARD_OLIMEX_STM32_LCD)
|
#elif defined(BOARD_OLIMEX_STM32_LCD)
|
||||||
#include "gdisp_lld_board_olimex_stm32_lcd.h"
|
#include "gdisp_lld_board_olimex_stm32_lcd.h"
|
||||||
|
#elif defined(BOARD_OLIMEX_PIC32MX_LCD)
|
||||||
|
#include "gdisp_lld_board_olimex_pic32mx_lcd.h"
|
||||||
#else
|
#else
|
||||||
#include "gdisp_lld_board.h"
|
#include "gdisp_lld_board.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -94,9 +96,7 @@ static inline void lld_lcdWriteReg(uint16_t lcdReg, uint16_t lcdRegValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint16_t lld_lcdReadData(void) {
|
static inline uint16_t lld_lcdReadData(void) {
|
||||||
/* fix this! */
|
return gdisp_lld_read_data();
|
||||||
//return gdisp_lld_read_data;
|
|
||||||
return GDISP_RAM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint16_t lld_lcdReadReg(uint16_t lcdReg) {
|
static inline uint16_t lld_lcdReadReg(uint16_t lcdReg) {
|
||||||
|
|
114
drivers/gdisp/ILI9320/gdisp_lld_board_olimex_pic32mx_lcd.h
Normal file
114
drivers/gdisp/ILI9320/gdisp_lld_board_olimex_pic32mx_lcd.h
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/GFX - Copyright (C) 2013
|
||||||
|
Dmytro Milinevskyy <milinevskyy@gmail.com>
|
||||||
|
|
||||||
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
||||||
|
ChibiOS/GFX is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ChibiOS/GFX is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file drivers/gdisp/ILI9320/gdisp_lld_board_olimex_pic32mx_lcd.h
|
||||||
|
* @brief GDISP Graphic Driver subsystem board interface for the ILI9325 display.
|
||||||
|
*
|
||||||
|
* @addtogroup GDISP
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GDISP_LLD_BOARD_H
|
||||||
|
#define GDISP_LLD_BOARD_H
|
||||||
|
|
||||||
|
#ifndef noinline
|
||||||
|
#define noinline __attribute__((noinline))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void gdisp_lld_init_board(void) {
|
||||||
|
// RST
|
||||||
|
palSetPadMode(IOPORTA, 7, PAL_MODE_OUTPUT);
|
||||||
|
palClearPad(IOPORTA, 7);
|
||||||
|
|
||||||
|
// RS
|
||||||
|
palSetPadMode(IOPORTA, 10, PAL_MODE_OUTPUT);
|
||||||
|
palSetPad(IOPORTA, 10);
|
||||||
|
|
||||||
|
// CS
|
||||||
|
palSetPadMode(IOPORTA, 9, PAL_MODE_OUTPUT);
|
||||||
|
palClearPad(IOPORTA, 9);
|
||||||
|
|
||||||
|
// Backlight
|
||||||
|
palSetPadMode(IOPORTD, 3, PAL_MODE_OUTPUT);
|
||||||
|
palSetPad(IOPORTD, 3);
|
||||||
|
|
||||||
|
// PMP setup
|
||||||
|
PMMODE = 0;
|
||||||
|
PMAEN = 0;
|
||||||
|
PMCON = 0;
|
||||||
|
PMMODEbits.MODE = 2;
|
||||||
|
PMMODEbits.WAITB = 0;
|
||||||
|
PMMODEbits.WAITM = 1;
|
||||||
|
PMMODEbits.WAITE = 0;
|
||||||
|
PMCONbits.CSF = 0;
|
||||||
|
PMCONbits.PTRDEN = 1;
|
||||||
|
PMCONbits.PTWREN = 1;
|
||||||
|
PMMODEbits.MODE16 = 1;
|
||||||
|
PMCONbits.PMPEN = 1;
|
||||||
|
|
||||||
|
palClearPad(IOPORTA, 9);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define PmpWaitBusy() do {} while (PMMODEbits.BUSY)
|
||||||
|
|
||||||
|
static noinline void gdisp_lld_reset_pin(bool_t state) {
|
||||||
|
if (state)
|
||||||
|
palClearPad(IOPORTA, 7);
|
||||||
|
else
|
||||||
|
palSetPad(IOPORTA, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
static noinline void gdisp_lld_write_index(uint16_t data) {
|
||||||
|
PmpWaitBusy();
|
||||||
|
palClearPad(IOPORTA, 10);
|
||||||
|
PMDIN = data;
|
||||||
|
PmpWaitBusy();
|
||||||
|
palSetPad(IOPORTA, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
static noinline void gdisp_lld_write_data(uint16_t data) {
|
||||||
|
PMDIN = data;
|
||||||
|
PmpWaitBusy();
|
||||||
|
}
|
||||||
|
|
||||||
|
static noinline uint16_t gdisp_lld_read_data(void) {
|
||||||
|
PmpWaitBusy();
|
||||||
|
return PMDIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if not available, just ignore the argument and return */
|
||||||
|
static void gdisp_lld_backlight(uint8_t percentage) {
|
||||||
|
if (percentage)
|
||||||
|
palClearPad(IOPORTD, 3);
|
||||||
|
else
|
||||||
|
palSetPad(IOPORTD, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void acquire_bus(void) {
|
||||||
|
/* Nothing to do here since LCD is the only device on that bus */
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void release_bus(void) {
|
||||||
|
/* Nothing to do here since LCD is the only device on that bus */
|
||||||
|
}
|
||||||
|
#endif /* GDISP_LLD_BOARD_H */
|
||||||
|
/** @} */
|
||||||
|
|
|
@ -94,9 +94,7 @@ static inline void lld_lcdWriteReg(uint16_t lcdReg, uint16_t lcdRegValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint16_t lld_lcdReadData(void) {
|
static inline uint16_t lld_lcdReadData(void) {
|
||||||
/* fix this! */
|
return gdisp_lld_read_data();
|
||||||
//return gdisp_lld_read_data;
|
|
||||||
return GDISP_RAM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint16_t lld_lcdReadReg(uint16_t lcdReg) {
|
static inline uint16_t lld_lcdReadReg(uint16_t lcdReg) {
|
||||||
|
@ -153,6 +151,8 @@ bool_t gdisp_lld_init(void) {
|
||||||
gdisp_lld_reset_pin(FALSE);
|
gdisp_lld_reset_pin(FALSE);
|
||||||
lld_lcdDelay(1000);
|
lld_lcdDelay(1000);
|
||||||
|
|
||||||
|
DISPLAY_CODE = lld_lcdReadReg(0);
|
||||||
|
|
||||||
// chinese code starts here
|
// chinese code starts here
|
||||||
lld_lcdWriteReg(0x0000,0x0001);
|
lld_lcdWriteReg(0x0000,0x0001);
|
||||||
lld_lcdDelay(10);
|
lld_lcdDelay(10);
|
||||||
|
|
|
@ -45,6 +45,15 @@
|
||||||
#include "ginput_lld_mouse_board_example.h"
|
#include "ginput_lld_mouse_board_example.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(GINPUT_MOUSE_YX_INVERTED) && GINPUT_MOUSE_YX_INVERTED
|
||||||
|
#define CMD_X 0x91
|
||||||
|
#define CMD_Y 0xD1
|
||||||
|
#else
|
||||||
|
#define CMD_X 0xD1
|
||||||
|
#define CMD_Y 0x91
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static uint16_t sampleBuf[7];
|
static uint16_t sampleBuf[7];
|
||||||
static coord_t lastx, lasty;
|
static coord_t lastx, lasty;
|
||||||
|
|
||||||
|
@ -115,18 +124,18 @@ void ginput_lld_mouse_get_reading(MouseReading *pt) {
|
||||||
* Finally switch on PENIRQ once again - perform a dummy read.
|
* Finally switch on PENIRQ once again - perform a dummy read.
|
||||||
* Once we have the readings, find the medium using our filter function
|
* Once we have the readings, find the medium using our filter function
|
||||||
*/
|
*/
|
||||||
read_value(0xD1);
|
read_value(CMD_X);
|
||||||
for(i = 0; i < 7; i++)
|
for(i = 0; i < 7; i++)
|
||||||
sampleBuf[i] = read_value(0xD1);
|
sampleBuf[i] = read_value(CMD_X);
|
||||||
read_value(0xD0);
|
read_value(CMD_X-1);
|
||||||
filter();
|
filter();
|
||||||
lastx = (coord_t)sampleBuf[3];
|
lastx = (coord_t)sampleBuf[3];
|
||||||
|
|
||||||
/* Get the Y value using the same process as above */
|
/* Get the Y value using the same process as above */
|
||||||
read_value(0x91);
|
read_value(CMD_Y);
|
||||||
for(i = 0; i < 7; i++)
|
for(i = 0; i < 7; i++)
|
||||||
sampleBuf[i] = read_value(0x91);
|
sampleBuf[i] = read_value(CMD_Y);
|
||||||
read_value(0x90);
|
read_value(CMD_Y-1);
|
||||||
filter();
|
filter();
|
||||||
lasty = (coord_t)sampleBuf[3];
|
lasty = (coord_t)sampleBuf[3];
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ FEATURE: Added arrow button style to GWIN buttons
|
||||||
FEATURE: Added the ability to specify a custom button drawing routine
|
FEATURE: Added the ability to specify a custom button drawing routine
|
||||||
FEATURE: SSD1963 rework by username 'fred'
|
FEATURE: SSD1963 rework by username 'fred'
|
||||||
FEATURE: Added Picture converter tool
|
FEATURE: Added Picture converter tool
|
||||||
|
FEATURE: Added slider widget
|
||||||
|
FEATURE: Added gwinDraw() routine
|
||||||
|
|
||||||
|
|
||||||
*** changes after 1.4 ***
|
*** changes after 1.4 ***
|
||||||
|
|
Loading…
Add table
Reference in a new issue