aboutsummaryrefslogtreecommitdiffstats
path: root/demos/modules/gadc
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/modules/gadc
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/modules/gadc')
-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
4 files changed, 12 insertions, 16 deletions
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();