GOS module, for operating system independance

GMISC fast floating point trig
GMISC fast fixed point trig
This commit is contained in:
inmarket 2013-05-25 01:26:52 +10:00
parent 42006a67b5
commit 7fbfde42aa
122 changed files with 2216 additions and 960 deletions

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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.. */

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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);
}
}

View File

@ -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

View File

@ -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);
}
}

View File

@ -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 */

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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

View File

@ -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);
}
}

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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);
}
}

View File

@ -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 */

View File

@ -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;

View File

@ -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

View File

@ -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);
}
}

View File

@ -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

View File

@ -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);
}
}

View File

@ -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

View File

@ -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();

View File

@ -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 */

View File

@ -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);
}
}

View File

@ -14,8 +14,6 @@
* @{
*/
#include "ch.h"
#include "hal.h"
#include "gfx.h"
#if GFX_USE_GADC

View File

@ -13,8 +13,6 @@
*
* @{
*/
#include "ch.h"
#include "hal.h"
/**
* We are now implementing the driver - pull in our channel table

View File

@ -13,8 +13,6 @@
* @{
*/
#include "ch.h"
#include "hal.h"
#include "gfx.h"
#include "HX8347D.h"
@ -57,8 +55,8 @@
#define write_ram(color1, color2) { write_index(0x22); write_ram8(color1,color2); }
#define stream_start() { write_index(0x22); spiStart(&SPID1, &spi1cfg2); }
#define stream_stop() {while(((SPI1->SR & SPI_SR_TXE) == 0) || ((SPI1->SR & SPI_SR_BSY) != 0));palSetPad(GPIOA, 4);spiStart(&SPID1, &spi1cfg1); }
#define delay(us) chThdSleepMicroseconds(us)
#define delayms(ms) chThdSleepMilliseconds(ms)
#define delay(us) gfxSleepMicroseconds(us)
#define delayms(ms) gfxSleepMilliseconds(ms)
static inline void set_cursor(coord_t x, coord_t y) {
write_reg(HX8347D_REG_SCL, (uint8_t) x);

View File

@ -13,8 +13,6 @@
* @{
*/
#include "ch.h"
#include "hal.h"
#include "gfx.h"
#if GFX_USE_GDISP /*|| defined(__DOXYGEN__)*/
@ -66,7 +64,7 @@ uint32_t DISPLAY_CODE;
/* Driver local functions. */
/*===========================================================================*/
static inline void lld_lcdDelay(uint16_t us) {
chThdSleepMicroseconds(us);
gfxSleepMicroseconds(us);
}
static inline void lld_lcdWriteIndex(uint16_t index) {

View File

@ -13,8 +13,6 @@
* @{
*/
#include "ch.h"
#include "hal.h"
#include "gfx.h"
#if GFX_USE_GDISP /*|| defined(__DOXYGEN__)*/
@ -64,7 +62,7 @@ uint32_t DISPLAY_CODE;
/* Driver local functions. */
/*===========================================================================*/
static inline void lld_lcdDelay(uint16_t us) {
chThdSleepMicroseconds(us);
gfxSleepMicroseconds(us);
}
static inline void lld_lcdWriteIndex(uint16_t index) {

View File

@ -14,8 +14,6 @@
* @{
*/
#include "ch.h"
#include "hal.h"
#include "gfx.h"
#if GFX_USE_GDISP /*|| defined(__DOXYGEN__)*/
@ -60,8 +58,8 @@
#define write_reg(reg, data) { write_index(reg); write_data(data); }
#define stream_start() write_index(0x2C);
#define stream_stop()
#define delay(us) chThdSleepMicroseconds(us)
#define delayms(ms) chThdSleepMilliseconds(ms)