aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-05-25 01:26:52 +1000
committerinmarket <andrewh@inmarket.com.au>2013-05-25 01:26:52 +1000
commit7fbfde42aabbcd30cffba2fba35158236c0a6c6c (patch)
treee85c90a4f21974b706315d64209021e0b2bde764 /demos
parent42006a67b5ccfd86f30d8a91cc474681c437eaf6 (diff)
downloaduGFX-7fbfde42aabbcd30cffba2fba35158236c0a6c6c.tar.gz
uGFX-7fbfde42aabbcd30cffba2fba35158236c0a6c6c.tar.bz2
uGFX-7fbfde42aabbcd30cffba2fba35158236c0a6c6c.zip
GOS module, for operating system independance
GMISC fast floating point trig GMISC fast fixed point trig
Diffstat (limited to 'demos')
-rw-r--r--demos/3rdparty/boing/gfxconf.h9
-rw-r--r--demos/3rdparty/boing/main.c8
-rw-r--r--demos/3rdparty/bubbles/gfxconf.h9
-rw-r--r--demos/3rdparty/bubbles/main.c8
-rw-r--r--demos/applications/mandelbrot/gfxconf.h9
-rw-r--r--demos/applications/mandelbrot/main.c7
-rw-r--r--demos/applications/notepad/gfxconf.h5
-rw-r--r--demos/applications/notepad/main.c7
-rw-r--r--demos/benchmarks/gfxconf.h9
-rw-r--r--demos/benchmarks/main.c13
-rw-r--r--demos/modules/gadc/gfxconf.h5
-rw-r--r--demos/modules/gadc/gwinosc.c11
-rw-r--r--demos/modules/gadc/gwinosc.h2
-rw-r--r--demos/modules/gadc/main.c10
-rw-r--r--demos/modules/gaudin/gfxconf.h5
-rw-r--r--demos/modules/gaudin/gwinosc.c11
-rw-r--r--demos/modules/gaudin/gwinosc.h2
-rw-r--r--demos/modules/gaudin/main.c7
-rw-r--r--demos/modules/gdisp/gdisp_basics/gfxconf.h9
-rw-r--r--demos/modules/gdisp/gdisp_basics/main.c10
-rw-r--r--demos/modules/gdisp/gdisp_circles/gfxconf.h9
-rw-r--r--demos/modules/gdisp/gdisp_circles/main.c10
-rw-r--r--demos/modules/gdisp/gdisp_images/gfxconf.h16
-rw-r--r--demos/modules/gdisp/gdisp_images/main.c10
-rw-r--r--demos/modules/gdisp/gdisp_images_animated/gfxconf.h16
-rw-r--r--demos/modules/gdisp/gdisp_images_animated/main.c14
-rw-r--r--demos/modules/gdisp/gdisp_text/gfxconf.h9
-rw-r--r--demos/modules/gdisp/gdisp_text/main.c10
-rw-r--r--demos/modules/ginput/touch_driver_test/gfxconf.h5
-rw-r--r--demos/modules/ginput/touch_driver_test/main.c8
-rw-r--r--demos/modules/graph/gfxconf.h8
-rw-r--r--demos/modules/graph/main.c10
-rw-r--r--demos/modules/gtimer/gfxconf.h9
-rw-r--r--demos/modules/gtimer/main.c7
-rw-r--r--demos/modules/gwin/basic/gfxconf.h8
-rw-r--r--demos/modules/gwin/basic/main.c8
-rw-r--r--demos/modules/gwin/console/gfxconf.h8
-rw-r--r--demos/modules/gwin/console/main.c12
-rw-r--r--demos/modules/gwin/slider/gfxconf.h5
-rw-r--r--demos/modules/gwin/slider/main.c8
-rw-r--r--demos/modules/tdisp/gfxconf.h44
-rw-r--r--demos/modules/tdisp/main.c13
42 files changed, 147 insertions, 256 deletions
diff --git a/demos/3rdparty/boing/gfxconf.h b/demos/3rdparty/boing/gfxconf.h
index 45b6d7ab..0afcd45b 100644
--- a/demos/3rdparty/boing/gfxconf.h
+++ b/demos/3rdparty/boing/gfxconf.h
@@ -9,12 +9,13 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION FALSE
diff --git a/demos/3rdparty/boing/main.c b/demos/3rdparty/boing/main.c
index a34cd2a9..96ba5c9d 100644
--- a/demos/3rdparty/boing/main.c
+++ b/demos/3rdparty/boing/main.c
@@ -11,11 +11,11 @@
* width*height pixels out.
* --
* Chris Baird,, <cjb@brushtail.apana.org.au> April 2013
+ *
+ * Modified Andrew Hannam (inmarket) 2013-04-29 New GFX support
*/
#include <math.h>
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
#include "ssd2119.h"
@@ -56,9 +56,7 @@ void main (void)
{
uint16_t xx, yy, colour;
- halInit();
- chSysInit();
- gdispInit();
+ gfxInit();
uint16_t width = (uint16_t)gdispGetWidth();
uint16_t height = (uint16_t)gdispGetHeight();
diff --git a/demos/3rdparty/bubbles/gfxconf.h b/demos/3rdparty/bubbles/gfxconf.h
index 9b1f76a6..344a986e 100644
--- a/demos/3rdparty/bubbles/gfxconf.h
+++ b/demos/3rdparty/bubbles/gfxconf.h
@@ -9,12 +9,13 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION FALSE
diff --git a/demos/3rdparty/bubbles/main.c b/demos/3rdparty/bubbles/main.c
index 81c5dbe3..62ef2830 100644
--- a/demos/3rdparty/bubbles/main.c
+++ b/demos/3rdparty/bubbles/main.c
@@ -8,11 +8,11 @@
* modifiable, provided his name is kept in the source.
* --
* Chris Baird,, <cjb@brushtail.apana.org.au> April 2013
+ *
+ * Modified Andrew Hannam (inmarket) 2013-04-29 New GFX calls
*/
#include <math.h>
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
@@ -149,9 +149,7 @@ int main (void)
{
int pass = 0;
- halInit();
- chSysInit();
- gdispInit();
+ gfxInit();
chThdSleepMilliseconds (10);
gdispClear (background); /* glitches.. */
diff --git a/demos/applications/mandelbrot/gfxconf.h b/demos/applications/mandelbrot/gfxconf.h
index 7093884f..a2b15927 100644
--- a/demos/applications/mandelbrot/gfxconf.h
+++ b/demos/applications/mandelbrot/gfxconf.h
@@ -28,12 +28,13 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
diff --git a/demos/applications/mandelbrot/main.c b/demos/applications/mandelbrot/main.c
index 969a9c92..9d753a87 100644
--- a/demos/applications/mandelbrot/main.c
+++ b/demos/applications/mandelbrot/main.c
@@ -25,8 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
void mandelbrot(float x1, float y1, float x2, float y2) {
@@ -66,10 +64,7 @@ int main(void) {
float cx, cy;
float zoom = 1.0f;
- halInit();
- chSysInit();
-
- gdispInit();
+ gfxInit();
/* where to zoom in */
cx = -0.086f;
diff --git a/demos/applications/notepad/gfxconf.h b/demos/applications/notepad/gfxconf.h
index 7ba6483b..b9aa53f9 100644
--- a/demos/applications/notepad/gfxconf.h
+++ b/demos/applications/notepad/gfxconf.h
@@ -28,6 +28,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GFX_USE_GWIN FALSE
diff --git a/demos/applications/notepad/main.c b/demos/applications/notepad/main.c
index 1dcfd154..d9a6d954 100644
--- a/demos/applications/notepad/main.c
+++ b/demos/applications/notepad/main.c
@@ -25,8 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
#define COLOR_SIZE 20
@@ -77,10 +75,7 @@ int main(void) {
color_t color = Black;
uint16_t pen = 0;
- halInit();
- chSysInit();
-
- gdispInit();
+ gfxInit();
ginputGetMouse(0);
gdispSetOrientation(GDISP_ROTATE_90);
diff --git a/demos/benchmarks/gfxconf.h b/demos/benchmarks/gfxconf.h
index d12025e5..5185b50e 100644
--- a/demos/benchmarks/gfxconf.h
+++ b/demos/benchmarks/gfxconf.h
@@ -28,12 +28,13 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION FALSE
diff --git a/demos/benchmarks/main.c b/demos/benchmarks/main.c
index c3cef762..d39215f0 100644
--- a/demos/benchmarks/main.c
+++ b/demos/benchmarks/main.c
@@ -25,12 +25,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ch.h"
-#include "hal.h"
-#include "chprintf.h"
#include "stdlib.h"
#include "string.h"
#include "gfx.h"
+#include "chprintf.h"
#define SCB_DEMCR (*(volatile unsigned *)0xE000EDFC)
#define CPU_RESET_CYCLECOUNTER do { SCB_DEMCR = SCB_DEMCR | 0x01000000; \
@@ -94,7 +92,6 @@ void benchmark(void) {
font_t font;
gdispSetOrientation(GDISP_ROTATE_90);
- gdispClear(Black);
width = gdispGetWidth();
height = gdispGetHeight();
@@ -105,7 +102,7 @@ void benchmark(void) {
font = gdispOpenFont("UI2");
gdispDrawStringBox(0, height/2, width, 30, "5000 random rectangles", font, White, justifyCenter);
- chThdSleepMilliseconds(3000);
+ gfxSleepMilliseconds(3000);
/* seed for the rand() */
srand(DWT_CYCCNT);
@@ -139,14 +136,12 @@ void benchmark(void) {
}
int main(void) {
- halInit();
- chSysInit();
- gdispInit();
+ gfxInit();
benchmark();
while(TRUE) {
- chThdSleepMilliseconds(500);
+ gfxSleepMilliseconds(500);
}
return 0;
diff --git a/demos/modules/gadc/gfxconf.h b/demos/modules/gadc/gfxconf.h
index 557184cc..17bc5a6b 100644
--- a/demos/modules/gadc/gfxconf.h
+++ b/demos/modules/gadc/gfxconf.h
@@ -33,6 +33,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GFX_USE_TDISP FALSE
diff --git a/demos/modules/gadc/gwinosc.c b/demos/modules/gadc/gwinosc.c
index 49d9fe22..589fdb9e 100644
--- a/demos/modules/gadc/gwinosc.c
+++ b/demos/modules/gadc/gwinosc.c
@@ -30,10 +30,7 @@
*
* This GWIN superset implements a simple audio oscilloscope using the GADC high speed device.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
-
#include "gwinosc.h"
/* Include internal GWIN routines so we can build our own superset class */
@@ -55,11 +52,11 @@ GHandle gwinCreateScope(GScopeObject *gs, coord_t x, coord_t y, coord_t cx, coor
/* Initialise the scope object members and allocate memory for buffers */
gs->gwin.type = GW_SCOPE;
- chBSemInit(&gs->bsem, TRUE);
+ gfxSemInit(&gs->bsem, 0, 1);
gs->nextx = 0;
- if (!(gs->lastscopetrace = (coord_t *)chHeapAlloc(NULL, gs->gwin.width * sizeof(coord_t))))
+ if (!(gs->lastscopetrace = (coord_t *)gfxAlloc(gs->gwin.width * sizeof(coord_t))))
return 0;
- if (!(gs->audiobuf = (adcsample_t *)chHeapAlloc(NULL, AUDIOBUFSZ * sizeof(adcsample_t))))
+ if (!(gs->audiobuf = (adcsample_t *)gfxAlloc(AUDIOBUFSZ * sizeof(adcsample_t))))
return 0;
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
gs->lasty = gs->gwin.height/2;
@@ -93,7 +90,7 @@ void gwinWaitForScopeTrace(GHandle gh) {
#endif
/* Wait for a set of audio conversions */
- chBSemWait(&gs->bsem);
+ gfxSemWait(&gs->bsem, TIME_INFINITE);
/* Ensure we are drawing in the right area */
#if GDISP_NEED_CLIP
diff --git a/demos/modules/gadc/gwinosc.h b/demos/modules/gadc/gwinosc.h
index 11644be4..1a2e7f18 100644
--- a/demos/modules/gadc/gwinosc.h
+++ b/demos/modules/gadc/gwinosc.h
@@ -57,7 +57,7 @@ typedef struct GScopeObject_t {
GWindowObject gwin; // Base Class
coord_t *lastscopetrace; // To store last scope trace
- BinarySemaphore bsem; // We get signalled on this
+ gfxSem bsem; // We get signalled on this
adcsample_t *audiobuf; // To store audio samples
GEventADC myEvent; // Information on received samples
coord_t nextx; // Where we are up to
diff --git a/demos/modules/gadc/main.c b/demos/modules/gadc/main.c
index f506a473..4acf1da7 100644
--- a/demos/modules/gadc/main.c
+++ b/demos/modules/gadc/main.c
@@ -34,11 +34,8 @@
*
* It also demonstrates how to write your own custom GWIN window type.
*/
-#include "ch.h"
-#include "hal.h"
-#include "chprintf.h"
-
#include "gfx.h"
+#include "chprintf.h"
/* Include our custom gwin oscilloscope */
#include "gwinosc.h"
@@ -143,10 +140,7 @@ int main(void) {
font_t font;
#endif
- halInit();
- chSysInit();
- gdispInit();
- gdispClear(Black);
+ gfxInit();
/* Get the screen dimensions */
swidth = gdispGetWidth();
diff --git a/demos/modules/gaudin/gfxconf.h b/demos/modules/gaudin/gfxconf.h
index d9db73a5..01981087 100644
--- a/demos/modules/gaudin/gfxconf.h
+++ b/demos/modules/gaudin/gfxconf.h
@@ -33,6 +33,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GFX_USE_TDISP FALSE
diff --git a/demos/modules/gaudin/gwinosc.c b/demos/modules/gaudin/gwinosc.c
index 5a2867c1..82ed4b44 100644
--- a/demos/modules/gaudin/gwinosc.c
+++ b/demos/modules/gaudin/gwinosc.c
@@ -37,10 +37,7 @@
* correctly if we were really building something generic.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
-
#include "gwinosc.h"
/* Include internal GWIN routines so we can build our own superset class */
@@ -62,11 +59,11 @@ GHandle gwinCreateScope(GScopeObject *gs, coord_t x, coord_t y, coord_t cx, coor
/* Initialise the scope object members and allocate memory for buffers */
gs->gwin.type = GW_SCOPE;
- chBSemInit(&gs->bsem, TRUE);
+ gfxSemInit(&gs->bsem, 0, 1);
gs->nextx = 0;
- if (!(gs->lastscopetrace = (coord_t *)chHeapAlloc(NULL, gs->gwin.width * sizeof(coord_t))))
+ if (!(gs->lastscopetrace = (coord_t *)gfxAlloc(NULL, gs->gwin.width * sizeof(coord_t))))
return 0;
- if (!(gs->audiobuf = (adcsample_t *)chHeapAlloc(NULL, AUDIOBUFSZ * sizeof(adcsample_t))))
+ if (!(gs->audiobuf = (adcsample_t *)gfxAlloc(NULL, AUDIOBUFSZ * sizeof(adcsample_t))))
return 0;
#if TRIGGER_METHOD == TRIGGER_POSITIVERAMP
gs->lasty = gs->gwin.height/2;
@@ -100,7 +97,7 @@ void gwinWaitForScopeTrace(GHandle gh) {
#endif
/* Wait for a set of audio conversions */
- chBSemWait(&gs->bsem);
+ gfxSemWait(&gs->bsem, TIME_INFINITE);
/* Ensure we are drawing in the right area */
#if GDISP_NEED_CLIP
diff --git a/demos/modules/gaudin/gwinosc.h b/demos/modules/gaudin/gwinosc.h
index 9c51e548..d696e276 100644
--- a/demos/modules/gaudin/gwinosc.h
+++ b/demos/modules/gaudin/gwinosc.h
@@ -63,7 +63,7 @@ typedef struct GScopeObject_t {
GWindowObject gwin; // Base Class
coord_t *lastscopetrace; // To store last scope trace
- BinarySemaphore bsem; // We get signalled on this
+ gfxSem bsem; // We get signalled on this
audin_sample_t *audiobuf; // To store audio samples
GEventAudioIn myEvent; // Information on received samples
coord_t nextx; // Where we are up to
diff --git a/demos/modules/gaudin/main.c b/demos/modules/gaudin/main.c
index f532b324..a647d4af 100644
--- a/demos/modules/gaudin/main.c
+++ b/demos/modules/gaudin/main.c
@@ -31,8 +31,6 @@
*
* It also demonstrates how to write your own custom GWIN window type.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
/* Include our custom gwin audio oscilloscope */
@@ -52,10 +50,7 @@ int main(void) {
GHandle ghScope;
coord_t swidth, sheight;
- halInit();
- chSysInit();
- gdispInit();
- gdispClear(Black);
+ gfxInit();
/* Get the screen dimensions */
swidth = gdispGetWidth();
diff --git a/demos/modules/gdisp/gdisp_basics/gfxconf.h b/demos/modules/gdisp/gdisp_basics/gfxconf.h
index f64884a0..b632f6e0 100644
--- a/demos/modules/gdisp/gdisp_basics/gfxconf.h
+++ b/demos/modules/gdisp/gdisp_basics/gfxconf.h
@@ -28,12 +28,13 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
diff --git a/demos/modules/gdisp/gdisp_basics/main.c b/demos/modules/gdisp/gdisp_basics/main.c
index 134f2473..d7a1b5e3 100644
--- a/demos/modules/gdisp/gdisp_basics/main.c
+++ b/demos/modules/gdisp/gdisp_basics/main.c
@@ -25,20 +25,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
int main(void) {
coord_t width, height;
coord_t i, j;
- halInit();
- chSysInit();
-
/* Initialize and clear the display */
- gdispInit();
- gdispClear(Black);
+ gfxInit();
// Get the screen size
width = gdispGetWidth();
@@ -53,7 +47,7 @@ int main(void) {
gdispDrawPixel (i, j, White);
while(TRUE) {
- chThdSleepMilliseconds(500);
+ gfxSleepMilliseconds(500);
}
}
diff --git a/demos/modules/gdisp/gdisp_circles/gfxconf.h b/demos/modules/gdisp/gdisp_circles/gfxconf.h
index cc60c46b..cd7515d9 100644
--- a/demos/modules/gdisp/gdisp_circles/gfxconf.h
+++ b/demos/modules/gdisp/gdisp_circles/gfxconf.h
@@ -28,12 +28,13 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
diff --git a/demos/modules/gdisp/gdisp_circles/main.c b/demos/modules/gdisp/gdisp_circles/main.c
index 395af009..3a9675bb 100644
--- a/demos/modules/gdisp/gdisp_circles/main.c
+++ b/demos/modules/gdisp/gdisp_circles/main.c
@@ -25,19 +25,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
int main(void) {
coord_t width, height;
- halInit();
- chSysInit();
-
/* Initialize and clear the display */
- gdispInit();
- gdispClear(Black);
+ gfxInit();
// Get the screen size
width = gdispGetWidth();
@@ -52,7 +46,7 @@ int main(void) {
gdispFillArc(width/8, height/8, 30, 10, 70, Gray);
while(TRUE) {
- chThdSleepMilliseconds(500);
+ gfxSleepMilliseconds(500);
}
}
diff --git a/demos/modules/gdisp/gdisp_images/gfxconf.h b/demos/modules/gdisp/gdisp_images/gfxconf.h
index e76ddd72..866f3ba7 100644
--- a/demos/modules/gdisp/gdisp_images/gfxconf.h
+++ b/demos/modules/gdisp/gdisp_images/gfxconf.h
@@ -28,12 +28,13 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
@@ -65,11 +66,4 @@
#define GDISP_NEED_IMAGE_JPG FALSE
#define GDISP_NEED_IMAGE_PNG FALSE
-/* Features for the GWIN sub-system. */
-#define GWIN_NEED_BUTTON FALSE
-#define GWIN_NEED_CONSOLE FALSE
-
-/* Features for the GINPUT sub-system. */
-#define GINPUT_NEED_MOUSE FALSE
-
#endif /* _GFXCONF_H */
diff --git a/demos/modules/gdisp/gdisp_images/main.c b/demos/modules/gdisp/gdisp_images/main.c
index a6fa58d8..3fc20490 100644
--- a/demos/modules/gdisp/gdisp_images/main.c
+++ b/demos/modules/gdisp/gdisp_images/main.c
@@ -25,8 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
#ifdef WIN32
@@ -44,11 +42,7 @@ static gdispImage myImage;
int main(void) {
coord_t swidth, sheight;
- halInit(); // Initialize the Hardware
- chSysInit(); // Initialize the OS
- gdispInit(); // Initialize the display
-
- gdispClear(Black);
+ gfxInit(); // Initialize the display
// Get the display dimensions
swidth = gdispGetWidth();
@@ -66,7 +60,7 @@ int main(void) {
gdispImageClose(&myImage);
while(1) {
- chThdSleepMilliseconds(1000);
+ gfxSleepMilliseconds(1000);
}
return 0;
diff --git a/demos/modules/gdisp/gdisp_images_animated/gfxconf.h b/demos/modules/gdisp/gdisp_images_animated/gfxconf.h
index cd368e95..9a734924 100644
--- a/demos/modules/gdisp/gdisp_images_animated/gfxconf.h
+++ b/demos/modules/gdisp/gdisp_images_animated/gfxconf.h
@@ -9,12 +9,13 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
@@ -47,11 +48,4 @@
#define GDISP_NEED_IMAGE_PNG FALSE
#define GDISP_NEED_IMAGE_ACCOUNTING FALSE
-/* Features for the GWIN sub-system. */
-#define GWIN_NEED_BUTTON FALSE
-#define GWIN_NEED_CONSOLE FALSE
-
-/* Features for the GINPUT sub-system. */
-#define GINPUT_NEED_MOUSE FALSE
-
#endif /* _GFXCONF_H */
diff --git a/demos/modules/gdisp/gdisp_images_animated/main.c b/demos/modules/gdisp/gdisp_images_animated/main.c
index d5c3d712..8502dcf9 100644
--- a/demos/modules/gdisp/gdisp_images_animated/main.c
+++ b/demos/modules/gdisp/gdisp_images_animated/main.c
@@ -18,8 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
#define USE_IMAGE_CACHE FALSE // Only if you want to get performance at the expense of RAM
@@ -51,11 +49,9 @@ static gdispImage myImage;
*/
int main(void) {
coord_t swidth, sheight;
- systime_t delay;
+ delaytime_t delay;
- halInit(); // Initialize the Hardware
- chSysInit(); // Initialize the OS
- gdispInit(); // Initialize the display
+ gfxInit(); // Initialize the display
gdispClear(MY_BG_COLOR);
@@ -67,7 +63,7 @@ int main(void) {
#if USE_MEMORY_FILE
gdispImageSetMemoryReader(&myImage, testanim);
#else
- gdispImageSetSimulFileReader(&myImage, "testanim.gif");
+ gdispImageSetFileReader(&myImage, "testanim.gif");
#endif
if (gdispImageOpen(&myImage) == GDISP_IMAGE_ERR_OK) {
@@ -87,14 +83,14 @@ int main(void) {
}
SHOW_ERROR(Yellow);
if (delay != TIME_IMMEDIATE)
- chThdSleepMilliseconds(delay);
+ gfxSleepMilliseconds(delay);
}
gdispImageClose(&myImage);
} else
SHOW_ERROR(Red);
while(1) {
- chThdSleepMilliseconds(1000);
+ gfxSleepMilliseconds(1000);
}
return 0;
diff --git a/demos/modules/gdisp/gdisp_text/gfxconf.h b/demos/modules/gdisp/gdisp_text/gfxconf.h
index 007de8e4..01fc2749 100644
--- a/demos/modules/gdisp/gdisp_text/gfxconf.h
+++ b/demos/modules/gdisp/gdisp_text/gfxconf.h
@@ -28,12 +28,13 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
diff --git a/demos/modules/gdisp/gdisp_text/main.c b/demos/modules/gdisp/gdisp_text/main.c
index 4062e07c..042ccc5b 100644
--- a/demos/modules/gdisp/gdisp_text/main.c
+++ b/demos/modules/gdisp/gdisp_text/main.c
@@ -25,8 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
int main(void) {
@@ -34,12 +32,8 @@ int main(void) {
font_t font1, font2, font3, font4;
const char *msg;
- halInit();
- chSysInit();
-
/* Initialize and clear the display */
- gdispInit();
- gdispClear(Black);
+ gfxInit();
// Get the screen size
width = gdispGetWidth();
@@ -73,7 +67,7 @@ int main(void) {
// Wait forever
while(TRUE) {
- chThdSleepMilliseconds(500);
+ gfxSleepMilliseconds(500);
}
}
diff --git a/demos/modules/ginput/touch_driver_test/gfxconf.h b/demos/modules/ginput/touch_driver_test/gfxconf.h
index 87787527..ee96f23c 100644
--- a/demos/modules/ginput/touch_driver_test/gfxconf.h
+++ b/demos/modules/ginput/touch_driver_test/gfxconf.h
@@ -28,6 +28,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GFX_USE_GWIN TRUE
diff --git a/demos/modules/ginput/touch_driver_test/main.c b/demos/modules/ginput/touch_driver_test/main.c
index 80c85273..424b2587 100644
--- a/demos/modules/ginput/touch_driver_test/main.c
+++ b/demos/modules/ginput/touch_driver_test/main.c
@@ -25,10 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ch.h"
-#include "hal.h"
-#include "chprintf.h"
#include "gfx.h"
+#include "chprintf.h"
static GConsoleObject gc;
static GButtonObject gNext;
@@ -49,9 +47,7 @@ int main(void) {
GEventType deviceType;
font_t font;
- halInit(); // Initialise the Hardware
- chSysInit(); // Initialize the OS
- gdispInit(); // Initialize the display
+ gfxInit(); // Initialize the display
// Get the display dimensions
swidth = gdispGetWidth();
diff --git a/demos/modules/graph/gfxconf.h b/demos/modules/graph/gfxconf.h
index ee36fb93..f54cfe1a 100644
--- a/demos/modules/graph/gfxconf.h
+++ b/demos/modules/graph/gfxconf.h
@@ -28,12 +28,14 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GFX_USE_GWIN TRUE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
diff --git a/demos/modules/graph/main.c b/demos/modules/graph/main.c
index 79935083..f74ecb5d 100644
--- a/demos/modules/graph/main.c
+++ b/demos/modules/graph/main.c
@@ -25,8 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
#include "math.h"
@@ -64,11 +62,7 @@ int main(void) {
GHandle gh;
uint16_t i;
- halInit();
- chSysInit();
-
- gdispInit();
- gdispClear(Black);
+ gfxInit();
gh = gwinCreateGraph(&g, 0, 0, gdispGetWidth(), gdispGetHeight());
@@ -92,7 +86,7 @@ int main(void) {
gwinGraphDrawPoints(gh, data, sizeof(data)/sizeof(data[0]));
while(TRUE) {
- chThdSleepMilliseconds(100);
+ gfxSleepMilliseconds(100);
}
}
diff --git a/demos/modules/gtimer/gfxconf.h b/demos/modules/gtimer/gfxconf.h
index 931357a5..8e996d52 100644
--- a/demos/modules/gtimer/gfxconf.h
+++ b/demos/modules/gtimer/gfxconf.h
@@ -28,11 +28,12 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
-#define GFX_USE_GDISP FALSE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
#define GFX_USE_GTIMER TRUE
-#define GFX_USE_GINPUT FALSE
#endif /* _GFXCONF_H */
diff --git a/demos/modules/gtimer/main.c b/demos/modules/gtimer/main.c
index 403491ea..6d09d594 100644
--- a/demos/modules/gtimer/main.c
+++ b/demos/modules/gtimer/main.c
@@ -25,8 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
GTimer GT1, GT2;
@@ -44,8 +42,7 @@ void callback2(void* arg) {
}
int main(void) {
- halInit();
- chSysInit();
+ gfxInit();
/* initialize the timers */
gtimerInit(&GT1);
@@ -58,7 +55,7 @@ int main(void) {
gtimerStart(&GT2, callback2, NULL, FALSE, 1000);
while(TRUE) {
- chThdSleepMilliseconds(500);
+ gfxSleepMilliseconds(500);
}
return 0;
diff --git a/demos/modules/gwin/basic/gfxconf.h b/demos/modules/gwin/basic/gfxconf.h
index e567e5a0..dd8376bf 100644
--- a/demos/modules/gwin/basic/gfxconf.h
+++ b/demos/modules/gwin/basic/gfxconf.h
@@ -9,12 +9,14 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GFX_USE_GWIN TRUE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
diff --git a/demos/modules/gwin/basic/main.c b/demos/modules/gwin/basic/main.c
index a0326fac..624eed18 100644
--- a/demos/modules/gwin/basic/main.c
+++ b/demos/modules/gwin/basic/main.c
@@ -18,20 +18,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
/* The handles for our two Windows */
GHandle GW1, GW2;
int main(void) {
- halInit();
- chSysInit();
coord_t i, j;
/* Initialize and clear the display */
- gdispInit();
+ gfxInit();
gdispClear(Lime);
/* Create two windows */
@@ -61,7 +57,7 @@ int main(void) {
gwinFillCircle(GW2, 20, 20, 15);
while(TRUE) {
- chThdSleepMilliseconds(500);
+ gfxSleepMilliseconds(500);
}
}
diff --git a/demos/modules/gwin/console/gfxconf.h b/demos/modules/gwin/console/gfxconf.h
index 178beb86..46361c9b 100644
--- a/demos/modules/gwin/console/gfxconf.h
+++ b/demos/modules/gwin/console/gfxconf.h
@@ -9,12 +9,14 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GFX_USE_GWIN TRUE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
diff --git a/demos/modules/gwin/console/main.c b/demos/modules/gwin/console/main.c
index 90ebf86f..d968b920 100644
--- a/demos/modules/gwin/console/main.c
+++ b/demos/modules/gwin/console/main.c
@@ -18,10 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ch.h"
-#include "hal.h"
-#include "chprintf.h"
#include "gfx.h"
+#include "chprintf.h"
/* The handles for our three consoles */
GHandle GW1, GW2, GW3;
@@ -33,12 +31,8 @@ int main(void) {
uint8_t i;
font_t font1, font2;
- halInit();
- chSysInit();
-
/* initialize and clear the display */
- gdispInit();
- gdispClear(Black);
+ gfxInit();
font1 = gdispOpenFont("UI2 Double");
font2 = gdispOpenFont("Small");
@@ -81,7 +75,7 @@ int main(void) {
}
while(TRUE) {
- chThdSleepMilliseconds(500);
+ gfxSleepMilliseconds(500);
}
}
diff --git a/demos/modules/gwin/slider/gfxconf.h b/demos/modules/gwin/slider/gfxconf.h
index 947fc4c8..84698905 100644
--- a/demos/modules/gwin/slider/gfxconf.h
+++ b/demos/modules/gwin/slider/gfxconf.h
@@ -9,6 +9,11 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GFX_USE_GWIN TRUE
diff --git a/demos/modules/gwin/slider/main.c b/demos/modules/gwin/slider/main.c
index 19a56f6a..f1d4248d 100644
--- a/demos/modules/gwin/slider/main.c
+++ b/demos/modules/gwin/slider/main.c
@@ -18,8 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
#include "chprintf.h"
@@ -35,11 +33,7 @@ int main(void) {
GEventGWinSlider * pSliderEvent;
BaseSequentialStream *consout;
- halInit(); // Initialize the Hardware
- chSysInit(); // Initialize the OS
- gdispInit(); // Initialize the display
-
- gdispClear(Black);
+ gfxInit(); // Initialize the display
// Get the display dimensions
swidth = gdispGetWidth();
diff --git a/demos/modules/tdisp/gfxconf.h b/demos/modules/tdisp/gfxconf.h
index cdc0dfdd..eeaaa2a2 100644
--- a/demos/modules/tdisp/gfxconf.h
+++ b/demos/modules/tdisp/gfxconf.h
@@ -28,47 +28,13 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
+/* The operating system to use - one of these must be defined */
+#define GFX_USE_OS_CHIBIOS TRUE
+#define GFX_USE_OS_WIN32 FALSE
+#define GFX_USE_OS_POSIX FALSE
+
/* GFX sub-systems to turn on */
#define GFX_USE_TDISP TRUE
-#define GFX_USE_GDISP FALSE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
-
-/* Features for the GDISP subsystem */
-#define GDISP_NEED_VALIDATION FALSE
-#define GDISP_NEED_CLIP FALSE
-#define GDISP_NEED_TEXT FALSE
-#define GDISP_NEED_CIRCLE FALSE
-#define GDISP_NEED_ELLIPSE FALSE
-#define GDISP_NEED_ARC FALSE
-#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD FALSE
-#define GDISP_NEED_CONTROL FALSE
-#define GDISP_NEED_MULTITHREAD FALSE
-#define GDISP_NEED_ASYNC FALSE
-#define GDISP_NEED_MSGAPI FALSE
-
-/* Features for the TDISP subsystem */
-#define TDISP_NEED_4BIT_MODE TRUE
-#define TDISP_NEED_8BIT_MODE FALSE
-
-/* Builtin Fonts */
-#define GDISP_INCLUDE_FONT_SMALL FALSE
-#define GDISP_INCLUDE_FONT_LARGER FALSE
-#define GDISP_INCLUDE_FONT_UI1 FALSE
-#define GDISP_INCLUDE_FONT_UI2 FALSE
-#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
-
-/* GWIN */
-#define GWIN_NEED_CONSOLE FALSE
-#define GWIN_NEED_GRAPH FALSE
-#define GWIN_NEED_BUTTON FALSE
-#define GWIN_NEED_DIAL FALSE
-
-/* GINPUT */
-#define GINPUT_NEED_MOUSE FALSE
#endif /* _GFXCONF_H */
diff --git a/demos/modules/tdisp/main.c b/demos/modules/tdisp/main.c
index bf6f6c46..face28c1 100644
--- a/demos/modules/tdisp/main.c
+++ b/demos/modules/tdisp/main.c
@@ -25,21 +25,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ch.h"
-#include "hal.h"
#include "gfx.h"
int main(void) {
uint8_t charmap[8];
- halInit();
- chSysInit();
-
- tdispInit();
-
- /* reset cursor position and clear the screen */
- tdispHome();
- tdispClear();
+ gfxInit();
/* set cursor position and draw single characters */
tdispSetCursor(4, 0);
@@ -68,7 +59,7 @@ int main(void) {
tdispDrawChar(0);
while(TRUE) {
- chThdSleepMilliseconds(250);
+ gfxSleepMilliseconds(250);
}
}