commit
e236a0a6b7
4 changed files with 29 additions and 11 deletions
|
@ -18,6 +18,24 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure you have the following enabled in your halconf.h:
|
||||||
|
*
|
||||||
|
* #define GFX_USE_GDISP TRUE
|
||||||
|
* #define GFX_USE_GINPUT TRUE
|
||||||
|
* #define GFX_USE_GEVENT TRUE
|
||||||
|
* #define GFX_USE_GTIMER TRUE
|
||||||
|
* #define GFX_USE_GWIN TRUE
|
||||||
|
*
|
||||||
|
* #define GWIN_NEED_CONSOLE TRUE
|
||||||
|
* #define GWIN_NEED_BUTTON TRUE
|
||||||
|
*
|
||||||
|
* #define GINPUT_NEED_MOUSE TRUE
|
||||||
|
* #define GINPUT_NEED_TOUCH TRUE
|
||||||
|
*
|
||||||
|
* #define GDISP_NEED_CLIP TRUE
|
||||||
|
*/
|
||||||
|
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "chprintf.h"
|
#include "chprintf.h"
|
||||||
|
@ -53,7 +71,7 @@ int main(void) {
|
||||||
ghNext = ghPrev = 0;
|
ghNext = ghPrev = 0;
|
||||||
|
|
||||||
// Create our title
|
// Create our title
|
||||||
gdispFillStringBox(0, 0, swidth, 20, "Touch Calibration", &fontUI2, Red, White, justifyCenter);
|
gdispFillStringBox(0, 0, swidth, 20, "Touch Calibration", &fontUI2, Red, White, justifyLeft);
|
||||||
|
|
||||||
// Create our main display window
|
// Create our main display window
|
||||||
ghc = gwinCreateConsole(&gc, 0, 20, swidth, sheight-20, &fontUI2);
|
ghc = gwinCreateConsole(&gc, 0, 20, swidth, sheight-20, &fontUI2);
|
||||||
|
@ -228,7 +246,7 @@ StepCalibrate:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calibration used the whole screen - re-establish our title
|
// Calibration used the whole screen - re-establish our title
|
||||||
gdispFillStringBox(0, 0, swidth, 20, "Touch Calibration", &fontUI2, Green, White, justifyCenter);
|
gdispFillStringBox(0, 0, swidth, 20, "Touch Calibration", &fontUI2, Green, White, justifyLeft);
|
||||||
gwinButtonDraw(ghNext);
|
gwinButtonDraw(ghNext);
|
||||||
gwinButtonDraw(ghPrev);
|
gwinButtonDraw(ghPrev);
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
|
|
||||||
#define GDISP_HARDWARE_CLEARS TRUE
|
#define GDISP_HARDWARE_CLEARS TRUE
|
||||||
#define GDISP_HARDWARE_FILLS TRUE
|
#define GDISP_HARDWARE_FILLS TRUE
|
||||||
#define GDISP_HARDWARE_BITFILLS TRUE
|
#define GDISP_HARDWARE_BITFILLS FALSE
|
||||||
#define GDISP_HARDWARE_SCROLL TRUE
|
#define GDISP_HARDWARE_SCROLL FALSE
|
||||||
#define GDISP_HARDWARE_PIXELREAD TRUE
|
#define GDISP_HARDWARE_PIXELREAD TRUE
|
||||||
#define GDISP_HARDWARE_CONTROL TRUE
|
#define GDISP_HARDWARE_CONTROL TRUE
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ static __inline void release_bus(void) {
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
static __inline uint16_t read_x_value(void) {
|
static uint16_t read_x_value(void) {
|
||||||
uint16_t val1, val2;
|
uint16_t val1, val2;
|
||||||
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ static __inline uint16_t read_x_value(void) {
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
static __inline uint16_t read_y_value(void) {
|
static uint16_t read_y_value(void) {
|
||||||
uint16_t val1, val2;
|
uint16_t val1, val2;
|
||||||
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ static __inline uint16_t read_y_value(void) {
|
||||||
palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_ANALOG);
|
palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_ANALOG);
|
||||||
palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
|
palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
|
palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
return 42;
|
|
||||||
palSetPad(GPIOC, 1);
|
palSetPad(GPIOC, 1);
|
||||||
palClearPad(GPIOC, 0);
|
palClearPad(GPIOC, 0);
|
||||||
chThdSleepMilliseconds(1);
|
chThdSleepMilliseconds(1);
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
#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 FALSE
|
#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 -1
|
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 10
|
||||||
#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 4
|
#define GINPUT_MOUSE_MAX_CLICK_JITTER 4
|
||||||
|
|
Loading…
Add table
Reference in a new issue