commit
f91aeb4c4d
47 changed files with 306 additions and 276 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
@ -237,20 +237,39 @@ static void lld_lcdSetCursor(uint16_t x, uint16_t y) {
|
||||||
|
|
||||||
addr = y * 0x100 + x;
|
addr = y * 0x100 + x;
|
||||||
|
|
||||||
lld_lcdWriteReg(0x0020, addr & 0xff); /* low addr */
|
switch(GDISP.Orientation) {
|
||||||
lld_lcdWriteReg(0x0021, (addr >> 8) & 0x1ff); /* high addr */
|
case GDISP_ROTATE_0:
|
||||||
|
lld_lcdWriteReg(0x0020, addr & 0xff); /* low addr */
|
||||||
|
lld_lcdWriteReg(0x0021, (addr >> 8) & 0x1ff); /* high addr */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GDISP_ROTATE_90:
|
||||||
|
lld_lcdWriteReg(0x0020, (addr >> 8) & 0x1ff); /* low addr */
|
||||||
|
lld_lcdWriteReg(0x0021, addr & 0xff); /* high addr */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GDISP_ROTATE_180:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GDISP_ROTATE_270:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) {
|
static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) {
|
||||||
switch(GDISP.Orientation) {
|
switch(GDISP.Orientation) {
|
||||||
case GDISP_ROTATE_0:
|
case GDISP_ROTATE_0:
|
||||||
lld_lcdWriteReg(0x0050, x - 1);
|
lld_lcdWriteReg(0x0050, x);
|
||||||
lld_lcdWriteReg(0x0051, x + cx - 2);
|
lld_lcdWriteReg(0x0051, x + cx - 1);
|
||||||
lld_lcdWriteReg(0x0052, y - 1);
|
lld_lcdWriteReg(0x0052, y);
|
||||||
lld_lcdWriteReg(0x0053, y + cy - 2);
|
lld_lcdWriteReg(0x0053, y + cy - 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GDISP_ROTATE_90:
|
case GDISP_ROTATE_90:
|
||||||
|
lld_lcdWriteReg(0x0050, y);
|
||||||
|
lld_lcdWriteReg(0x0051, y + cy - 1);
|
||||||
|
lld_lcdWriteReg(0x0052, x);
|
||||||
|
lld_lcdWriteReg(0x0053, x + cx - 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GDISP_ROTATE_180:
|
case GDISP_ROTATE_180:
|
||||||
|
@ -265,7 +284,16 @@ static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy)
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void lld_lcdResetViewPort(void) {
|
static __inline void lld_lcdResetViewPort(void) {
|
||||||
/* ToDo */
|
switch(GDISP.Orientation) {
|
||||||
|
case GDISP_ROTATE_0:
|
||||||
|
case GDISP_ROTATE_180:
|
||||||
|
lld_lcdSetViewPort(0, 0, GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT);
|
||||||
|
break;
|
||||||
|
case GDISP_ROTATE_90:
|
||||||
|
case GDISP_ROTATE_270:
|
||||||
|
lld_lcdSetViewPort(0, 0, GDISP_SCREEN_HEIGHT, GDISP_SCREEN_WIDTH);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
|
@ -479,20 +507,20 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
GDISP.Powermode = (gdisp_powermode_t)value;
|
GDISP.Powermode = (gdisp_powermode_t)value;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if 0
|
|
||||||
// NOT IMPLEMENTED YET
|
|
||||||
case GDISP_CONTROL_ORIENTATION:
|
case GDISP_CONTROL_ORIENTATION:
|
||||||
if(GDISP.Orientation == (gdisp_orientation_t)value)
|
if(GDISP.Orientation == (gdisp_orientation_t)value)
|
||||||
return;
|
return;
|
||||||
switch((gdisp_orientation_t)value) {
|
switch((gdisp_orientation_t)value) {
|
||||||
case GDISP_ROTATE_0:
|
case GDISP_ROTATE_0:
|
||||||
/* ToDo */
|
lld_lcdWriteReg(0x0001, 0x0100);
|
||||||
|
lld_lcdWriteReg(0x0003, 0x1038);
|
||||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GDISP_ROTATE_90:
|
case GDISP_ROTATE_90:
|
||||||
/* ToDo */
|
lld_lcdWriteReg(0x0001, 0x0000);
|
||||||
|
lld_lcdWriteReg(0x0003, 0x1030);
|
||||||
GDISP.Height = GDISP_SCREEN_WIDTH;
|
GDISP.Height = GDISP_SCREEN_WIDTH;
|
||||||
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
||||||
break;
|
break;
|
||||||
|
@ -521,7 +549,6 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
#endif
|
#endif
|
||||||
GDISP.Orientation = (gdisp_orientation_t)value;
|
GDISP.Orientation = (gdisp_orientation_t)value;
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
|
|
||||||
case GDISP_CONTROL_BACKLIGHT:
|
case GDISP_CONTROL_BACKLIGHT:
|
||||||
if((unsigned)value > 100) value = (void *)100;
|
if((unsigned)value > 100) value = (void *)100;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
@ -44,8 +44,7 @@ static __inline void GDISP_LLD(init_board)(void) {
|
||||||
palSetPadMode(GPIOE, GPIOE_TFT_RST, PAL_MODE_OUTPUT_PUSHPULL);
|
palSetPadMode(GPIOE, GPIOE_TFT_RST, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
palSetPadMode(GPIOD, GPIOD_TFT_LIGHT, PAL_MODE_OUTPUT_PUSHPULL);
|
palSetPadMode(GPIOD, GPIOD_TFT_LIGHT, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
|
||||||
/* const unsigned char FSMC_Bank = 0; */
|
const unsigned char FSMC_Bank = 0;
|
||||||
const unsigned char FSMC_Bank = 6;
|
|
||||||
|
|
||||||
/* FSMC timing */
|
/* FSMC timing */
|
||||||
FSMC_Bank1->BTCR[FSMC_Bank+1] = (6) | (10 << 8) | (10 << 16);
|
FSMC_Bank1->BTCR[FSMC_Bank+1] = (6) | (10 << 8) | (10 << 16);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file drivers/ginput/togglePal/ginput_lld_toggle.c
|
* @file drivers/ginput/toggle/Pal/ginput_lld_toggle.c
|
||||||
* @brief GINPUT Toggle low level driver source for the ChibiOS PAL hardware.
|
* @brief GINPUT Toggle low level driver source for the ChibiOS PAL hardware.
|
||||||
*
|
*
|
||||||
* @addtogroup GINPUT_TOGGLE
|
* @addtogroup GINPUT_TOGGLE
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file drivers/ginput/togglePal/ginput_lld_toggle_board_example.h
|
* @file drivers/ginput/toggle/Pal/ginput_lld_toggle_board_example.h
|
||||||
* @brief GINPUT Toggle low level driver source for the ChibiOS PAL hardware on the example board.
|
* @brief GINPUT Toggle low level driver source for the ChibiOS PAL hardware on the example board.
|
||||||
*
|
*
|
||||||
* @addtogroup GINPUT_TOGGLE
|
* @addtogroup GINPUT_TOGGLE
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file drivers/ginput/togglePal/ginput_lld_toggle_board_olimexsam7ex256.h
|
* @file drivers/ginput/toggle/Pal/ginput_lld_toggle_board_olimexsam7ex256.h
|
||||||
* @brief GINPUT Toggle low level driver source for the ChibiOS PAL hardware on the Olimex SAM7EX256 board.
|
* @brief GINPUT Toggle low level driver source for the ChibiOS PAL hardware on the Olimex SAM7EX256 board.
|
||||||
*
|
*
|
||||||
* @addtogroup GINPUT_TOGGLE
|
* @addtogroup GINPUT_TOGGLE
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file drivers/ginput/togglePal/ginput_lld_toggle_config.h
|
* @file drivers/ginput/toggle/Pal/ginput_lld_toggle_config.h
|
||||||
* @brief GINPUT Toggle Driver configuration header.
|
* @brief GINPUT Toggle Driver configuration header.
|
||||||
*
|
*
|
||||||
* @addtogroup GDISP
|
* @addtogroup GDISP
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
@ -31,15 +31,17 @@
|
||||||
|
|
||||||
#if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE) /*|| defined(__DOXYGEN__)*/
|
#if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE) /*|| defined(__DOXYGEN__)*/
|
||||||
|
|
||||||
|
#include "gdisp.h" /* for coord_t */
|
||||||
|
#include "gevent.h"
|
||||||
|
#include "ginput/ginput_mouse.h" /* for GINPUT_TOUCH_PRESSED */
|
||||||
#include "lld/ginput/mouse.h"
|
#include "lld/ginput/mouse.h"
|
||||||
|
|
||||||
#if defined(GINPUT_MOUSE_USE_CUSTOM_BOARD) && GINPUT_MOUSE_USE_CUSTOM_BOARD
|
#if defined(GINPUT_MOUSE_USE_CUSTOM_BOARD) && GINPUT_MOUSE_USE_CUSTOM_BOARD
|
||||||
/* Include the user supplied board definitions */
|
|
||||||
#include "ginput_lld_mouse_board.h"
|
#include "ginput_lld_mouse_board.h"
|
||||||
//#elif defined(BOARD_OLIMEX_SAM7_EX256)
|
#elif defined(BOARD_FIREBULL_STM32_F103)
|
||||||
// #include "ginput_lld_mouse_board_olimexsam7ex256.h"
|
#include "ginput_lld_mouse_board_firebull_stm32f103.h"
|
||||||
#else
|
#else
|
||||||
#include "ginput_lld_mouse_board.h"
|
#include "ginput_lld_mouse_board_example.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint16_t sampleBuf[7];
|
static uint16_t sampleBuf[7];
|
||||||
|
@ -92,6 +94,8 @@ void ginput_lld_mouse_init(void) {
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
void ginput_lld_mouse_get_reading(MouseReading *pt) {
|
void ginput_lld_mouse_get_reading(MouseReading *pt) {
|
||||||
|
uint16_t i;
|
||||||
|
|
||||||
// If touch-off return the previous results
|
// If touch-off return the previous results
|
||||||
if (!getpin_pressed()) {
|
if (!getpin_pressed()) {
|
||||||
pt->x = lastx;
|
pt->x = lastx;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
@ -19,8 +19,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_unknown.h
|
* @file drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_example.h
|
||||||
* @brief GINPUT Touch low level driver source for the ADS7843 on some unknown board.
|
* @brief GINPUT Touch low level driver source for the ADS7843 on the example board.
|
||||||
*
|
*
|
||||||
* @addtogroup GINPUT_MOUSE
|
* @addtogroup GINPUT_MOUSE
|
||||||
* @{
|
* @{
|
||||||
|
@ -29,13 +29,20 @@
|
||||||
#ifndef _GINPUT_LLD_MOUSE_BOARD_H
|
#ifndef _GINPUT_LLD_MOUSE_BOARD_H
|
||||||
#define _GINPUT_LLD_MOUSE_BOARD_H
|
#define _GINPUT_LLD_MOUSE_BOARD_H
|
||||||
|
|
||||||
|
static const SPIConfig spicfg = {
|
||||||
|
NULL,
|
||||||
|
GPIOC,
|
||||||
|
6,
|
||||||
|
/* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialise the board for the touch.
|
* @brief Initialise the board for the touch.
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
static __inline void init_board(void) {
|
static __inline void init_board(void) {
|
||||||
spiStart(TOUCH_SPIDriver, TOUCH_SPIConfig);
|
spiStart(&SPID1, &spicfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,21 +52,17 @@ static __inline void init_board(void) {
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
static __inline bool_t getpin_pressed(void) {
|
static __inline bool_t getpin_pressed(void) {
|
||||||
return !palReadPad(TOUCH_PressedPort, TOUCH_PressedPin);
|
return (!palReadPad(GPIOC, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Aquire the bus ready for readings
|
* @brief Aquire the bus ready for readings
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
static __inline void aquire_bus(void) {
|
static __inline void aquire_bus(void) {
|
||||||
#if defined(SPI_USE_MUTUAL_EXCLUSION)
|
spiAcquireBus(&SPID1);
|
||||||
spiAcquireBus(TOUCH_SPIDriver);
|
//TOUCHSCREEN_SPI_PROLOGUE();
|
||||||
#endif
|
palClearPad(GPIOC, 6);
|
||||||
|
|
||||||
GINPUT_TOUCH_SPI_PROLOGUE();
|
|
||||||
palClearPad(TOUCH_SPIConfig->ssport, TOUCH_SPIConfig->sspad);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,12 +71,9 @@ static __inline void aquire_bus(void) {
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
static __inline void release_bus(void) {
|
static __inline void release_bus(void) {
|
||||||
palSetPad(TOUCH_SPIConfig->ssport, TOUCH_SPIConfig->sspad);
|
palSetPad(GPIOC, 6);
|
||||||
GINPUT_TOUCH_SPI_EPILOGUE();
|
spiReleaseBus(&SPID1);
|
||||||
|
//TOUCHSCREEN_SPI_EPILOGUE();
|
||||||
#if defined(SPI_USE_MUTUAL_EXCLUSION)
|
|
||||||
spiReleaseBus(tsDriver->spip);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,12 +85,17 @@ static __inline void release_bus(void) {
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
static __inline uint16_t read_value(uint16_t port) {
|
static __inline uint16_t read_value(uint16_t port) {
|
||||||
static uint8_t txbuf[3] = {0};
|
static uint8_t txbuf[3] = {0};
|
||||||
static uint8_t rxbuf[3] = {0};
|
static uint8_t rxbuf[3] = {0};
|
||||||
|
uint16_t ret;
|
||||||
|
|
||||||
txbuf[0] = cmd;
|
txbuf[0] = port;
|
||||||
spiExchange(TOUCH_SPIDriver, 3, txbuf, rxbuf);
|
|
||||||
return (rxbuf[1] << 5) | (rxbuf[2] >> 3);
|
spiExchange(&SPID1, 3, txbuf, rxbuf);
|
||||||
|
|
||||||
|
ret = (rxbuf[1] << 5) | (rxbuf[2] >> 3);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
|
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
|
|
@ -30,7 +30,7 @@
|
||||||
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
||||||
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
||||||
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
||||||
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 2
|
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 4
|
||||||
#define GINPUT_MOUSE_READ_CYCLES 4
|
#define GINPUT_MOUSE_READ_CYCLES 4
|
||||||
#define GINPUT_MOUSE_POLL_PERIOD 100
|
#define GINPUT_MOUSE_POLL_PERIOD 100
|
||||||
#define GINPUT_MOUSE_MAX_CLICK_JITTER 2
|
#define GINPUT_MOUSE_MAX_CLICK_JITTER 2
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
@ -31,13 +31,15 @@
|
||||||
|
|
||||||
#if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE) /*|| defined(__DOXYGEN__)*/
|
#if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE) /*|| defined(__DOXYGEN__)*/
|
||||||
|
|
||||||
#include "lld/ginput/touch.h"
|
#include "gdisp.h" /* for coord_t */
|
||||||
|
#include "gevent.h"
|
||||||
|
#include "ginput/ginput_mouse.h" /* for GINPUT_TOUCH_PRESSED */
|
||||||
|
#include "lld/ginput/mouse.h"
|
||||||
|
|
||||||
#if defined(GINPUT_MOUSE_USE_CUSTOM_BOARD) && GINPUT_MOUSE_USE_CUSTOM_BOARD
|
#if defined(GINPUT_MOUSE_USE_CUSTOM_BOARD) && GINPUT_MOUSE_USE_CUSTOM_BOARD
|
||||||
/* Include the user supplied board definitions */
|
|
||||||
#include "ginput_lld_mouse_board.h"
|
#include "ginput_lld_mouse_board.h"
|
||||||
//#elif defined(BOARD_OLIMEX_SAM7_EX256)
|
#elif defined(BOARD_OLIMEX_STM32_LCD)
|
||||||
// #include "ginput_lld_mouse_board_olimexsam7ex256.h"
|
#include "ginput_lld_mouse_board_olimex_stm32_lcd.h"
|
||||||
#else
|
#else
|
||||||
#include "ginput_lld_mouse_board.h"
|
#include "ginput_lld_mouse_board.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -92,6 +94,8 @@ void ginput_lld_mouse_init(void) {
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
void ginput_lld_mouse_get_reading(MouseReading *pt) {
|
void ginput_lld_mouse_get_reading(MouseReading *pt) {
|
||||||
|
uint16_t i;
|
||||||
|
|
||||||
// If touch-off return the previous results
|
// If touch-off return the previous results
|
||||||
if (!getpin_pressed()) {
|
if (!getpin_pressed()) {
|
||||||
pt->x = lastx;
|
pt->x = lastx;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
|
@ -0,0 +1,163 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
|
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/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h
|
||||||
|
* @brief GINPUT Touch low level driver source for the MCU on the example board.
|
||||||
|
*
|
||||||
|
* @addtogroup GINPUT_MOUSE
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GINPUT_LLD_MOUSE_BOARD_H
|
||||||
|
#define _GINPUT_LLD_MOUSE_BOARD_H
|
||||||
|
|
||||||
|
#define ADC_NUM_CHANNELS 2
|
||||||
|
#define ADC_BUF_DEPTH 1
|
||||||
|
|
||||||
|
static const ADCConversionGroup adc_y_config = {
|
||||||
|
FALSE,
|
||||||
|
ADC_NUM_CHANNELS,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0, 0,
|
||||||
|
0, 0,
|
||||||
|
ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS),
|
||||||
|
0,
|
||||||
|
ADC_SQR3_SQ2_N(ADC_CHANNEL_IN12) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN13)
|
||||||
|
};
|
||||||
|
|
||||||
|
static const ADCConversionGroup adc_x_config = {
|
||||||
|
FALSE,
|
||||||
|
ADC_NUM_CHANNELS,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0, 0,
|
||||||
|
0, 0,
|
||||||
|
ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS),
|
||||||
|
0,
|
||||||
|
ADC_SQR3_SQ2_N(ADC_CHANNEL_IN10) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN11)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialise the board for the touch.
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static __inline void init_board(void) {
|
||||||
|
adcStart(&ADCD1, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check whether the surface is currently touched
|
||||||
|
* @return TRUE if the surface is currently touched
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static __inline bool_t getpin_pressed(void) {
|
||||||
|
palSetPadMode(GPIOC, 0, PAL_MODE_INPUT_PULLDOWN);
|
||||||
|
palSetPadMode(GPIOC, 1, PAL_MODE_INPUT);
|
||||||
|
palSetPadMode(GPIOC, 2, PAL_MODE_INPUT);
|
||||||
|
palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPad(GPIOC, 3);
|
||||||
|
|
||||||
|
return palReadPad(GPIOC, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Aquire the bus ready for readings
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static __inline void aquire_bus(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Release the bus after readings
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static __inline void release_bus(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read an x value from touch controller
|
||||||
|
* @return The value read from the controller
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static __inline uint16_t read_x_value(void) {
|
||||||
|
uint16_t val1, val2;
|
||||||
|
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
||||||
|
|
||||||
|
palSetPadMode(GPIOC, 0, PAL_MODE_INPUT_ANALOG);
|
||||||
|
palSetPadMode(GPIOC, 1, PAL_MODE_INPUT_ANALOG);
|
||||||
|
palSetPadMode(GPIOC, 2, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
|
||||||
|
palSetPad(GPIOC, 2);
|
||||||
|
palClearPad(GPIOC, 3);
|
||||||
|
chThdSleepMilliseconds(1);
|
||||||
|
adcConvert(&ADCD1, &adc_x_config, samples, ADC_BUF_DEPTH);
|
||||||
|
val1 = ((samples[0] + samples[1])/2);
|
||||||
|
|
||||||
|
palClearPad(GPIOC, 2);
|
||||||
|
palSetPad(GPIOC, 3);
|
||||||
|
chThdSleepMilliseconds(1);
|
||||||
|
adcConvert(&ADCD1, &adc_x_config, samples, ADC_BUF_DEPTH);
|
||||||
|
val2 = ((samples[0] + samples[1])/2);
|
||||||
|
|
||||||
|
return ((val1+((1<<12)-val2))/4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read an y value from touch controller
|
||||||
|
* @return The value read from the controller
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static __inline uint16_t read_y_value(void) {
|
||||||
|
uint16_t val1, val2;
|
||||||
|
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
||||||
|
|
||||||
|
palSetPadMode(GPIOC, 2, PAL_MODE_INPUT_ANALOG);
|
||||||
|
palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_ANALOG);
|
||||||
|
palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
|
||||||
|
palSetPad(GPIOC, 1);
|
||||||
|
palClearPad(GPIOC, 0);
|
||||||
|
chThdSleepMilliseconds(1);
|
||||||
|
adcConvert(&ADCD1, &adc_y_config, samples, ADC_BUF_DEPTH);
|
||||||
|
val1 = ((samples[0] + samples[1])/2);
|
||||||
|
|
||||||
|
palClearPad(GPIOC, 0);
|
||||||
|
palSetPad(GPIOC, 1);
|
||||||
|
chThdSleepMilliseconds(1);
|
||||||
|
adcConvert(&ADCD1, &adc_y_config, samples, ADC_BUF_DEPTH);
|
||||||
|
val2 = ((samples[0] + samples[1])/2);
|
||||||
|
|
||||||
|
return ((val1+((1<<12)-val2))/4);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
|
||||||
|
/** @} */
|
|
@ -1,174 +0,0 @@
|
||||||
/*
|
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
|
||||||
|
|
||||||
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/ginput/touch/MCU/ginput_lld_mouse_board_unknown.h
|
|
||||||
* @brief GINPUT Touch low level driver source for the MCU on some unknown board.
|
|
||||||
*
|
|
||||||
* @addtogroup GINPUT_MOUSE
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _GINPUT_LLD_MOUSE_BOARD_H
|
|
||||||
#define _GINPUT_LLD_MOUSE_BOARD_H
|
|
||||||
|
|
||||||
#define ADC_NUM_CHANNELS 2
|
|
||||||
#define ADC_BUF_DEPTH 1
|
|
||||||
|
|
||||||
static const ADCConversionGroup adc_y_config = {
|
|
||||||
FALSE,
|
|
||||||
ADC_NUM_CHANNELS,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
0, 0,
|
|
||||||
0, 0,
|
|
||||||
ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS),
|
|
||||||
0,
|
|
||||||
ADC_SQR3_SQ2_N(ADC_CHANNEL_IN12) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN13)
|
|
||||||
};
|
|
||||||
|
|
||||||
static const ADCConversionGroup adc_x_config = {
|
|
||||||
FALSE,
|
|
||||||
ADC_NUM_CHANNELS,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
0, 0,
|
|
||||||
0, 0,
|
|
||||||
ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS),
|
|
||||||
0,
|
|
||||||
ADC_SQR3_SQ2_N(ADC_CHANNEL_IN10) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN11)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialise the board for the mouse/touch.
|
|
||||||
*
|
|
||||||
* @notapi
|
|
||||||
*/
|
|
||||||
static __inline void init_board(void) {
|
|
||||||
/* Code here */
|
|
||||||
#error "ginputMCU: You must supply a definition for init_board for your board
|
|
||||||
|
|
||||||
adcStart(ts->adc_driver, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check whether the surface is currently touched
|
|
||||||
* @return TRUE if the surface is currently touched
|
|
||||||
*
|
|
||||||
* @notapi
|
|
||||||
*/
|
|
||||||
static __inline bool_t getpin_pressed(void) {
|
|
||||||
/* Code here */
|
|
||||||
#error "ginputMCU: You must supply a definition for getpin_pressed for your board"
|
|
||||||
palSetPadMode(ts->yd_port, ts->yd_pin, PAL_MODE_INPUT_PULLDOWN);
|
|
||||||
palSetPadMode(ts->yu_port, ts->yu_pin, PAL_MODE_INPUT);
|
|
||||||
palSetPadMode(ts->xl_port, ts->xl_pin, PAL_MODE_INPUT);
|
|
||||||
palSetPadMode(ts->xr_port, ts->xr_pin, PAL_MODE_OUTPUT_PUSHPULL);
|
|
||||||
palSetPad(ts->xr_port, ts->xr_pin);
|
|
||||||
|
|
||||||
return palReadPad(ts->yd_port, ts->yd_pin);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Aquire the bus ready for readings
|
|
||||||
*
|
|
||||||
* @notapi
|
|
||||||
*/
|
|
||||||
static __inline void aquire_bus(void) {
|
|
||||||
/* Code here */
|
|
||||||
#error "ginputMCU: You must supply a definition for aquire_bus for your board"
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Release the bus after readings
|
|
||||||
*
|
|
||||||
* @notapi
|
|
||||||
*/
|
|
||||||
static __inline void release_bus(void) {
|
|
||||||
/* Code here */
|
|
||||||
#error "ginputMCU: You must supply a definition for release_bus for your board"
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read an x value from touch controller
|
|
||||||
* @return The value read from the controller
|
|
||||||
*
|
|
||||||
* @notapi
|
|
||||||
*/
|
|
||||||
static __inline uint16_t read_x_value(void) {
|
|
||||||
/* Code here */
|
|
||||||
#error "ginputMCU: You must supply a definition for read_x_value for your board"
|
|
||||||
uint16_t val1, val2;
|
|
||||||
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
|
||||||
|
|
||||||
palSetPadMode(ts->yd_port, ts->yd_pin, PAL_MODE_INPUT_ANALOG);
|
|
||||||
palSetPadMode(ts->yu_port, ts->yu_pin, PAL_MODE_INPUT_ANALOG);
|
|
||||||
palSetPadMode(ts->xl_port, ts->xl_pin, PAL_MODE_OUTPUT_PUSHPULL);
|
|
||||||
palSetPadMode(ts->xr_port, ts->xr_pin, PAL_MODE_OUTPUT_PUSHPULL);
|
|
||||||
|
|
||||||
palSetPad(ts->xl_port, ts->xl_pin);
|
|
||||||
palClearPad(ts->xr_port, ts->xr_pin);
|
|
||||||
chThdSleepMilliseconds(1);
|
|
||||||
adcConvert(ts->adc_driver, &adc_x_config, samples, ADC_BUF_DEPTH);
|
|
||||||
val1 = ((samples[0] + samples[1])/2);
|
|
||||||
|
|
||||||
palClearPad(ts->xl_port, ts->xl_pin);
|
|
||||||
palSetPad(ts->xr_port, ts->xr_pin);
|
|
||||||
chThdSleepMilliseconds(1);
|
|
||||||
adcConvert(ts->adc_driver, &adc_x_config, samples, ADC_BUF_DEPTH);
|
|
||||||
val2 = ((samples[0] + samples[1])/2);
|
|
||||||
|
|
||||||
return ((val1+((1<<12)-val2))/4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read an y value from touch controller
|
|
||||||
* @return The value read from the controller
|
|
||||||
*
|
|
||||||
* @notapi
|
|
||||||
*/
|
|
||||||
static __inline uint16_t read_y_value(void) {
|
|
||||||
/* Code here */
|
|
||||||
#error "ginputMCU: You must supply a definition for read_y_value for your board"
|
|
||||||
uint16_t val1, val2;
|
|
||||||
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
|
||||||
|
|
||||||
palSetPadMode(ts->xl_port, ts->xl_pin, PAL_MODE_INPUT_ANALOG);
|
|
||||||
palSetPadMode(ts->xr_port, ts->xr_pin, PAL_MODE_INPUT_ANALOG);
|
|
||||||
palSetPadMode(ts->yd_port, ts->yd_pin, PAL_MODE_OUTPUT_PUSHPULL);
|
|
||||||
palSetPadMode(ts->yu_port, ts->yu_pin, PAL_MODE_OUTPUT_PUSHPULL);
|
|
||||||
|
|
||||||
palSetPad(ts->yu_port, ts->yu_pin);
|
|
||||||
palClearPad(ts->yd_port, ts->yd_pin);
|
|
||||||
chThdSleepMilliseconds(1);
|
|
||||||
adcConvert(ts->adc_driver, &adc_y_config, samples, ADC_BUF_DEPTH);
|
|
||||||
val1 = ((samples[0] + samples[1])/2);
|
|
||||||
|
|
||||||
palClearPad(ts->yu_port, ts->yu_pin);
|
|
||||||
palSetPad(ts->yd_port, ts->yd_pin);
|
|
||||||
chThdSleepMilliseconds(1);
|
|
||||||
adcConvert(ts->adc_driver, &adc_y_config, samples, ADC_BUF_DEPTH);
|
|
||||||
val2 = ((samples[0] + samples[1])/2);
|
|
||||||
|
|
||||||
return ((val1+((1<<12)-val2))/4);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
|
|
||||||
/** @} */
|
|
|
@ -28,13 +28,13 @@
|
||||||
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
||||||
|
|
||||||
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
||||||
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
#define GINPUT_MOUSE_NEED_CALIBRATION FALSE
|
||||||
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
||||||
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 2
|
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR -1
|
||||||
#define GINPUT_MOUSE_READ_CYCLES 4
|
#define GINPUT_MOUSE_READ_CYCLES 4
|
||||||
#define GINPUT_MOUSE_POLL_PERIOD 100
|
#define GINPUT_MOUSE_POLL_PERIOD 100
|
||||||
#define GINPUT_MOUSE_MAX_CLICK_JITTER 2
|
#define GINPUT_MOUSE_MAX_CLICK_JITTER 4
|
||||||
#define GINPUT_MOUSE_MAX_MOVE_JITTER 2
|
#define GINPUT_MOUSE_MAX_MOVE_JITTER 4
|
||||||
#define GINPUT_MOUSE_CLICK_TIME 700
|
#define GINPUT_MOUSE_CLICK_TIME 700
|
||||||
|
|
||||||
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS/GFX.
|
This file is part of ChibiOS/GFX.
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file drivers/gdisp/Win32/gdisp_lld.c
|
* @file drivers/multiple/Win32/gdisp_lld.c
|
||||||
* @brief GDISP Graphics Driver subsystem low level driver source for Win32.
|
* @brief GDISP Graphics Driver subsystem low level driver source for Win32.
|
||||||
*
|
*
|
||||||
* @addtogroup GDISP
|
* @addtogroup GDISP
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
/*
|
/*
|
||||||
ChibiOS/RT - Copyright (C) 2012
|
ChibiOS/GFX - Copyright (C) 2012
|
||||||
Joel Bodenmann aka Tectu <joel@unormal.org>
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||||
|
|
||||||
This file is part of ChibiOS-LCD-Driver.
|
This file is part of ChibiOS/GFX.
|
||||||
|
|
||||||
ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 3 of the License, or
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
ChibiOS-LCD-Driver is distributed in the hope that it will be useful,
|
ChibiOS-GFX is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file drivers/gdisp/Win32/gdisp_lld_config.h
|
* @file drivers/multiple/Win32/gdisp_lld_config.h
|
||||||
* @brief GDISP Graphic Driver subsystem low level driver header for Win32.
|
* @brief GDISP Graphic Driver subsystem low level driver header for Win32.
|
||||||
*
|
*
|
||||||
* @addtogroup GDISP
|
* @addtogroup GDISP
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file drivers/gdisp/Win32/ginput_lld_mouse_config.h
|
* @file drivers/multiple/Win32/ginput_lld_mouse_config.h
|
||||||
* @brief GINPUT LLD header file for mouse/touch driver.
|
* @brief GINPUT LLD header file for mouse/touch driver.
|
||||||
*
|
*
|
||||||
* @addtogroup GINPUT_LLD_MOUSE
|
* @addtogroup GINPUT_LLD_MOUSE
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file include/gdisp_fonts.h
|
* @file include/gdisp/fonts.h
|
||||||
* @brief GDISP internal font definitions.
|
* @brief GDISP internal font definitions.
|
||||||
* @details This is not generally needed by an application. It is used
|
* @details This is not generally needed by an application. It is used
|
||||||
* by the low level drivers that need to understand a font.
|
* by the low level drivers that need to understand a font.
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file include/gdisp_lld.h
|
* @file include/lld/gdisp/gdisp_lld.h
|
||||||
* @brief GDISP Graphic Driver subsystem low level driver header.
|
* @brief GDISP Graphic Driver subsystem low level driver header.
|
||||||
*
|
*
|
||||||
* @addtogroup GDISP
|
* @addtogroup GDISP
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file include/gdisp_lld_msgs.h
|
* @file include/lld/gdisp/gdisp_lld_msgs.h
|
||||||
* @brief GDISP Graphic Driver subsystem low level driver message structures.
|
* @brief GDISP Graphic Driver subsystem low level driver message structures.
|
||||||
*
|
*
|
||||||
* @addtogroup GDISP
|
* @addtogroup GDISP
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file include/touchscreen_lld.h
|
* @file include/lld/touchscreen/touchscreen_lld.h
|
||||||
* @brief TOUCHSCREEN Driver subsystem low level driver header.
|
* @brief TOUCHSCREEN Driver subsystem low level driver header.
|
||||||
*
|
*
|
||||||
* @addtogroup TOUCHSCREEN
|
* @addtogroup TOUCHSCREEN
|
||||||
|
|
|
@ -258,6 +258,8 @@ void gtimerStop(GTimer *pt) {
|
||||||
*
|
*
|
||||||
* @param[in] pt Pointer to a GTimer structure
|
* @param[in] pt Pointer to a GTimer structure
|
||||||
*
|
*
|
||||||
|
* @return TRUE if active, FALSE otherwise
|
||||||
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
bool_t gtimerIsActive(GTimer *pt) {
|
bool_t gtimerIsActive(GTimer *pt) {
|
||||||
|
|
|
@ -30,12 +30,12 @@
|
||||||
#include "gwin.h"
|
#include "gwin.h"
|
||||||
#include "ginput.h"
|
#include "ginput.h"
|
||||||
|
|
||||||
#if !defined(GFX_USE_GINPUT) || !GFX_USE_GINPUT
|
#if (GFX_USE_GWIN && GWIN_NEED_BUTTON) || defined(__DOXYGEN__)
|
||||||
|
|
||||||
|
#if !GFX_USE_GINPUT
|
||||||
#error "GWIN Buttons require GFX_USE_GINPUT"
|
#error "GWIN Buttons require GFX_USE_GINPUT"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (GFX_USE_GWIN && GWIN_NEED_BUTTON) || defined(__DOXYGEN__)
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "gwin_internal.h"
|
#include "gwin_internal.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue