Remove GDISP_THREAD_CHIBIOS. This is always used now.

ugfx_release_2.6
inmarket 2013-07-21 17:26:11 +10:00
parent 2bef5da2f3
commit 5b2d561483
4 changed files with 21 additions and 60 deletions

View File

@ -14,11 +14,6 @@
#if GFX_USE_GDISP #if GFX_USE_GDISP
/* Our threading model - ChibiOS or POSIX */
#ifndef GDISP_THREAD_CHIBIOS
#define GDISP_THREAD_CHIBIOS TRUE
#endif
/** /**
* Our color model - Default or 24 bit only. * Our color model - Default or 24 bit only.
* *
@ -42,9 +37,6 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#if !GDISP_THREAD_CHIBIOS
#include <pthread.h>
#endif
#ifndef GDISP_SCREEN_HEIGHT #ifndef GDISP_SCREEN_HEIGHT
#define GDISP_SCREEN_HEIGHT 480 #define GDISP_SCREEN_HEIGHT 480
@ -116,9 +108,8 @@ static void ProcessEvent(void) {
} }
/* this is the X11 thread which keeps track of all events */ /* this is the X11 thread which keeps track of all events */
#if GDISP_THREAD_CHIBIOS static DECLARE_THREAD_STACK(waXThread, 1024);
static DECLARE_THREAD_STACK(waXThread, 1024); static DECLARE_THREAD_FUNCTION(ThreadX, arg) {
static DECLARE_THREAD_FUNCTION(ThreadX, arg) {
(void)arg; (void)arg;
while(1) { while(1) {
@ -129,21 +120,7 @@ static void ProcessEvent(void) {
} }
} }
return 0; return 0;
} }
#else
static void * ThreadX(void *arg) {
(void)arg;
while(1) {
pthread_yield(); // This could be a 100ms delay
while(XPending(dis)) {
XNextEvent(dis, &evt);
ProcessEvent();
}
}
return 0;
}
#endif
static int FatalXIOError(Display *d) { static int FatalXIOError(Display *d) {
(void) d; (void) d;
@ -159,12 +136,9 @@ bool_t gdisp_lld_init(void)
XSetWindowAttributes xa; XSetWindowAttributes xa;
XTextProperty WindowTitle; XTextProperty WindowTitle;
char * WindowTitleText; char * WindowTitleText;
#if GDISP_THREAD_CHIBIOS
gfxThreadHandle hth; gfxThreadHandle hth;
#else
pthread_attr_t thattr;
pthread_t thid;
#if GFX_USE_OS_POSIX
XInitThreads(); XInitThreads();
#endif #endif
@ -227,22 +201,15 @@ bool_t gdisp_lld_init(void)
XSelectInput(dis, win, XSelectInput(dis, win,
ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask); ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
#if GDISP_THREAD_CHIBIOS
if (!(hth = gfxThreadCreate(waXThread, sizeof(waXThread), HIGH_PRIORITY, ThreadX, 0))) { if (!(hth = gfxThreadCreate(waXThread, sizeof(waXThread), HIGH_PRIORITY, ThreadX, 0))) {
fprintf(stderr, "Cannot start X Thread\n"); fprintf(stderr, "Cannot start X Thread\n");
XCloseDisplay(dis); XCloseDisplay(dis);
exit(0); exit(0);
} }
gfxThreadClose(hth); #if GFX_USE_OS_POSIX
#else pthread_detach(hth);
if (pthread_attr_init(&thattr)
|| pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_DETACHED)
|| pthread_create(&thid, &thattr, ThreadX, 0)) {
fprintf(stderr, "Cannot start X Thread\n");
XCloseDisplay(dis);
exit(0);
}
#endif #endif
gfxThreadClose(hth);
/* Initialise the GDISP structure to match */ /* Initialise the GDISP structure to match */
GDISP.Orientation = GDISP_ROTATE_0; GDISP.Orientation = GDISP_ROTATE_0;

View File

@ -20,8 +20,3 @@ and a touchscreen driver.
3. Modify your makefile to add -lX11 to the DLIBS line. i.e. 3. Modify your makefile to add -lX11 to the DLIBS line. i.e.
DLIBS = -lX11 DLIBS = -lX11
3. If you changed your threading model to POSIX modify your makefile
to add -pthread to the CC (or DDEFS) line. i.e.
CC = $(TRGT)gcc -pthread

View File

@ -143,7 +143,6 @@
#define GDISP_USE_GPIO #define GDISP_USE_GPIO
#define TDISP_COLUMNS 16 #define TDISP_COLUMNS 16
#define TDISP_ROWS 2 #define TDISP_ROWS 2
#define GDISP_THREAD_CHIBIOS TRUE
*/ */
#endif /* _GFXCONF_H */ #endif /* _GFXCONF_H */