From 0f3f8f68f87233bf59c3fa68c3dfe1f492a1a478 Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 20 Aug 2014 17:42:53 +1000 Subject: [PATCH] Rename lots of files to help prevent compile time name conflicts. --- demos/modules/gadc/gwinosc.c | 2 +- demos/modules/gaudio/oscilloscope/gwinosc.c | 2 +- drivers/gaudio/vs1053/driver.mk | 2 +- src/gadc/{gadc.c => gadc_gadc.c} | 4 +- src/gadc/sys_make.mk | 2 +- src/gaudio/{gaudio.c => gaudio_gaudio.c} | 6 +- src/gaudio/sys_make.mk | 2 +- src/gdisp/fonts/build_fonts.sh | 2 +- src/gdisp/fonts/fonts.h | 34 +- src/gdisp/{colors.h => gdisp_colors.h} | 2 +- src/gdisp/{fonts.c => gdisp_fonts.c} | 4 +- src/gdisp/{gdisp.c => gdisp_gdisp.c} | 6 +- src/gdisp/{image.c => gdisp_image.c} | 2 +- src/gdisp/{image.h => gdisp_image.h} | 2 +- src/gdisp/{image_bmp.c => gdisp_image_bmp.c} | 0 src/gdisp/{image_gif.c => gdisp_image_gif.c} | 0 src/gdisp/{image_jpg.c => gdisp_image_jpg.c} | 0 .../{image_native.c => gdisp_image_native.c} | 0 src/gdisp/{image_png.c => gdisp_image_png.c} | 0 src/gdisp/sys_defs.h | 4 +- src/gdisp/sys_make.mk | 16 +- src/gevent/{gevent.c => gevent_gevent.c} | 2 +- src/gevent/sys_make.mk | 2 +- ..._diskio.c => gfile_fatfs_diskio_chibios.c} | 8 +- ...{fatfs_wrapper.c => gfile_fatfs_wrapper.c} | 4 +- ...{fatfs_wrapper.h => gfile_fatfs_wrapper.h} | 2 +- .../{inc_chibiosfs.c => gfile_fs_chibios.c} | 0 src/gfile/{inc_fatfs.c => gfile_fs_fatfs.c} | 0 src/gfile/{inc_memfs.c => gfile_fs_mem.c} | 0 .../{inc_nativefs.c => gfile_fs_native.c} | 1 - .../{inc_petitfs.c => gfile_fs_petitfs.c} | 0 src/gfile/{inc_ramfs.c => gfile_fs_ram.c} | 0 src/gfile/{inc_romfs.c => gfile_fs_rom.c} | 0 .../{inc_strings.c => gfile_fs_strings.c} | 0 src/gfile/{gfile.c => gfile_gfile.c} | 2 +- ...iskio.c => gfile_petitfs_diskio_chibios.c} | 8 +- ...itfs_wrapper.c => gfile_petitfs_wrapper.c} | 4 +- ...itfs_wrapper.h => gfile_petitfs_wrapper.h} | 2 +- src/gfile/{inc_printg.c => gfile_printg.c} | 0 src/gfile/{inc_scang.c => gfile_scang.c} | 0 src/gfile/{inc_stdio.c => gfile_stdio.c} | 0 src/gfile/sys_make.mk | 32 +- src/ginput/{dial.c => ginput_dial.c} | 4 +- src/ginput/{dial.h => ginput_dial.h} | 2 +- src/ginput/{ginput.c => ginput_ginput.c} | 2 +- src/ginput/{keyboard.c => ginput_keyboard.c} | 46 +- src/ginput/{keyboard.h => ginput_keyboard.h} | 2 +- src/ginput/{mouse.c => ginput_mouse.c} | 4 +- src/ginput/{mouse.h => ginput_mouse.h} | 2 +- src/ginput/{toggle.c => ginput_toggle.c} | 312 ++++++------ src/ginput/{toggle.h => ginput_toggle.h} | 2 +- src/ginput/sys_defs.h | 8 +- src/ginput/sys_make.mk | 10 +- src/gmisc/{arrayops.c => gmisc_arrayops.c} | 452 ++++++++--------- src/gmisc/{gmisc.c => gmisc_gmisc.c} | 2 +- src/gmisc/{trig.c => gmisc_trig.c} | 2 +- src/gmisc/sys_make.mk | 6 +- src/gqueue/{gqueue.c => gqueue_gqueue.c} | 2 +- src/gqueue/sys_make.mk | 2 +- src/gtimer/{gtimer.c => gtimer_gtimer.c} | 476 +++++++++--------- src/gtimer/sys_make.mk | 2 +- src/gwin/{button.c => gwin_button.c} | 4 +- src/gwin/{button.h => gwin_button.h} | 4 +- src/gwin/{checkbox.c => gwin_checkbox.c} | 4 +- src/gwin/{checkbox.h => gwin_checkbox.h} | 4 +- src/gwin/{class_gwin.h => gwin_class.h} | 4 +- src/gwin/{console.c => gwin_console.c} | 4 +- src/gwin/{console.h => gwin_console.h} | 4 +- src/gwin/{gcontainer.c => gwin_container.c} | 4 +- src/gwin/{gcontainer.h => gwin_container.h} | 6 +- src/gwin/{frame.c => gwin_frame.c} | 4 +- src/gwin/{frame.h => gwin_frame.h} | 4 +- src/gwin/gwin_gl3d.c | 2 +- src/gwin/gwin_gl3d.h | 2 +- src/gwin/{graph.c => gwin_graph.c} | 4 +- src/gwin/{graph.h => gwin_graph.h} | 4 +- src/gwin/{gwin.c => gwin_gwin.c} | 7 +- src/gwin/{gimage.c => gwin_image.c} | 4 +- src/gwin/{gimage.h => gwin_image.h} | 4 +- src/gwin/{label.c => gwin_label.c} | 4 +- src/gwin/{label.h => gwin_label.h} | 4 +- src/gwin/{list.c => gwin_list.c} | 4 +- src/gwin/{list.h => gwin_list.h} | 4 +- .../{progressbar.c => gwin_progressbar.c} | 4 +- .../{progressbar.h => gwin_progressbar.h} | 3 +- src/gwin/{radio.c => gwin_radio.c} | 4 +- src/gwin/{radio.h => gwin_radio.h} | 4 +- src/gwin/{slider.c => gwin_slider.c} | 4 +- src/gwin/{slider.h => gwin_slider.h} | 4 +- src/gwin/{gwidget.c => gwin_widget.c} | 7 +- src/gwin/{gwidget.h => gwin_widget.h} | 18 +- src/gwin/{gwm.c => gwin_wm.c} | 9 +- src/gwin/sys_defs.h | 12 +- src/gwin/sys_make.mk | 30 +- 94 files changed, 857 insertions(+), 828 deletions(-) rename src/gadc/{gadc.c => gadc_gadc.c} (99%) rename src/gaudio/{gaudio.c => gaudio_gaudio.c} (98%) rename src/gdisp/{colors.h => gdisp_colors.h} (99%) rename src/gdisp/{fonts.c => gdisp_fonts.c} (96%) rename src/gdisp/{gdisp.c => gdisp_gdisp.c} (99%) rename src/gdisp/{image.c => gdisp_image.c} (99%) rename src/gdisp/{image.h => gdisp_image.h} (99%) rename src/gdisp/{image_bmp.c => gdisp_image_bmp.c} (100%) rename src/gdisp/{image_gif.c => gdisp_image_gif.c} (100%) rename src/gdisp/{image_jpg.c => gdisp_image_jpg.c} (100%) rename src/gdisp/{image_native.c => gdisp_image_native.c} (100%) rename src/gdisp/{image_png.c => gdisp_image_png.c} (100%) rename src/gevent/{gevent.c => gevent_gevent.c} (99%) rename src/gfile/{fatfs_chibios_diskio.c => gfile_fatfs_diskio_chibios.c} (98%) rename src/gfile/{fatfs_wrapper.c => gfile_fatfs_wrapper.c} (97%) rename src/gfile/{fatfs_wrapper.h => gfile_fatfs_wrapper.h} (94%) rename src/gfile/{inc_chibiosfs.c => gfile_fs_chibios.c} (100%) rename src/gfile/{inc_fatfs.c => gfile_fs_fatfs.c} (100%) rename src/gfile/{inc_memfs.c => gfile_fs_mem.c} (100%) rename src/gfile/{inc_nativefs.c => gfile_fs_native.c} (99%) rename src/gfile/{inc_petitfs.c => gfile_fs_petitfs.c} (100%) rename src/gfile/{inc_ramfs.c => gfile_fs_ram.c} (100%) rename src/gfile/{inc_romfs.c => gfile_fs_rom.c} (100%) rename src/gfile/{inc_strings.c => gfile_fs_strings.c} (100%) rename src/gfile/{gfile.c => gfile_gfile.c} (99%) rename src/gfile/{petitfs_chibios_diskio.c => gfile_petitfs_diskio_chibios.c} (94%) rename src/gfile/{petitfs_wrapper.c => gfile_petitfs_wrapper.c} (84%) rename src/gfile/{petitfs_wrapper.h => gfile_petitfs_wrapper.h} (92%) rename src/gfile/{inc_printg.c => gfile_printg.c} (100%) rename src/gfile/{inc_scang.c => gfile_scang.c} (100%) rename src/gfile/{inc_stdio.c => gfile_stdio.c} (100%) rename src/ginput/{dial.c => ginput_dial.c} (98%) rename src/ginput/{dial.h => ginput_dial.h} (98%) rename src/ginput/{ginput.c => ginput_ginput.c} (93%) rename src/ginput/{keyboard.c => ginput_keyboard.c} (90%) rename src/ginput/{keyboard.h => ginput_keyboard.h} (99%) rename src/ginput/{mouse.c => ginput_mouse.c} (99%) rename src/ginput/{mouse.h => ginput_mouse.h} (99%) rename src/ginput/{toggle.c => ginput_toggle.c} (95%) rename src/ginput/{toggle.h => ginput_toggle.h} (98%) rename src/gmisc/{arrayops.c => gmisc_arrayops.c} (98%) rename src/gmisc/{gmisc.c => gmisc_gmisc.c} (90%) rename src/gmisc/{trig.c => gmisc_trig.c} (99%) rename src/gqueue/{gqueue.c => gqueue_gqueue.c} (99%) rename src/gtimer/{gtimer.c => gtimer_gtimer.c} (95%) rename src/gwin/{button.c => gwin_button.c} (99%) rename src/gwin/{button.h => gwin_button.h} (98%) rename src/gwin/{checkbox.c => gwin_checkbox.c} (98%) rename src/gwin/{checkbox.h => gwin_checkbox.h} (97%) rename src/gwin/{class_gwin.h => gwin_class.h} (98%) rename src/gwin/{console.c => gwin_console.c} (99%) rename src/gwin/{console.h => gwin_console.h} (98%) rename src/gwin/{gcontainer.c => gwin_container.c} (98%) rename src/gwin/{gcontainer.h => gwin_container.h} (97%) rename src/gwin/{frame.c => gwin_frame.c} (99%) rename src/gwin/{frame.h => gwin_frame.h} (97%) rename src/gwin/{graph.c => gwin_graph.c} (99%) rename src/gwin/{graph.h => gwin_graph.h} (98%) rename src/gwin/{gwin.c => gwin_gwin.c} (99%) rename src/gwin/{gimage.c => gwin_image.c} (98%) rename src/gwin/{gimage.h => gwin_image.h} (97%) rename src/gwin/{label.c => gwin_label.c} (98%) rename src/gwin/{label.h => gwin_label.h} (97%) rename src/gwin/{list.c => gwin_list.c} (99%) rename src/gwin/{list.h => gwin_list.h} (99%) rename src/gwin/{progressbar.c => gwin_progressbar.c} (99%) rename src/gwin/{progressbar.h => gwin_progressbar.h} (98%) rename src/gwin/{radio.c => gwin_radio.c} (99%) rename src/gwin/{radio.h => gwin_radio.h} (98%) rename src/gwin/{slider.c => gwin_slider.c} (99%) rename src/gwin/{slider.h => gwin_slider.h} (98%) rename src/gwin/{gwidget.c => gwin_widget.c} (99%) rename src/gwin/{gwidget.h => gwin_widget.h} (97%) rename src/gwin/{gwm.c => gwin_wm.c} (99%) diff --git a/demos/modules/gadc/gwinosc.c b/demos/modules/gadc/gwinosc.c index 84e7d645..f29107bc 100644 --- a/demos/modules/gadc/gwinosc.c +++ b/demos/modules/gadc/gwinosc.c @@ -36,7 +36,7 @@ #include "gwinosc.h" /* Include internal GWIN routines so we can build our own superset class */ -#include "src/gwin/class_gwin.h" +#include "src/gwin/gwin_class.h" /* How many flat-line sample before we trigger */ #define FLATLINE_SAMPLES 8 diff --git a/demos/modules/gaudio/oscilloscope/gwinosc.c b/demos/modules/gaudio/oscilloscope/gwinosc.c index 6b51232b..fcad648f 100644 --- a/demos/modules/gaudio/oscilloscope/gwinosc.c +++ b/demos/modules/gaudio/oscilloscope/gwinosc.c @@ -43,7 +43,7 @@ #include "gwinosc.h" /* Include internal GWIN routines so we can build our own superset class */ -#include "src/gwin/class_gwin.h" +#include "src/gwin/gwin_class.h" /* How many flat-line sample before we trigger */ #define FLATLINE_SAMPLES 8 diff --git a/drivers/gaudio/vs1053/driver.mk b/drivers/gaudio/vs1053/driver.mk index 54ad07de..faf92852 100644 --- a/drivers/gaudio/vs1053/driver.mk +++ b/drivers/gaudio/vs1053/driver.mk @@ -4,4 +4,4 @@ GFXSRC += $(GFXLIB)/drivers/gaudio/vs1053/gaudio_play_lld.c # Required include directories GFXINC += $(GFXLIB)/drivers/gaudio/vs1053 -GFXDEFS += -DGFX_USE_GTIMER=GFX_USE_GAUDIO +#GFXDEFS += -DGFX_USE_GTIMER=GFX_USE_GAUDIO diff --git a/src/gadc/gadc.c b/src/gadc/gadc_gadc.c similarity index 99% rename from src/gadc/gadc.c rename to src/gadc/gadc_gadc.c index d307519b..5ac8e53c 100644 --- a/src/gadc/gadc.c +++ b/src/gadc/gadc_gadc.c @@ -6,7 +6,7 @@ */ /** - * @file src/gadc/gadc.c + * @file src/gadc/gadc_gadc.c * @brief GADC sub-system code. * * @addtogroup GADC @@ -17,7 +17,7 @@ #if GFX_USE_GADC /* Include the driver defines */ -#include "src/gadc/driver.h" +#include "driver.h" #if GADC_MAX_HIGH_SPEED_SAMPLERATE > GADC_MAX_SAMPLE_FREQUENCY/2 #error "GADC: GADC_MAX_HIGH_SPEED_SAMPLERATE has been set too high. It must be less than half the maximum CPU rate" diff --git a/src/gadc/sys_make.mk b/src/gadc/sys_make.mk index 05b1e9cc..21a07dbe 100644 --- a/src/gadc/sys_make.mk +++ b/src/gadc/sys_make.mk @@ -1 +1 @@ -GFXSRC += $(GFXLIB)/src/gadc/gadc.c +GFXSRC += $(GFXLIB)/src/gadc/gadc_gadc.c diff --git a/src/gaudio/gaudio.c b/src/gaudio/gaudio_gaudio.c similarity index 98% rename from src/gaudio/gaudio.c rename to src/gaudio/gaudio_gaudio.c index ab1f95ee..bb12e6d2 100644 --- a/src/gaudio/gaudio.c +++ b/src/gaudio/gaudio_gaudio.c @@ -6,7 +6,7 @@ */ /** - * @file src/gaudio/gaudio.c + * @file src/gaudio/gaudio_gaudio.c * @brief GAUDIO sub-system code. * * @addtogroup GAUDIO @@ -17,7 +17,7 @@ #if GFX_USE_GAUDIO #if GAUDIO_NEED_PLAY - #include "src/gaudio/driver_play.h" + #include "driver_play.h" static gfxQueueASync playList; static gfxSem playComplete; @@ -32,7 +32,7 @@ #endif #if GAUDIO_NEED_RECORD - #include "src/gaudio/driver_record.h" + #include "driver_record.h" static gfxQueueGSync recordList; static uint16_t recordFlags; diff --git a/src/gaudio/sys_make.mk b/src/gaudio/sys_make.mk index 438892c0..ea02e010 100644 --- a/src/gaudio/sys_make.mk +++ b/src/gaudio/sys_make.mk @@ -1 +1 @@ -GFXSRC += $(GFXLIB)/src/gaudio/gaudio.c +GFXSRC += $(GFXLIB)/src/gaudio/gaudio_gaudio.c diff --git a/src/gdisp/fonts/build_fonts.sh b/src/gdisp/fonts/build_fonts.sh index 4ce93a40..b40f7fb6 100644 --- a/src/gdisp/fonts/build_fonts.sh +++ b/src/gdisp/fonts/build_fonts.sh @@ -72,7 +72,7 @@ for file in *.c; do defname='GDISP_INCLUDE_FONT_'$upper echo '#if defined('$defname') && '$defname >> fonts.h echo '#define GDISP_FONT_FOUND' >> fonts.h - echo '#include "src/gdisp/fonts/'$file'"' >> fonts.h + echo '#include "'$file'"' >> fonts.h echo '#endif' >> fonts.h done diff --git a/src/gdisp/fonts/fonts.h b/src/gdisp/fonts/fonts.h index af851dbd..253d0e2d 100644 --- a/src/gdisp/fonts/fonts.h +++ b/src/gdisp/fonts/fonts.h @@ -3,87 +3,87 @@ #if defined(GDISP_INCLUDE_FONT_DEJAVUSANS10) && GDISP_INCLUDE_FONT_DEJAVUSANS10 #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/DejaVuSans10.c" +#include "DejaVuSans10.c" #endif #if defined(GDISP_INCLUDE_FONT_DEJAVUSANS12_AA) && GDISP_INCLUDE_FONT_DEJAVUSANS12_AA #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/DejaVuSans12_aa.c" +#include "DejaVuSans12_aa.c" #endif #if defined(GDISP_INCLUDE_FONT_DEJAVUSANS12) && GDISP_INCLUDE_FONT_DEJAVUSANS12 #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/DejaVuSans12.c" +#include "DejaVuSans12.c" #endif #if defined(GDISP_INCLUDE_FONT_DEJAVUSANS16_AA) && GDISP_INCLUDE_FONT_DEJAVUSANS16_AA #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/DejaVuSans16_aa.c" +#include "DejaVuSans16_aa.c" #endif #if defined(GDISP_INCLUDE_FONT_DEJAVUSANS16) && GDISP_INCLUDE_FONT_DEJAVUSANS16 #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/DejaVuSans16.c" +#include "DejaVuSans16.c" #endif #if defined(GDISP_INCLUDE_FONT_DEJAVUSANS24_AA) && GDISP_INCLUDE_FONT_DEJAVUSANS24_AA #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/DejaVuSans24_aa.c" +#include "DejaVuSans24_aa.c" #endif #if defined(GDISP_INCLUDE_FONT_DEJAVUSANS24) && GDISP_INCLUDE_FONT_DEJAVUSANS24 #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/DejaVuSans24.c" +#include "DejaVuSans24.c" #endif #if defined(GDISP_INCLUDE_FONT_DEJAVUSANS32_AA) && GDISP_INCLUDE_FONT_DEJAVUSANS32_AA #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/DejaVuSans32_aa.c" +#include "DejaVuSans32_aa.c" #endif #if defined(GDISP_INCLUDE_FONT_DEJAVUSANS32) && GDISP_INCLUDE_FONT_DEJAVUSANS32 #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/DejaVuSans32.c" +#include "DejaVuSans32.c" #endif #if defined(GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA) && GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/DejaVuSansBold12_aa.c" +#include "DejaVuSansBold12_aa.c" #endif #if defined(GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12) && GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/DejaVuSansBold12.c" +#include "DejaVuSansBold12.c" #endif #if defined(GDISP_INCLUDE_FONT_FIXED_10X20) && GDISP_INCLUDE_FONT_FIXED_10X20 #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/fixed_10x20.c" +#include "fixed_10x20.c" #endif #if defined(GDISP_INCLUDE_FONT_FIXED_5X8) && GDISP_INCLUDE_FONT_FIXED_5X8 #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/fixed_5x8.c" +#include "fixed_5x8.c" #endif #if defined(GDISP_INCLUDE_FONT_FIXED_7X14) && GDISP_INCLUDE_FONT_FIXED_7X14 #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/fixed_7x14.c" +#include "fixed_7x14.c" #endif #if defined(GDISP_INCLUDE_FONT_LARGENUMBERS) && GDISP_INCLUDE_FONT_LARGENUMBERS #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/LargeNumbers.c" +#include "LargeNumbers.c" #endif #if defined(GDISP_INCLUDE_FONT_UI1) && GDISP_INCLUDE_FONT_UI1 #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/UI1.c" +#include "UI1.c" #endif #if defined(GDISP_INCLUDE_FONT_UI2) && GDISP_INCLUDE_FONT_UI2 #define GDISP_FONT_FOUND -#include "src/gdisp/fonts/UI2.c" +#include "UI2.c" #endif #if defined(GDISP_INCLUDE_USER_FONTS) && GDISP_INCLUDE_USER_FONTS diff --git a/src/gdisp/colors.h b/src/gdisp/gdisp_colors.h similarity index 99% rename from src/gdisp/colors.h rename to src/gdisp/gdisp_colors.h index 6e9a7663..b764ccfe 100644 --- a/src/gdisp/colors.h +++ b/src/gdisp/gdisp_colors.h @@ -6,7 +6,7 @@ */ /** - * @file src/gdisp/colors.h + * @file src/gdisp/gdisp_colors.h * @brief GDISP color definitions header file. * * @defgroup Colors Colors diff --git a/src/gdisp/fonts.c b/src/gdisp/gdisp_fonts.c similarity index 96% rename from src/gdisp/fonts.c rename to src/gdisp/gdisp_fonts.c index ea8d1615..cdb8e075 100644 --- a/src/gdisp/fonts.c +++ b/src/gdisp/gdisp_fonts.c @@ -6,7 +6,7 @@ */ /** - * @file src/gdisp/fonts.c + * @file src/gdisp/gdisp_fonts.c * @brief GDISP Font Handling. * * @addtogroup GDISP @@ -17,7 +17,7 @@ #if GFX_USE_GDISP && GDISP_NEED_TEXT -#include "mcufont.h" +#include "mcufont/mcufont.h" /* Custom flag to indicate dynamically allocated font */ #define FONT_FLAG_DYNAMIC 0x80 diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp_gdisp.c similarity index 99% rename from src/gdisp/gdisp.c rename to src/gdisp/gdisp_gdisp.c index b8b4a847..02ee4711 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp_gdisp.c @@ -6,7 +6,7 @@ */ /** - * @file src/gdisp/gdisp.c + * @file src/gdisp/gdisp_gdisp.c * @brief GDISP Driver code. * * @addtogroup GDISP @@ -17,7 +17,7 @@ #if GFX_USE_GDISP /* Include the low level driver information */ -#include "src/gdisp/driver.h" +#include "driver.h" #if 1 #undef INLINE @@ -2768,7 +2768,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co #endif #if GDISP_NEED_TEXT - #include "mcufont.h" + #include "mcufont/mcufont.h" #if GDISP_NEED_ANTIALIAS && GDISP_HARDWARE_PIXELREAD static void drawcharline(int16_t x, int16_t y, uint8_t count, uint8_t alpha, void *state) { diff --git a/src/gdisp/image.c b/src/gdisp/gdisp_image.c similarity index 99% rename from src/gdisp/image.c rename to src/gdisp/gdisp_image.c index e2b7d758..2851a7c8 100644 --- a/src/gdisp/image.c +++ b/src/gdisp/gdisp_image.c @@ -6,7 +6,7 @@ */ /** - * @file src/gdisp/image.c + * @file src/gdisp/gdisp_image.c * @brief GDISP generic image code. * * @defgroup Image Image diff --git a/src/gdisp/image.h b/src/gdisp/gdisp_image.h similarity index 99% rename from src/gdisp/image.h rename to src/gdisp/gdisp_image.h index 76e8bdea..c0941fd5 100644 --- a/src/gdisp/image.h +++ b/src/gdisp/gdisp_image.h @@ -6,7 +6,7 @@ */ /** - * @file src/gdisp/image.h + * @file src/gdisp/gdisp_image.h * @brief GDISP image header file. * * @defgroup Image Image diff --git a/src/gdisp/image_bmp.c b/src/gdisp/gdisp_image_bmp.c similarity index 100% rename from src/gdisp/image_bmp.c rename to src/gdisp/gdisp_image_bmp.c diff --git a/src/gdisp/image_gif.c b/src/gdisp/gdisp_image_gif.c similarity index 100% rename from src/gdisp/image_gif.c rename to src/gdisp/gdisp_image_gif.c diff --git a/src/gdisp/image_jpg.c b/src/gdisp/gdisp_image_jpg.c similarity index 100% rename from src/gdisp/image_jpg.c rename to src/gdisp/gdisp_image_jpg.c diff --git a/src/gdisp/image_native.c b/src/gdisp/gdisp_image_native.c similarity index 100% rename from src/gdisp/image_native.c rename to src/gdisp/gdisp_image_native.c diff --git a/src/gdisp/image_png.c b/src/gdisp/gdisp_image_png.c similarity index 100% rename from src/gdisp/image_png.c rename to src/gdisp/gdisp_image_png.c diff --git a/src/gdisp/sys_defs.h b/src/gdisp/sys_defs.h index 72fdc621..253de49e 100644 --- a/src/gdisp/sys_defs.h +++ b/src/gdisp/sys_defs.h @@ -185,7 +185,7 @@ extern GDisplay *GDISP; /*===========================================================================*/ /* Load our color definitions and pixel formats */ -#include "colors.h" +#include "gdisp_colors.h" /** * @brief The type of a pixel. @@ -995,7 +995,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co #endif #if GDISP_NEED_IMAGE || defined(__DOXYGEN__) - #include "src/gdisp/image.h" + #include "gdisp_image.h" #endif #endif /* GFX_USE_GDISP */ diff --git a/src/gdisp/sys_make.mk b/src/gdisp/sys_make.mk index a133ce37..cbce4224 100644 --- a/src/gdisp/sys_make.mk +++ b/src/gdisp/sys_make.mk @@ -1,11 +1,11 @@ -GFXSRC += $(GFXLIB)/src/gdisp/gdisp.c \ - $(GFXLIB)/src/gdisp/fonts.c \ - $(GFXLIB)/src/gdisp/image.c \ - $(GFXLIB)/src/gdisp/image_native.c \ - $(GFXLIB)/src/gdisp/image_gif.c \ - $(GFXLIB)/src/gdisp/image_bmp.c \ - $(GFXLIB)/src/gdisp/image_jpg.c \ - $(GFXLIB)/src/gdisp/image_png.c +GFXSRC += $(GFXLIB)/src/gdisp/gdisp_gdisp.c \ + $(GFXLIB)/src/gdisp/gdisp_fonts.c \ + $(GFXLIB)/src/gdisp/gdisp_image.c \ + $(GFXLIB)/src/gdisp/gdisp_image_native.c \ + $(GFXLIB)/src/gdisp/gdisp_image_gif.c \ + $(GFXLIB)/src/gdisp/gdisp_image_bmp.c \ + $(GFXLIB)/src/gdisp/gdisp_image_jpg.c \ + $(GFXLIB)/src/gdisp/gdisp_image_png.c MFDIR = $(GFXLIB)/src/gdisp/mcufont include $(GFXLIB)/src/gdisp/mcufont/mcufont.mk diff --git a/src/gevent/gevent.c b/src/gevent/gevent_gevent.c similarity index 99% rename from src/gevent/gevent.c rename to src/gevent/gevent_gevent.c index 0a6ebcc6..fc45102e 100644 --- a/src/gevent/gevent.c +++ b/src/gevent/gevent_gevent.c @@ -6,7 +6,7 @@ */ /** - * @file src/gevent/gevent.c + * @file src/gevent/gevent_gevent.c * @brief GEVENT Driver code. * * @addtogroup GEVENT diff --git a/src/gevent/sys_make.mk b/src/gevent/sys_make.mk index 5744ae46..f8b88e56 100644 --- a/src/gevent/sys_make.mk +++ b/src/gevent/sys_make.mk @@ -1 +1 @@ -GFXSRC += $(GFXLIB)/src/gevent/gevent.c +GFXSRC += $(GFXLIB)/src/gevent/gevent_gevent.c diff --git a/src/gfile/fatfs_chibios_diskio.c b/src/gfile/gfile_fatfs_diskio_chibios.c similarity index 98% rename from src/gfile/fatfs_chibios_diskio.c rename to src/gfile/gfile_fatfs_diskio_chibios.c index 803c96a0..46ddbb7e 100644 --- a/src/gfile/fatfs_chibios_diskio.c +++ b/src/gfile/gfile_fatfs_diskio_chibios.c @@ -5,11 +5,17 @@ /* disk I/O modules and attach it to FatFs module with common interface. */ /*-----------------------------------------------------------------------*/ +/** + * @file src/gfile/gfile_fatfs_diskio_chibios.c + * @brief GFILE FATFS wrapper. + * + */ + #include "gfx.h" #if GFX_USE_GFILE && GFILE_NEED_FATFS && GFX_USE_OS_CHIBIOS -#include "fatfs_wrapper.h" +#include "gfile_fatfs_wrapper.h" #if HAL_USE_MMC_SPI && HAL_USE_SDC #error "cannot specify both MMC_SPI and SDC drivers" diff --git a/src/gfile/fatfs_wrapper.c b/src/gfile/gfile_fatfs_wrapper.c similarity index 97% rename from src/gfile/fatfs_wrapper.c rename to src/gfile/gfile_fatfs_wrapper.c index 3ac8e427..edcab056 100644 --- a/src/gfile/fatfs_wrapper.c +++ b/src/gfile/gfile_fatfs_wrapper.c @@ -6,7 +6,7 @@ */ /** - * @file src/gfile/fatfs_wrapper.c + * @file src/gfile/gfile_fatfs_wrapper.c * @brief GFILE FATFS wrapper. * */ @@ -15,7 +15,7 @@ #if GFX_USE_GFILE && GFILE_NEED_FATFS -#include "fatfs_wrapper.h" +#include "gfile_fatfs_wrapper.h" // Include the source we want #include "3rdparty/fatfs-0.10b/src/ff.c" diff --git a/src/gfile/fatfs_wrapper.h b/src/gfile/gfile_fatfs_wrapper.h similarity index 94% rename from src/gfile/fatfs_wrapper.h rename to src/gfile/gfile_fatfs_wrapper.h index fc08815b..e66e13bc 100644 --- a/src/gfile/fatfs_wrapper.h +++ b/src/gfile/gfile_fatfs_wrapper.h @@ -6,7 +6,7 @@ */ /** - * @file src/gfile/fatfs_wrapper.h + * @file src/gfile/gfile_fatfs_wrapper.h * @brief GFILE FATFS wrapper. * */ diff --git a/src/gfile/inc_chibiosfs.c b/src/gfile/gfile_fs_chibios.c similarity index 100% rename from src/gfile/inc_chibiosfs.c rename to src/gfile/gfile_fs_chibios.c diff --git a/src/gfile/inc_fatfs.c b/src/gfile/gfile_fs_fatfs.c similarity index 100% rename from src/gfile/inc_fatfs.c rename to src/gfile/gfile_fs_fatfs.c diff --git a/src/gfile/inc_memfs.c b/src/gfile/gfile_fs_mem.c similarity index 100% rename from src/gfile/inc_memfs.c rename to src/gfile/gfile_fs_mem.c diff --git a/src/gfile/inc_nativefs.c b/src/gfile/gfile_fs_native.c similarity index 99% rename from src/gfile/inc_nativefs.c rename to src/gfile/gfile_fs_native.c index b8441ac7..6a9fce94 100644 --- a/src/gfile/inc_nativefs.c +++ b/src/gfile/gfile_fs_native.c @@ -18,7 +18,6 @@ #include #include #include -//#include static bool_t NativeDel(const char *fname); static bool_t NativeExists(const char *fname); diff --git a/src/gfile/inc_petitfs.c b/src/gfile/gfile_fs_petitfs.c similarity index 100% rename from src/gfile/inc_petitfs.c rename to src/gfile/gfile_fs_petitfs.c diff --git a/src/gfile/inc_ramfs.c b/src/gfile/gfile_fs_ram.c similarity index 100% rename from src/gfile/inc_ramfs.c rename to src/gfile/gfile_fs_ram.c diff --git a/src/gfile/inc_romfs.c b/src/gfile/gfile_fs_rom.c similarity index 100% rename from src/gfile/inc_romfs.c rename to src/gfile/gfile_fs_rom.c diff --git a/src/gfile/inc_strings.c b/src/gfile/gfile_fs_strings.c similarity index 100% rename from src/gfile/inc_strings.c rename to src/gfile/gfile_fs_strings.c diff --git a/src/gfile/gfile.c b/src/gfile/gfile_gfile.c similarity index 99% rename from src/gfile/gfile.c rename to src/gfile/gfile_gfile.c index 595bba1f..3547f861 100644 --- a/src/gfile/gfile.c +++ b/src/gfile/gfile_gfile.c @@ -6,7 +6,7 @@ */ /** - * @file src/gfile/gfile.c + * @file src/gfile/gfile_gfile.c * @brief GFILE code. * */ diff --git a/src/gfile/petitfs_chibios_diskio.c b/src/gfile/gfile_petitfs_diskio_chibios.c similarity index 94% rename from src/gfile/petitfs_chibios_diskio.c rename to src/gfile/gfile_petitfs_diskio_chibios.c index dda3f6fc..90e709e4 100644 --- a/src/gfile/petitfs_chibios_diskio.c +++ b/src/gfile/gfile_petitfs_diskio_chibios.c @@ -5,11 +5,17 @@ /* disk I/O modules and attach it to FatFs module with common interface. */ /*-----------------------------------------------------------------------*/ +/** + * @file src/gfile/gfile_petitfs_diskio_chibios.c + * @brief GFILE FATFS wrapper. + * + */ + #include "gfx.h" #if GFX_USE_GFILE && GFILE_NEED_PETITFS && GFX_USE_OS_CHIBIOS -#include "petitfs_wrapper.h" +#include "gfile_petitfs_wrapper.h" #include diff --git a/src/gfile/petitfs_wrapper.c b/src/gfile/gfile_petitfs_wrapper.c similarity index 84% rename from src/gfile/petitfs_wrapper.c rename to src/gfile/gfile_petitfs_wrapper.c index 183edb70..8efc7eb9 100644 --- a/src/gfile/petitfs_wrapper.c +++ b/src/gfile/gfile_petitfs_wrapper.c @@ -6,7 +6,7 @@ */ /** - * @file src/gfile/petitfs_wrapper.c + * @file src/gfile/gfile_petitfs_wrapper.c * @brief GFILE PETITFS wrapper. * */ @@ -15,7 +15,7 @@ #if GFX_USE_GFILE && GFILE_NEED_PETITFS -#include "petitfs_wrapper.h" +#include "gfile_petitfs_wrapper.h" // Include the source we want #include "3rdparty/petitfs-0.03/src/pff.c" diff --git a/src/gfile/petitfs_wrapper.h b/src/gfile/gfile_petitfs_wrapper.h similarity index 92% rename from src/gfile/petitfs_wrapper.h rename to src/gfile/gfile_petitfs_wrapper.h index 4f91bd7f..e9080b9e 100644 --- a/src/gfile/petitfs_wrapper.h +++ b/src/gfile/gfile_petitfs_wrapper.h @@ -6,7 +6,7 @@ */ /** - * @file src/gfile/petitfs_wrapper.h + * @file src/gfile/gfile_petitfs_wrapper.h * @brief GFILE PETITFS wrapper. * */ diff --git a/src/gfile/inc_printg.c b/src/gfile/gfile_printg.c similarity index 100% rename from src/gfile/inc_printg.c rename to src/gfile/gfile_printg.c diff --git a/src/gfile/inc_scang.c b/src/gfile/gfile_scang.c similarity index 100% rename from src/gfile/inc_scang.c rename to src/gfile/gfile_scang.c diff --git a/src/gfile/inc_stdio.c b/src/gfile/gfile_stdio.c similarity index 100% rename from src/gfile/inc_stdio.c rename to src/gfile/gfile_stdio.c diff --git a/src/gfile/sys_make.mk b/src/gfile/sys_make.mk index e14527c6..0a85d1ae 100644 --- a/src/gfile/sys_make.mk +++ b/src/gfile/sys_make.mk @@ -1,18 +1,18 @@ -GFXSRC += $(GFXLIB)/src/gfile/gfile.c \ - $(GFXLIB)/src/gfile/inc_nativefs.c \ - $(GFXLIB)/src/gfile/inc_ramfs.c \ - $(GFXLIB)/src/gfile/inc_romfs.c \ - $(GFXLIB)/src/gfile/inc_fatfs.c \ - $(GFXLIB)/src/gfile/inc_petitfs.c \ - $(GFXLIB)/src/gfile/inc_memfs.c \ - $(GFXLIB)/src/gfile/inc_chibiosfs.c \ - $(GFXLIB)/src/gfile/inc_strings.c \ - $(GFXLIB)/src/gfile/inc_printg.c \ - $(GFXLIB)/src/gfile/inc_scang.c \ - $(GFXLIB)/src/gfile/inc_stdio.c \ - $(GFXLIB)/src/gfile/fatfs_wrapper.c \ - $(GFXLIB)/src/gfile/fatfs_chibios_diskio.c \ - $(GFXLIB)/src/gfile/petitfs_wrapper.c \ - $(GFXLIB)/src/gfile/petitfs_chibios_diskio.c \ +GFXSRC += $(GFXLIB)/src/gfile/gfile_gfile.c \ + $(GFXLIB)/src/gfile/gfile_fs_native.c \ + $(GFXLIB)/src/gfile/gfile_fs_ram.c \ + $(GFXLIB)/src/gfile/gfile_fs_rom.c \ + $(GFXLIB)/src/gfile/gfile_fs_fatfs.c \ + $(GFXLIB)/src/gfile/gfile_fs_petitfs.c \ + $(GFXLIB)/src/gfile/gfile_fs_mem.c \ + $(GFXLIB)/src/gfile/gfile_fs_chibios.c \ + $(GFXLIB)/src/gfile/gfile_fs_strings.c \ + $(GFXLIB)/src/gfile/gfile_printg.c \ + $(GFXLIB)/src/gfile/gfile_scang.c \ + $(GFXLIB)/src/gfile/gfile_stdio.c \ + $(GFXLIB)/src/gfile/gfile_fatfs_wrapper.c \ + $(GFXLIB)/src/gfile/gfile_fatfs_diskio_chibios.c \ + $(GFXLIB)/src/gfile/gfile_petitfs_wrapper.c \ + $(GFXLIB)/src/gfile/gfile_petitfs_diskio_chibios.c \ \ No newline at end of file diff --git a/src/ginput/dial.c b/src/ginput/ginput_dial.c similarity index 98% rename from src/ginput/dial.c rename to src/ginput/ginput_dial.c index 410efc1a..6af89b31 100644 --- a/src/ginput/dial.c +++ b/src/ginput/ginput_dial.c @@ -6,7 +6,7 @@ */ /** - * @file src/ginput/dial.c + * @file src/ginput/ginput_dial.c * @brief GINPUT dial code. * * @defgroup Dial Dial @@ -17,7 +17,7 @@ #if GFX_USE_GINPUT && GINPUT_NEED_DIAL -#include "src/ginput/driver_dial.h" +#include "driver_dial.h" static GTIMER_DECL(DialTimer); static struct DialStatus_t { diff --git a/src/ginput/dial.h b/src/ginput/ginput_dial.h similarity index 98% rename from src/ginput/dial.h rename to src/ginput/ginput_dial.h index f2d3fb58..88a2e165 100644 --- a/src/ginput/dial.h +++ b/src/ginput/ginput_dial.h @@ -6,7 +6,7 @@ */ /** - * @file src/ginput/dial.h + * @file src/ginput/ginput_dial.h * @brief GINPUT GFX User Input subsystem header file. * * @defgroup Dial Dial diff --git a/src/ginput/ginput.c b/src/ginput/ginput_ginput.c similarity index 93% rename from src/ginput/ginput.c rename to src/ginput/ginput_ginput.c index abd16cd8..4197fa25 100644 --- a/src/ginput/ginput.c +++ b/src/ginput/ginput_ginput.c @@ -6,7 +6,7 @@ */ /** - * @file src/ginput/ginput.c + * @file src/ginput/ginput_ginput.c * @brief GINPUT subsystem common code. * * @addtogroup GINPUT diff --git a/src/ginput/keyboard.c b/src/ginput/ginput_keyboard.c similarity index 90% rename from src/ginput/keyboard.c rename to src/ginput/ginput_keyboard.c index 98fad414..5443572b 100644 --- a/src/ginput/keyboard.c +++ b/src/ginput/ginput_keyboard.c @@ -1,23 +1,23 @@ -/* - * This file is subject to the terms of the GFX License. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://ugfx.org/license.html - */ - -/** - * @file src/ginput/keyboard.c - * @brief GINPUT keyboard code. - * - * @defgroup Keyboard Keyboard - * @ingroup GINPUT - * - * @{ - */ - -#include "gfx.h" - -#if (GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD) || defined(__DOXYGEN__) - #error "GINPUT: GINPUT_NEED_KEYBOARD - Not Implemented Yet" -#endif /* GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD */ -/** @} */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://ugfx.org/license.html + */ + +/** + * @file src/ginput/ginput_keyboard.c + * @brief GINPUT keyboard code. + * + * @defgroup Keyboard Keyboard + * @ingroup GINPUT + * + * @{ + */ + +#include "gfx.h" + +#if (GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD) || defined(__DOXYGEN__) + #error "GINPUT: GINPUT_NEED_KEYBOARD - Not Implemented Yet" +#endif /* GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD */ +/** @} */ diff --git a/src/ginput/keyboard.h b/src/ginput/ginput_keyboard.h similarity index 99% rename from src/ginput/keyboard.h rename to src/ginput/ginput_keyboard.h index eff5cc6f..f5737255 100644 --- a/src/ginput/keyboard.h +++ b/src/ginput/ginput_keyboard.h @@ -6,7 +6,7 @@ */ /** - * @file src/ginput/keyboard.h + * @file src/ginput/ginput_keyboard.h * @brief GINPUT GFX User Input subsystem header file. * * @defgroup Keyboard Keyboard diff --git a/src/ginput/mouse.c b/src/ginput/ginput_mouse.c similarity index 99% rename from src/ginput/mouse.c rename to src/ginput/ginput_mouse.c index f7842e33..a0daba98 100644 --- a/src/ginput/mouse.c +++ b/src/ginput/ginput_mouse.c @@ -6,7 +6,7 @@ */ /** - * @file src/ginput/mouse.c + * @file src/ginput/ginput_mouse.c * @brief GINPUT mouse/touch code. * * @defgroup Mouse Mouse @@ -17,7 +17,7 @@ #if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE) || defined(__DOXYGEN__) -#include "src/ginput/driver_mouse.h" +#include "driver_mouse.h" #if GINPUT_MOUSE_NEED_CALIBRATION #if !defined(GFX_USE_GDISP) || !GFX_USE_GDISP diff --git a/src/ginput/mouse.h b/src/ginput/ginput_mouse.h similarity index 99% rename from src/ginput/mouse.h rename to src/ginput/ginput_mouse.h index 79ad1f08..61ad35e0 100644 --- a/src/ginput/mouse.h +++ b/src/ginput/ginput_mouse.h @@ -6,7 +6,7 @@ */ /** - * @file src/ginput/mouse.h + * @file src/ginput/ginput_mouse.h * @brief GINPUT GFX User Input subsystem header file for mouse and touch. * * @defgroup Mouse Mouse diff --git a/src/ginput/toggle.c b/src/ginput/ginput_toggle.c similarity index 95% rename from src/ginput/toggle.c rename to src/ginput/ginput_toggle.c index aad9c862..4c6dc9ae 100644 --- a/src/ginput/toggle.c +++ b/src/ginput/ginput_toggle.c @@ -1,156 +1,156 @@ -/* - * This file is subject to the terms of the GFX License. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://ugfx.org/license.html - */ - -/** - * @file src/ginput/toggle.c - * @brief GINPUT toggle code. - * - * @defgroup Toggle Toggle - * @ingroup GINPUT - * @{ - */ -#include "gfx.h" - -#if (GFX_USE_GINPUT && GINPUT_NEED_TOGGLE) || defined(__DOXYGEN__) - -#include "src/ginput/driver_toggle.h" - -#define GINPUT_TOGGLE_ISON 0x01 -#define GINPUT_TOGGLE_INVERT 0x02 - -static GTIMER_DECL(ToggleTimer); -static struct GEventToggleStatus_t { - uint8_t status; -} ToggleStatus[GINPUT_TOGGLE_NUM_PORTS]; - -// Our polling function -static void TogglePoll(void *param) { - (void) param; - - const GToggleConfig *ptc; - GSourceListener *psl; - GEventToggle *pe; - unsigned i, bits, mask; - uint8_t state; - - // Loop while there are bits to get - for(ptc = GInputToggleConfigTable, i=0; i < GINPUT_TOGGLE_NUM_PORTS; ptc++) { - - // Get the next block of bits - bits = ginput_lld_toggle_getbits(ptc) ^ ptc->invert; - - // Extract the bits of use - for(mask = ptc->mask; i < GINPUT_TOGGLE_NUM_PORTS && mask; mask >>= 1, bits >>= 1) { - // Ignore bits not in our mask - if (!(mask & 1)) - continue; - - // Calculate our new state - state = ToggleStatus[i].status & ~GINPUT_TOGGLE_ISON; - if (state & GINPUT_TOGGLE_INVERT) - bits ^= 1; - if (bits & 1) - state |= GINPUT_TOGGLE_ISON; - - // Has it changed? - if ((state ^ ToggleStatus[i].status) & GINPUT_TOGGLE_ISON) { - - // Save the new state - ToggleStatus[i].status = state; - - // Send the event to the listeners that are interested. - psl = 0; - while ((psl = geventGetSourceListener((GSourceHandle)(ToggleStatus+i), psl))) { - if (!(pe = (GEventToggle *)geventGetEventBuffer(psl))) - continue; - if ((state & GINPUT_TOGGLE_ISON)) { - if ((psl->listenflags & GLISTEN_TOGGLE_ON)) { - pe->type = GEVENT_TOGGLE; - pe->instance = i; - pe->on = TRUE; - geventSendEvent(psl); - } - } else { - if ((psl->listenflags & GLISTEN_TOGGLE_OFF)) { - pe->type = GEVENT_TOGGLE; - pe->instance = i; - pe->on = FALSE; - geventSendEvent(psl); - } - } - } - } - - // Next toggle switch - i++; - } - } -} - -/* Hardware Toggle/Switch/Button Functions */ -GSourceHandle ginputGetToggle(uint16_t instance) { - const GToggleConfig *ptc; - - if (instance >= GINPUT_TOGGLE_NUM_PORTS) - return 0; - - // Do we need to initialise the toggle subsystem? - if (!gtimerIsActive(&ToggleTimer)) { - for(ptc = GInputToggleConfigTable; ptc < GInputToggleConfigTable+sizeof(GInputToggleConfigTable)/sizeof(GInputToggleConfigTable[0]); ptc++) - ginput_lld_toggle_init(ptc); - gtimerStart(&ToggleTimer, TogglePoll, 0, TRUE, GINPUT_TOGGLE_POLL_PERIOD); - } - - // OK - return this input - return (GSourceHandle)(ToggleStatus+instance); -} - -// If invert is true, invert the on/off sense for the toggle -void ginputInvertToggle(uint16_t instance, bool_t invert) { - if (instance >= GINPUT_TOGGLE_NUM_PORTS) - return; - if (invert) { - if (!(ToggleStatus[instance].status & GINPUT_TOGGLE_INVERT)) { - ToggleStatus[instance].status |= GINPUT_TOGGLE_INVERT; - ToggleStatus[instance].status ^= GINPUT_TOGGLE_ISON; - } - } else { - if ((ToggleStatus[instance].status & GINPUT_TOGGLE_INVERT)) { - ToggleStatus[instance].status &= ~GINPUT_TOGGLE_INVERT; - ToggleStatus[instance].status ^= GINPUT_TOGGLE_ISON; - } - } -} - -/* Get the current toggle status. - * Returns FALSE on error (eg invalid instance) - */ -bool_t ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle) { - // Win32 threads don't seem to recognise priority and/or pre-emption - // so we add a sleep here to prevent 100% polled applications from locking up. - gfxSleepMilliseconds(1); - - if (instance >= GINPUT_TOGGLE_NUM_PORTS) - return FALSE; - ptoggle->type = GEVENT_TOGGLE; - ptoggle->instance = instance; - ptoggle->on = (ToggleStatus[instance].status & GINPUT_TOGGLE_ISON) ? TRUE : FALSE; - return TRUE; -} - -/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */ -void ginputToggleWakeup(void) { - gtimerJab(&ToggleTimer); -} - -/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */ -void ginputToggleWakeupI(void) { - gtimerJabI(&ToggleTimer); -} - -#endif /* GFX_USE_GINPUT && GINPUT_NEED_TOGGLE */ -/** @} */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://ugfx.org/license.html + */ + +/** + * @file src/ginput/ginput_toggle.c + * @brief GINPUT toggle code. + * + * @defgroup Toggle Toggle + * @ingroup GINPUT + * @{ + */ +#include "gfx.h" + +#if (GFX_USE_GINPUT && GINPUT_NEED_TOGGLE) || defined(__DOXYGEN__) + +#include "driver_toggle.h" + +#define GINPUT_TOGGLE_ISON 0x01 +#define GINPUT_TOGGLE_INVERT 0x02 + +static GTIMER_DECL(ToggleTimer); +static struct GEventToggleStatus_t { + uint8_t status; +} ToggleStatus[GINPUT_TOGGLE_NUM_PORTS]; + +// Our polling function +static void TogglePoll(void *param) { + (void) param; + + const GToggleConfig *ptc; + GSourceListener *psl; + GEventToggle *pe; + unsigned i, bits, mask; + uint8_t state; + + // Loop while there are bits to get + for(ptc = GInputToggleConfigTable, i=0; i < GINPUT_TOGGLE_NUM_PORTS; ptc++) { + + // Get the next block of bits + bits = ginput_lld_toggle_getbits(ptc) ^ ptc->invert; + + // Extract the bits of use + for(mask = ptc->mask; i < GINPUT_TOGGLE_NUM_PORTS && mask; mask >>= 1, bits >>= 1) { + // Ignore bits not in our mask + if (!(mask & 1)) + continue; + + // Calculate our new state + state = ToggleStatus[i].status & ~GINPUT_TOGGLE_ISON; + if (state & GINPUT_TOGGLE_INVERT) + bits ^= 1; + if (bits & 1) + state |= GINPUT_TOGGLE_ISON; + + // Has it changed? + if ((state ^ ToggleStatus[i].status) & GINPUT_TOGGLE_ISON) { + + // Save the new state + ToggleStatus[i].status = state; + + // Send the event to the listeners that are interested. + psl = 0; + while ((psl = geventGetSourceListener((GSourceHandle)(ToggleStatus+i), psl))) { + if (!(pe = (GEventToggle *)geventGetEventBuffer(psl))) + continue; + if ((state & GINPUT_TOGGLE_ISON)) { + if ((psl->listenflags & GLISTEN_TOGGLE_ON)) { + pe->type = GEVENT_TOGGLE; + pe->instance = i; + pe->on = TRUE; + geventSendEvent(psl); + } + } else { + if ((psl->listenflags & GLISTEN_TOGGLE_OFF)) { + pe->type = GEVENT_TOGGLE; + pe->instance = i; + pe->on = FALSE; + geventSendEvent(psl); + } + } + } + } + + // Next toggle switch + i++; + } + } +} + +/* Hardware Toggle/Switch/Button Functions */ +GSourceHandle ginputGetToggle(uint16_t instance) { + const GToggleConfig *ptc; + + if (instance >= GINPUT_TOGGLE_NUM_PORTS) + return 0; + + // Do we need to initialise the toggle subsystem? + if (!gtimerIsActive(&ToggleTimer)) { + for(ptc = GInputToggleConfigTable; ptc < GInputToggleConfigTable+sizeof(GInputToggleConfigTable)/sizeof(GInputToggleConfigTable[0]); ptc++) + ginput_lld_toggle_init(ptc); + gtimerStart(&ToggleTimer, TogglePoll, 0, TRUE, GINPUT_TOGGLE_POLL_PERIOD); + } + + // OK - return this input + return (GSourceHandle)(ToggleStatus+instance); +} + +// If invert is true, invert the on/off sense for the toggle +void ginputInvertToggle(uint16_t instance, bool_t invert) { + if (instance >= GINPUT_TOGGLE_NUM_PORTS) + return; + if (invert) { + if (!(ToggleStatus[instance].status & GINPUT_TOGGLE_INVERT)) { + ToggleStatus[instance].status |= GINPUT_TOGGLE_INVERT; + ToggleStatus[instance].status ^= GINPUT_TOGGLE_ISON; + } + } else { + if ((ToggleStatus[instance].status & GINPUT_TOGGLE_INVERT)) { + ToggleStatus[instance].status &= ~GINPUT_TOGGLE_INVERT; + ToggleStatus[instance].status ^= GINPUT_TOGGLE_ISON; + } + } +} + +/* Get the current toggle status. + * Returns FALSE on error (eg invalid instance) + */ +bool_t ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle) { + // Win32 threads don't seem to recognise priority and/or pre-emption + // so we add a sleep here to prevent 100% polled applications from locking up. + gfxSleepMilliseconds(1); + + if (instance >= GINPUT_TOGGLE_NUM_PORTS) + return FALSE; + ptoggle->type = GEVENT_TOGGLE; + ptoggle->instance = instance; + ptoggle->on = (ToggleStatus[instance].status & GINPUT_TOGGLE_ISON) ? TRUE : FALSE; + return TRUE; +} + +/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */ +void ginputToggleWakeup(void) { + gtimerJab(&ToggleTimer); +} + +/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */ +void ginputToggleWakeupI(void) { + gtimerJabI(&ToggleTimer); +} + +#endif /* GFX_USE_GINPUT && GINPUT_NEED_TOGGLE */ +/** @} */ diff --git a/src/ginput/toggle.h b/src/ginput/ginput_toggle.h similarity index 98% rename from src/ginput/toggle.h rename to src/ginput/ginput_toggle.h index 40149754..7fc075d6 100644 --- a/src/ginput/toggle.h +++ b/src/ginput/ginput_toggle.h @@ -6,7 +6,7 @@ */ /** - * @file src/ginput/toggle.h + * @file src/ginput/ginput_toggle.h * @brief GINPUT GFX User Input subsystem header file. * * @defgroup Toggle Toggle diff --git a/src/ginput/sys_defs.h b/src/ginput/sys_defs.h index 33259da4..cab1e15d 100644 --- a/src/ginput/sys_defs.h +++ b/src/ginput/sys_defs.h @@ -39,10 +39,10 @@ */ // Include various ginput types -#include "src/ginput/mouse.h" -#include "src/ginput/keyboard.h" -#include "src/ginput/toggle.h" -#include "src/ginput/dial.h" +#include "ginput_mouse.h" +#include "ginput_keyboard.h" +#include "ginput_toggle.h" +#include "ginput_dial.h" #endif /* GFX_USE_GINPUT */ diff --git a/src/ginput/sys_make.mk b/src/ginput/sys_make.mk index 34ac4a55..9abe1645 100644 --- a/src/ginput/sys_make.mk +++ b/src/ginput/sys_make.mk @@ -1,5 +1,5 @@ -GFXSRC += $(GFXLIB)/src/ginput/ginput.c \ - $(GFXLIB)/src/ginput/mouse.c \ - $(GFXLIB)/src/ginput/keyboard.c \ - $(GFXLIB)/src/ginput/toggle.c \ - $(GFXLIB)/src/ginput/dial.c +GFXSRC += $(GFXLIB)/src/ginput/ginput_ginput.c \ + $(GFXLIB)/src/ginput/ginput_mouse.c \ + $(GFXLIB)/src/ginput/ginput_keyboard.c \ + $(GFXLIB)/src/ginput/ginput_toggle.c \ + $(GFXLIB)/src/ginput/ginput_dial.c diff --git a/src/gmisc/arrayops.c b/src/gmisc/gmisc_arrayops.c similarity index 98% rename from src/gmisc/arrayops.c rename to src/gmisc/gmisc_arrayops.c index 1c4f821a..6e5442cd 100644 --- a/src/gmisc/arrayops.c +++ b/src/gmisc/gmisc_arrayops.c @@ -1,226 +1,226 @@ -/* - * This file is subject to the terms of the GFX License. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://ugfx.org/license.html - */ - -/** - * @file src/gmisc/arrayops.c - * @brief GMISC Array Operations code. - * - * @addtogroup GMISC - * @{ - */ -#include "gfx.h" - -#if GFX_USE_GMISC && GMISC_NEED_ARRAYOPS - -void gmiscArrayConvert(ArrayDataFormat srcfmt, void *src, ArrayDataFormat dstfmt, void *dst, size_t cnt) { - uint8_t *src8, *dst8; - uint16_t *src16, *dst16; - - dst8 = dst; - dst16 = dst; - src8 = src; - src16 = src; - - /* We do this as a big switch in order to optimise efficiency for each transfer type */ - switch(dstfmt) { - case ARRAY_DATA_4BITUNSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: if (dst != src) while(cnt--) { *dst8++ = *src8++; } break; - case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 8); } break; - case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst8++ = *src8++ >> 4; } break; - case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 128) >> 4; } break; - case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 6; } break; - case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 512) >> 6; } break; - case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 8; } break; - case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 2048) >> 8; } break; - case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 10; } break; - case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 8192) >> 10; } break; - case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 12; } break; - case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 32768) >> 12; } break; - } - break; - case ARRAY_DATA_4BITSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 8); } break; - case ARRAY_DATA_4BITSIGNED: if (dst != src) while(cnt--) { *dst8++ = *src8++; } break; - case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 128) >> 4; } break; - case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst8++ = *src8++ >> 4; } break; - case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 512) >> 6; } break; - case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 6; } break; - case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 2048) >> 8; } break; - case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 8; } break; - case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 8192) >> 10; } break; - case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 10; } break; - case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 32768) >> 12; } break; - case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 12; } break; - } - break; - case ARRAY_DATA_8BITUNSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst8++ = *src8++ << 4; } break; - case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 8) << 4; } break; - case ARRAY_DATA_8BITUNSIGNED: if (dst != src) while(cnt--) { *dst8++ = *src8++; } break; - case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 128); } break; - case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 2; } break; - case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 512) >> 2; } break; - case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 4; } break; - case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 2048) >> 4; } break; - case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 6; } break; - case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 8192) >> 6; } break; - case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 8; } break; - case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 32768) >> 8; } break; - } - break; - case ARRAY_DATA_8BITSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 8) << 4; } break; - case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst8++ = *src8++ << 4; } break; - case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 128); } break; - case ARRAY_DATA_8BITSIGNED: if (dst != src) while(cnt--) { *dst8++ = *src8++; } break; - case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 512) >> 2; } break; - case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 2; } break; - case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 2048) >> 4; } break; - case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 4; } break; - case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 8192) >> 6; } break; - case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 6; } break; - case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 32768) >> 8; } break; - case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 8; } break; - } - break; - case ARRAY_DATA_10BITUNSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 6; } break; - case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 6; } break; - case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 2; } break; - case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 2; } break; - case ARRAY_DATA_10BITUNSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; - case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512); } break; - case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; - case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) >> 2; } break; - case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 4; } break; - case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) >> 4; } break; - case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 6; } break; - case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 6; } break; - } - break; - case ARRAY_DATA_10BITSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 6; } break; - case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 6; } break; - case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 2; } break; - case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 2; } break; - case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512); } break; - case ARRAY_DATA_10BITSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; - case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) >> 2; } break; - case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; - case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) >> 4; } break; - case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 4; } break; - case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 6; } break; - case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 6; } break; - } - break; - case ARRAY_DATA_12BITUNSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 8; } break; - case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 8; } break; - case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 4; } break; - case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 4; } break; - case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ << 2; } break; - case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 2; } break; - case ARRAY_DATA_12BITUNSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; - case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048); } break; - case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; - case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) >> 2; } break; - case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 4; } break; - case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 4; } break; - } - break; - case ARRAY_DATA_12BITSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 8; } break; - case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 8; } break; - case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 4; } break; - case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 4; } break; - case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 2; } break; - case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = *src16++ << 2; } break; - case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048); } break; - case ARRAY_DATA_12BITSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; - case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) >> 2; } break; - case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; - case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 4; } break; - case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 4; } break; - } - break; - case ARRAY_DATA_14BITUNSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 10; } break; - case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 10; } break; - case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 6; } break; - case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 6; } break; - case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ << 4; } break; - case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 4; } break; - case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ << 2; } break; - case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) >> 2; } break; - case ARRAY_DATA_14BITUNSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; - case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192); } break; - case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; - case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 2; } break; - } - break; - case ARRAY_DATA_14BITSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 10; } break; - case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 10; } break; - case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 6; } break; - case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 6; } break; - case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 4; } break; - case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = *src16++ << 4; } break; - case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) << 2; } break; - case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = *src16++ << 2; } break; - case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192); } break; - case ARRAY_DATA_14BITSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; - case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 2; } break; - case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; - } - break; - case ARRAY_DATA_16BITUNSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 12; } break; - case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 12; } break; - case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 8; } break; - case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 8; } break; - case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ << 6; } break; - case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 6; } break; - case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ << 4; } break; - case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) >> 4; } break; - case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; - case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) >> 2; } break; - case ARRAY_DATA_16BITUNSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; - case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768); } break; - } - break; - case ARRAY_DATA_16BITSIGNED: - switch(srcfmt) { - case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 12; } break; - case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 12; } break; - case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 8; } break; - case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 8; } break; - case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 6; } break; - case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = *src16++ << 6; } break; - case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) << 4; } break; - case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = *src16++ << 4; } break; - case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) << 2; } break; - case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; - case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768); } break; - case ARRAY_DATA_16BITSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; - } - break; - } -} - -#endif /* GFX_USE_GMISC && GMISC_NEED_ARRAYOPS */ -/** @} */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://ugfx.org/license.html + */ + +/** + * @file src/gmisc/gmisc_arrayops.c + * @brief GMISC Array Operations code. + * + * @addtogroup GMISC + * @{ + */ +#include "gfx.h" + +#if GFX_USE_GMISC && GMISC_NEED_ARRAYOPS + +void gmiscArrayConvert(ArrayDataFormat srcfmt, void *src, ArrayDataFormat dstfmt, void *dst, size_t cnt) { + uint8_t *src8, *dst8; + uint16_t *src16, *dst16; + + dst8 = dst; + dst16 = dst; + src8 = src; + src16 = src; + + /* We do this as a big switch in order to optimise efficiency for each transfer type */ + switch(dstfmt) { + case ARRAY_DATA_4BITUNSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: if (dst != src) while(cnt--) { *dst8++ = *src8++; } break; + case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 8); } break; + case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst8++ = *src8++ >> 4; } break; + case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 128) >> 4; } break; + case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 6; } break; + case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 512) >> 6; } break; + case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 8; } break; + case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 2048) >> 8; } break; + case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 10; } break; + case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 8192) >> 10; } break; + case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 12; } break; + case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 32768) >> 12; } break; + } + break; + case ARRAY_DATA_4BITSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 8); } break; + case ARRAY_DATA_4BITSIGNED: if (dst != src) while(cnt--) { *dst8++ = *src8++; } break; + case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 128) >> 4; } break; + case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst8++ = *src8++ >> 4; } break; + case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 512) >> 6; } break; + case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 6; } break; + case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 2048) >> 8; } break; + case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 8; } break; + case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 8192) >> 10; } break; + case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 10; } break; + case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 32768) >> 12; } break; + case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 12; } break; + } + break; + case ARRAY_DATA_8BITUNSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst8++ = *src8++ << 4; } break; + case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 8) << 4; } break; + case ARRAY_DATA_8BITUNSIGNED: if (dst != src) while(cnt--) { *dst8++ = *src8++; } break; + case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 128); } break; + case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 2; } break; + case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 512) >> 2; } break; + case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 4; } break; + case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 2048) >> 4; } break; + case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 6; } break; + case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 8192) >> 6; } break; + case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst8++ = *src16++ >> 8; } break; + case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 32768) >> 8; } break; + } + break; + case ARRAY_DATA_8BITSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 8) << 4; } break; + case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst8++ = *src8++ << 4; } break; + case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst8++ = (*src8++ ^ 128); } break; + case ARRAY_DATA_8BITSIGNED: if (dst != src) while(cnt--) { *dst8++ = *src8++; } break; + case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 512) >> 2; } break; + case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 2; } break; + case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 2048) >> 4; } break; + case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 4; } break; + case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 8192) >> 6; } break; + case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 6; } break; + case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst8++ = (*src16++ ^ 32768) >> 8; } break; + case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst8++ = *src16++ >> 8; } break; + } + break; + case ARRAY_DATA_10BITUNSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 6; } break; + case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 6; } break; + case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 2; } break; + case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 2; } break; + case ARRAY_DATA_10BITUNSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; + case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512); } break; + case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; + case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) >> 2; } break; + case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 4; } break; + case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) >> 4; } break; + case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 6; } break; + case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 6; } break; + } + break; + case ARRAY_DATA_10BITSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 6; } break; + case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 6; } break; + case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 2; } break; + case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 2; } break; + case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512); } break; + case ARRAY_DATA_10BITSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; + case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) >> 2; } break; + case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; + case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) >> 4; } break; + case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 4; } break; + case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 6; } break; + case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 6; } break; + } + break; + case ARRAY_DATA_12BITUNSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 8; } break; + case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 8; } break; + case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 4; } break; + case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 4; } break; + case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ << 2; } break; + case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 2; } break; + case ARRAY_DATA_12BITUNSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; + case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048); } break; + case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; + case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) >> 2; } break; + case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 4; } break; + case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 4; } break; + } + break; + case ARRAY_DATA_12BITSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 8; } break; + case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 8; } break; + case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 4; } break; + case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 4; } break; + case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 2; } break; + case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = *src16++ << 2; } break; + case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048); } break; + case ARRAY_DATA_12BITSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; + case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) >> 2; } break; + case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; + case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 4; } break; + case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 4; } break; + } + break; + case ARRAY_DATA_14BITUNSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 10; } break; + case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 10; } break; + case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 6; } break; + case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 6; } break; + case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ << 4; } break; + case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 4; } break; + case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ << 2; } break; + case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) >> 2; } break; + case ARRAY_DATA_14BITUNSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; + case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192); } break; + case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; + case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 2; } break; + } + break; + case ARRAY_DATA_14BITSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 10; } break; + case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 10; } break; + case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 6; } break; + case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 6; } break; + case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 4; } break; + case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = *src16++ << 4; } break; + case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) << 2; } break; + case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = *src16++ << 2; } break; + case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192); } break; + case ARRAY_DATA_14BITSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; + case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768) >> 2; } break; + case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; + } + break; + case ARRAY_DATA_16BITUNSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 12; } break; + case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 12; } break; + case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = *src8++ << 8; } break; + case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 8; } break; + case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ << 6; } break; + case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 6; } break; + case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ << 4; } break; + case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) >> 4; } break; + case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; + case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) >> 2; } break; + case ARRAY_DATA_16BITUNSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; + case ARRAY_DATA_16BITSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768); } break; + } + break; + case ARRAY_DATA_16BITSIGNED: + switch(srcfmt) { + case ARRAY_DATA_4BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 8) << 12; } break; + case ARRAY_DATA_4BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 12; } break; + case ARRAY_DATA_8BITUNSIGNED: while(cnt--) { *dst16++ = (*src8++ ^ 128) << 8; } break; + case ARRAY_DATA_8BITSIGNED: while(cnt--) { *dst16++ = *src8++ << 8; } break; + case ARRAY_DATA_10BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 512) << 6; } break; + case ARRAY_DATA_10BITSIGNED: while(cnt--) { *dst16++ = *src16++ << 6; } break; + case ARRAY_DATA_12BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 2048) << 4; } break; + case ARRAY_DATA_12BITSIGNED: while(cnt--) { *dst16++ = *src16++ << 4; } break; + case ARRAY_DATA_14BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 8192) << 2; } break; + case ARRAY_DATA_14BITSIGNED: while(cnt--) { *dst16++ = *src16++ >> 2; } break; + case ARRAY_DATA_16BITUNSIGNED: while(cnt--) { *dst16++ = (*src16++ ^ 32768); } break; + case ARRAY_DATA_16BITSIGNED: if (dst != src) while(cnt--) { *dst16++ = *src16++; } break; + } + break; + } +} + +#endif /* GFX_USE_GMISC && GMISC_NEED_ARRAYOPS */ +/** @} */ diff --git a/src/gmisc/gmisc.c b/src/gmisc/gmisc_gmisc.c similarity index 90% rename from src/gmisc/gmisc.c rename to src/gmisc/gmisc_gmisc.c index 654dd5e2..3121182f 100644 --- a/src/gmisc/gmisc.c +++ b/src/gmisc/gmisc_gmisc.c @@ -6,7 +6,7 @@ */ /** - * @file src/gmisc/gmisc.c + * @file src/gmisc/gmisc_gmisc.c * @brief GMISC Functions. * */ diff --git a/src/gmisc/trig.c b/src/gmisc/gmisc_trig.c similarity index 99% rename from src/gmisc/trig.c rename to src/gmisc/gmisc_trig.c index 3c6dd461..7314f389 100644 --- a/src/gmisc/trig.c +++ b/src/gmisc/gmisc_trig.c @@ -6,7 +6,7 @@ */ /** - * @file src/gmisc/trig.c + * @file src/gmisc/gmisc_trig.c * @brief GMISC Trig Functions. * * @addtogroup GMISC diff --git a/src/gmisc/sys_make.mk b/src/gmisc/sys_make.mk index 66d19ab0..0431c134 100644 --- a/src/gmisc/sys_make.mk +++ b/src/gmisc/sys_make.mk @@ -1,3 +1,3 @@ -GFXSRC += $(GFXLIB)/src/gmisc/gmisc.c \ - $(GFXLIB)/src/gmisc/arrayops.c \ - $(GFXLIB)/src/gmisc/trig.c +GFXSRC += $(GFXLIB)/src/gmisc/gmisc_gmisc.c \ + $(GFXLIB)/src/gmisc/gmisc_arrayops.c \ + $(GFXLIB)/src/gmisc/gmisc_trig.c diff --git a/src/gqueue/gqueue.c b/src/gqueue/gqueue_gqueue.c similarity index 99% rename from src/gqueue/gqueue.c rename to src/gqueue/gqueue_gqueue.c index 45ca6fce..5a50c64b 100644 --- a/src/gqueue/gqueue.c +++ b/src/gqueue/gqueue_gqueue.c @@ -6,7 +6,7 @@ */ /** - * @file src/gqueue/gqueue.c + * @file src/gqueue/gqueue_gqueue.c * @brief GQUEUE source file. */ diff --git a/src/gqueue/sys_make.mk b/src/gqueue/sys_make.mk index ab8a0423..f8a542c3 100644 --- a/src/gqueue/sys_make.mk +++ b/src/gqueue/sys_make.mk @@ -1 +1 @@ -GFXSRC += $(GFXLIB)/src/gqueue/gqueue.c +GFXSRC += $(GFXLIB)/src/gqueue/gqueue_gqueue.c diff --git a/src/gtimer/gtimer.c b/src/gtimer/gtimer_gtimer.c similarity index 95% rename from src/gtimer/gtimer.c rename to src/gtimer/gtimer_gtimer.c index 3e0b6966..5289b7b8 100644 --- a/src/gtimer/gtimer.c +++ b/src/gtimer/gtimer_gtimer.c @@ -1,238 +1,238 @@ -/* - * This file is subject to the terms of the GFX License. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://ugfx.org/license.html - */ - -/** - * @file src/gtimer/gtimer.c - * @brief GTIMER sub-system code. - * - * @addtogroup GTIMER - * @{ - */ -#include "gfx.h" - -#if GFX_USE_GTIMER || defined(__DOXYGEN__) - -#define GTIMER_FLG_PERIODIC 0x0001 -#define GTIMER_FLG_INFINITE 0x0002 -#define GTIMER_FLG_JABBED 0x0004 -#define GTIMER_FLG_SCHEDULED 0x0008 - -/* Don't rework this macro to use a ternary operator - the gcc compiler stuffs it up */ -#define TimeIsWithin(x, start, end) ((end >= start && x >= start && x <= end) || (end < start && (x >= start || x <= end))) - -/* This mutex protects access to our tables */ -static gfxMutex mutex; -static gfxThreadHandle hThread = 0; -static GTimer *pTimerHead = 0; -static gfxSem waitsem; -static DECLARE_THREAD_STACK(waTimerThread, GTIMER_THREAD_WORKAREA_SIZE); - -/*===========================================================================*/ -/* Driver local functions. */ -/*===========================================================================*/ - -static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) { - (void)arg; - GTimer *pt; - systemticks_t tm; - systemticks_t nxtTimeout; - systemticks_t lastTime; - GTimerFunction fn; - void *param; - - nxtTimeout = TIME_INFINITE; - lastTime = 0; - while(1) { - /* Wait for work to do. */ - gfxYield(); // Give someone else a go no matter how busy we are - gfxSemWait(&waitsem, nxtTimeout); - - restartTimerChecks: - - // Our reference time - tm = gfxSystemTicks(); - nxtTimeout = TIME_INFINITE; - - /* We need to obtain the mutex */ - gfxMutexEnter(&mutex); - - if (pTimerHead) { - pt = pTimerHead; - do { - // Do we have something to do for this timer? - if ((pt->flags & GTIMER_FLG_JABBED) || (!(pt->flags & GTIMER_FLG_INFINITE) && TimeIsWithin(pt->when, lastTime, tm))) { - - // Is this timer periodic? - if ((pt->flags & GTIMER_FLG_PERIODIC) && pt->period != TIME_IMMEDIATE) { - // Yes - Update ready for the next period - if (!(pt->flags & GTIMER_FLG_INFINITE)) { - // We may have skipped a period. - // We use this complicated formulae rather than a loop - // because the gcc compiler stuffs up the loop so that it - // either loops forever or doesn't get executed at all. - pt->when += ((tm + pt->period - pt->when) / pt->period) * pt->period; - } - - // We are definitely no longer jabbed - pt->flags &= ~GTIMER_FLG_JABBED; - - } else { - // No - get us off the timers list - if (pt->next == pt->prev) - pTimerHead = 0; - else { - pt->next->prev = pt->prev; - pt->prev->next = pt->next; - if (pTimerHead == pt) - pTimerHead = pt->next; - } - pt->flags = 0; - } - - // Call the callback function - fn = pt->fn; - param = pt->param; - gfxMutexExit(&mutex); - fn(param); - - // We no longer hold the mutex, the callback function may have taken a while - // and our list may have been altered so start again! - goto restartTimerChecks; - } - - // Find when we next need to wake up - if (!(pt->flags & GTIMER_FLG_INFINITE) && pt->when - tm < nxtTimeout) - nxtTimeout = pt->when - tm; - pt = pt->next; - } while(pt != pTimerHead); - } - - // Ready for the next loop - lastTime = tm; - gfxMutexExit(&mutex); - } - return 0; -} - -void _gtimerInit(void) -{ - gfxSemInit(&waitsem, 0, 1); - gfxMutexInit(&mutex); -} - -void _gtimerDeinit(void) -{ - gfxSemDestroy(&waitsem); - gfxMutexDestroy(&mutex); - // Need to destroy GTimer thread here -} - -void gtimerInit(GTimer* pt) -{ - pt->flags = 0; -} - -void gtimerDeinit(GTimer* pt) -{ - gtimerStop(pt); -} - -void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, bool_t periodic, delaytime_t millisec) { - gfxMutexEnter(&mutex); - - // Start our thread if not already going - if (!hThread) { - hThread = gfxThreadCreate(waTimerThread, sizeof(waTimerThread), GTIMER_THREAD_PRIORITY, GTimerThreadHandler, 0); - if (hThread) {gfxThreadClose(hThread);} // We never really need the handle again - } - - // Is this already scheduled? - if (pt->flags & GTIMER_FLG_SCHEDULED) { - // Cancel it! - if (pt->next == pt->prev) - pTimerHead = 0; - else { - pt->next->prev = pt->prev; - pt->prev->next = pt->next; - if (pTimerHead == pt) - pTimerHead = pt->next; - } - } - - // Set up the timer structure - pt->fn = fn; - pt->param = param; - pt->flags = GTIMER_FLG_SCHEDULED; - if (periodic) - pt->flags |= GTIMER_FLG_PERIODIC; - if (millisec == TIME_INFINITE) { - pt->flags |= GTIMER_FLG_INFINITE; - pt->period = TIME_INFINITE; - } else { - pt->period = gfxMillisecondsToTicks(millisec); - pt->when = gfxSystemTicks() + pt->period; - } - - // Just pop it on the end of the queue - if (pTimerHead) { - pt->next = pTimerHead; - pt->prev = pTimerHead->prev; - pt->prev->next = pt; - pt->next->prev = pt; - } else - pt->next = pt->prev = pTimerHead = pt; - - // Bump the thread - if (!(pt->flags & GTIMER_FLG_INFINITE)) - gfxSemSignal(&waitsem); - gfxMutexExit(&mutex); -} - -void gtimerStop(GTimer *pt) { - gfxMutexEnter(&mutex); - if (pt->flags & GTIMER_FLG_SCHEDULED) { - // Cancel it! - if (pt->next == pt->prev) - pTimerHead = 0; - else { - pt->next->prev = pt->prev; - pt->prev->next = pt->next; - if (pTimerHead == pt) - pTimerHead = pt->next; - } - // Make sure we know the structure is dead! - pt->flags = 0; - } - gfxMutexExit(&mutex); -} - -bool_t gtimerIsActive(GTimer *pt) { - return (pt->flags & GTIMER_FLG_SCHEDULED) ? TRUE : FALSE; -} - -void gtimerJab(GTimer *pt) { - gfxMutexEnter(&mutex); - - // Jab it! - pt->flags |= GTIMER_FLG_JABBED; - - // Bump the thread - gfxSemSignal(&waitsem); - gfxMutexExit(&mutex); -} - -void gtimerJabI(GTimer *pt) { - // Jab it! - pt->flags |= GTIMER_FLG_JABBED; - - // Bump the thread - gfxSemSignalI(&waitsem); -} - -#endif /* GFX_USE_GTIMER */ -/** @} */ - +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://ugfx.org/license.html + */ + +/** + * @file src/gtimer/gtimer_gtimer.c + * @brief GTIMER sub-system code. + * + * @addtogroup GTIMER + * @{ + */ +#include "gfx.h" + +#if GFX_USE_GTIMER || defined(__DOXYGEN__) + +#define GTIMER_FLG_PERIODIC 0x0001 +#define GTIMER_FLG_INFINITE 0x0002 +#define GTIMER_FLG_JABBED 0x0004 +#define GTIMER_FLG_SCHEDULED 0x0008 + +/* Don't rework this macro to use a ternary operator - the gcc compiler stuffs it up */ +#define TimeIsWithin(x, start, end) ((end >= start && x >= start && x <= end) || (end < start && (x >= start || x <= end))) + +/* This mutex protects access to our tables */ +static gfxMutex mutex; +static gfxThreadHandle hThread = 0; +static GTimer *pTimerHead = 0; +static gfxSem waitsem; +static DECLARE_THREAD_STACK(waTimerThread, GTIMER_THREAD_WORKAREA_SIZE); + +/*===========================================================================*/ +/* Driver local functions. */ +/*===========================================================================*/ + +static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) { + (void)arg; + GTimer *pt; + systemticks_t tm; + systemticks_t nxtTimeout; + systemticks_t lastTime; + GTimerFunction fn; + void *param; + + nxtTimeout = TIME_INFINITE; + lastTime = 0; + while(1) { + /* Wait for work to do. */ + gfxYield(); // Give someone else a go no matter how busy we are + gfxSemWait(&waitsem, nxtTimeout); + + restartTimerChecks: + + // Our reference time + tm = gfxSystemTicks(); + nxtTimeout = TIME_INFINITE; + + /* We need to obtain the mutex */ + gfxMutexEnter(&mutex); + + if (pTimerHead) { + pt = pTimerHead; + do { + // Do we have something to do for this timer? + if ((pt->flags & GTIMER_FLG_JABBED) || (!(pt->flags & GTIMER_FLG_INFINITE) && TimeIsWithin(pt->when, lastTime, tm))) { + + // Is this timer periodic? + if ((pt->flags & GTIMER_FLG_PERIODIC) && pt->period != TIME_IMMEDIATE) { + // Yes - Update ready for the next period + if (!(pt->flags & GTIMER_FLG_INFINITE)) { + // We may have skipped a period. + // We use this complicated formulae rather than a loop + // because the gcc compiler stuffs up the loop so that it + // either loops forever or doesn't get executed at all. + pt->when += ((tm + pt->period - pt->when) / pt->period) * pt->period; + } + + // We are definitely no longer jabbed + pt->flags &= ~GTIMER_FLG_JABBED; + + } else { + // No - get us off the timers list + if (pt->next == pt->prev) + pTimerHead = 0; + else { + pt->next->prev = pt->prev; + pt->prev->next = pt->next; + if (pTimerHead == pt) + pTimerHead = pt->next; + } + pt->flags = 0; + } + + // Call the callback function + fn = pt->fn; + param = pt->param; + gfxMutexExit(&mutex); + fn(param); + + // We no longer hold the mutex, the callback function may have taken a while + // and our list may have been altered so start again! + goto restartTimerChecks; + } + + // Find when we next need to wake up + if (!(pt->flags & GTIMER_FLG_INFINITE) && pt->when - tm < nxtTimeout) + nxtTimeout = pt->when - tm; + pt = pt->next; + } while(pt != pTimerHead); + } + + // Ready for the next loop + lastTime = tm; + gfxMutexExit(&mutex); + } + return 0; +} + +void _gtimerInit(void) +{ + gfxSemInit(&waitsem, 0, 1); + gfxMutexInit(&mutex); +} + +void _gtimerDeinit(void) +{ + gfxSemDestroy(&waitsem); + gfxMutexDestroy(&mutex); + // Need to destroy GTimer thread here +} + +void gtimerInit(GTimer* pt) +{ + pt->flags = 0; +} + +void gtimerDeinit(GTimer* pt) +{ + gtimerStop(pt); +} + +void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, bool_t periodic, delaytime_t millisec) { + gfxMutexEnter(&mutex); + + // Start our thread if not already going + if (!hThread) { + hThread = gfxThreadCreate(waTimerThread, sizeof(waTimerThread), GTIMER_THREAD_PRIORITY, GTimerThreadHandler, 0); + if (hThread) {gfxThreadClose(hThread);} // We never really need the handle again + } + + // Is this already scheduled? + if (pt->flags & GTIMER_FLG_SCHEDULED) { + // Cancel it! + if (pt->next == pt->prev) + pTimerHead = 0; + else { + pt->next->prev = pt->prev; + pt->prev->next = pt->next; + if (pTimerHead == pt) + pTimerHead = pt->next; + } + } + + // Set up the timer structure + pt->fn = fn; + pt->param = param; + pt->flags = GTIMER_FLG_SCHEDULED; + if (periodic) + pt->flags |= GTIMER_FLG_PERIODIC; + if (millisec == TIME_INFINITE) { + pt->flags |= GTIMER_FLG_INFINITE; + pt->period = TIME_INFINITE; + } else { + pt->period = gfxMillisecondsToTicks(millisec); + pt->when = gfxSystemTicks() + pt->period; + } + + // Just pop it on the end of the queue + if (pTimerHead) { + pt->next = pTimerHead; + pt->prev = pTimerHead->prev; + pt->prev->next = pt; + pt->next->prev = pt; + } else + pt->next = pt->prev = pTimerHead = pt; + + // Bump the thread + if (!(pt->flags & GTIMER_FLG_INFINITE)) + gfxSemSignal(&waitsem); + gfxMutexExit(&mutex); +} + +void gtimerStop(GTimer *pt) { + gfxMutexEnter(&mutex); + if (pt->flags & GTIMER_FLG_SCHEDULED) { + // Cancel it! + if (pt->next == pt->prev) + pTimerHead = 0; + else { + pt->next->prev = pt->prev; + pt->prev->next = pt->next; + if (pTimerHead == pt) + pTimerHead = pt->next; + } + // Make sure we know the structure is dead! + pt->flags = 0; + } + gfxMutexExit(&mutex); +} + +bool_t gtimerIsActive(GTimer *pt) { + return (pt->flags & GTIMER_FLG_SCHEDULED) ? TRUE : FALSE; +} + +void gtimerJab(GTimer *pt) { + gfxMutexEnter(&mutex); + + // Jab it! + pt->flags |= GTIMER_FLG_JABBED; + + // Bump the thread + gfxSemSignal(&waitsem); + gfxMutexExit(&mutex); +} + +void gtimerJabI(GTimer *pt) { + // Jab it! + pt->flags |= GTIMER_FLG_JABBED; + + // Bump the thread + gfxSemSignalI(&waitsem); +} + +#endif /* GFX_USE_GTIMER */ +/** @} */ + diff --git a/src/gtimer/sys_make.mk b/src/gtimer/sys_make.mk index 801c31a6..e48dc9f5 100644 --- a/src/gtimer/sys_make.mk +++ b/src/gtimer/sys_make.mk @@ -1 +1 @@ -GFXSRC += $(GFXLIB)/src/gtimer/gtimer.c +GFXSRC += $(GFXLIB)/src/gtimer/gtimer_gtimer.c diff --git a/src/gwin/button.c b/src/gwin/gwin_button.c similarity index 99% rename from src/gwin/button.c rename to src/gwin/gwin_button.c index 5507a07a..35627cfb 100644 --- a/src/gwin/button.c +++ b/src/gwin/gwin_button.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/button.c + * @file src/gwin/gwin_button.c * @brief GWIN sub-system button code */ @@ -14,7 +14,7 @@ #if GFX_USE_GWIN && GWIN_NEED_BUTTON -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" // Parameters for various shapes #define RND_CNR_SIZE 5 // Rounded corner size for rounded buttons diff --git a/src/gwin/button.h b/src/gwin/gwin_button.h similarity index 98% rename from src/gwin/button.h rename to src/gwin/gwin_button.h index 5f5d2838..282ed828 100644 --- a/src/gwin/button.h +++ b/src/gwin/gwin_button.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/button.h + * @file src/gwin/gwin_button.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Button Button @@ -24,7 +24,7 @@ #ifndef _GWIN_BUTTON_H #define _GWIN_BUTTON_H -/* This file is included within "gwin/gwidget.h" */ +/* This file is included within "src/gwin/gwin_widget.h" */ /** * @brief The Event Type for a Button Event diff --git a/src/gwin/checkbox.c b/src/gwin/gwin_checkbox.c similarity index 98% rename from src/gwin/checkbox.c rename to src/gwin/gwin_checkbox.c index 6269acc1..dec085c3 100644 --- a/src/gwin/checkbox.c +++ b/src/gwin/gwin_checkbox.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/checkbox.c + * @file src/gwin/gwin_checkbox.c * @brief GWIN sub-system button code */ @@ -14,7 +14,7 @@ #if (GFX_USE_GWIN && GWIN_NEED_CHECKBOX) || defined(__DOXYGEN__) -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" // Our checked state #define GCHECKBOX_FLG_CHECKED (GWIN_FIRST_CONTROL_FLAG<<0) diff --git a/src/gwin/checkbox.h b/src/gwin/gwin_checkbox.h similarity index 97% rename from src/gwin/checkbox.h rename to src/gwin/gwin_checkbox.h index 3c426242..3a67d487 100644 --- a/src/gwin/checkbox.h +++ b/src/gwin/gwin_checkbox.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/checkbox.h + * @file src/gwin/gwin_checkbox.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Checkbox Checkbox @@ -22,7 +22,7 @@ #ifndef _GWIN_CHECKBOX_H #define _GWIN_CHECKBOX_H -/* This file is included within "gwin/gwidget.h" */ +/* This file is included within "src/gwin/gwin_widget.h" */ /*===========================================================================*/ /* Driver constants. */ diff --git a/src/gwin/class_gwin.h b/src/gwin/gwin_class.h similarity index 98% rename from src/gwin/class_gwin.h rename to src/gwin/gwin_class.h index e45914a6..4dde3624 100644 --- a/src/gwin/class_gwin.h +++ b/src/gwin/gwin_class.h @@ -6,7 +6,7 @@ */ /* - * @file src/gwin/class_gwin.h + * @file src/gwin/gwin_class.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Internal Internal @@ -14,7 +14,7 @@ * * @note These definitions are normally not used by an application program. They are useful * only if you want to create your own custom GWIN window or widget. - * @note To access these definitions you must include "gwin/class_gwin.h" in your source file. + * @note To access these definitions you must include "src/gwin/gwin_class.h" in your source file. * * @{ */ diff --git a/src/gwin/console.c b/src/gwin/gwin_console.c similarity index 99% rename from src/gwin/console.c rename to src/gwin/gwin_console.c index 0380fd61..4c17034d 100644 --- a/src/gwin/console.c +++ b/src/gwin/gwin_console.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/console.c + * @file src/gwin/gwin_console.c * @brief GWIN sub-system console code. */ @@ -16,7 +16,7 @@ #include -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" #define GWIN_CONSOLE_USE_CLEAR_LINES TRUE // Clear each line before using it #define GWIN_CONSOLE_USE_FILLED_CHARS FALSE // Use filled characters instead of drawn characters diff --git a/src/gwin/console.h b/src/gwin/gwin_console.h similarity index 98% rename from src/gwin/console.h rename to src/gwin/gwin_console.h index 2a8f4a0a..77e623eb 100644 --- a/src/gwin/console.h +++ b/src/gwin/gwin_console.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/console.h + * @file src/gwin/gwin_console.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Console Console @@ -24,7 +24,7 @@ #ifndef _GWIN_CONSOLE_H #define _GWIN_CONSOLE_H -/* This file is included within "gwin/gwin.h" */ +/* This file is included within "src/gwin/sys_defs.h" */ // A console window. Supports wrapped text writing and a cursor. typedef struct GConsoleObject { diff --git a/src/gwin/gcontainer.c b/src/gwin/gwin_container.c similarity index 98% rename from src/gwin/gcontainer.c rename to src/gwin/gwin_container.c index 97b5fabb..3145ae56 100644 --- a/src/gwin/gcontainer.c +++ b/src/gwin/gwin_container.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/gcontainer.c + * @file src/gwin/gwin_container.c * @brief GWIN sub-system container code */ @@ -14,7 +14,7 @@ #if GFX_USE_GWIN && GWIN_NEED_CONTAINERS -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" void _gcontainerInit(void) { diff --git a/src/gwin/gcontainer.h b/src/gwin/gwin_container.h similarity index 97% rename from src/gwin/gcontainer.h rename to src/gwin/gwin_container.h index 98707ede..ff1c1ce9 100644 --- a/src/gwin/gcontainer.h +++ b/src/gwin/gwin_container.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/gcontainer.h + * @file src/gwin/gwin_container.h * * @defgroup Container Container * @ingroup Containers @@ -21,7 +21,7 @@ #ifndef _GCONTAINER_H #define _GCONTAINER_H -/* This file is included within "gwin/gwin.h" */ +/* This file is included within "src/gwin/sys_defs.h" */ // Forward definition struct GContainerObject; @@ -154,7 +154,7 @@ extern "C" { /* Include extra container types */ #if GWIN_NEED_FRAME || defined(__DOXYGEN__) - #include "src/gwin/frame.h" + #include "gwin_frame.h" #endif #endif /* _GCONTAINER_H */ diff --git a/src/gwin/frame.c b/src/gwin/gwin_frame.c similarity index 99% rename from src/gwin/frame.c rename to src/gwin/gwin_frame.c index fd8fafea..63df3be2 100644 --- a/src/gwin/frame.c +++ b/src/gwin/gwin_frame.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/frame.c + * @file src/gwin/gwin_frame.c * @brief GWIN sub-system frame code. */ @@ -14,7 +14,7 @@ #if GFX_USE_GWIN && GWIN_NEED_FRAME -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" /* Some position values */ #define BUTTON_X 18 // Button Width diff --git a/src/gwin/frame.h b/src/gwin/gwin_frame.h similarity index 97% rename from src/gwin/frame.h rename to src/gwin/gwin_frame.h index 58e1fbc9..f71a88a5 100644 --- a/src/gwin/frame.h +++ b/src/gwin/gwin_frame.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/frame.h + * @file src/gwin/gwin_frame.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Frame Frame @@ -23,6 +23,8 @@ #ifndef _GWIN_FRAME_H #define _GWIN_FRAME_H +/* This file is included from src/gwin/gwin_container.h */ + /** * @brief Flags for gwinFrameCreate() * @{ diff --git a/src/gwin/gwin_gl3d.c b/src/gwin/gwin_gl3d.c index e04875c0..6e16479e 100644 --- a/src/gwin/gwin_gl3d.c +++ b/src/gwin/gwin_gl3d.c @@ -18,7 +18,7 @@ #error "GWIN: GL3D only support GDISP_PIXELFORMAT_RGB565 color format (TinyGL limitation)" #endif -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" #include "3rdparty/tinygl-0.4-ugfx/src/zgl.h" diff --git a/src/gwin/gwin_gl3d.h b/src/gwin/gwin_gl3d.h index ca3edf6f..644f45bf 100644 --- a/src/gwin/gwin_gl3d.h +++ b/src/gwin/gwin_gl3d.h @@ -22,7 +22,7 @@ #ifndef _GWIN_GL3D_H #define _GWIN_GL3D_H -/* This file is included within "gwin/gwin.h" */ +/* This file is included within "src/gwin/sys_defs.h" */ // A gl3d window diff --git a/src/gwin/graph.c b/src/gwin/gwin_graph.c similarity index 99% rename from src/gwin/graph.c rename to src/gwin/gwin_graph.c index 4fcfad37..8a450a9f 100644 --- a/src/gwin/graph.c +++ b/src/gwin/gwin_graph.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/graph.c + * @file src/gwin/gwin_graph.c * @brief GWIN sub-system button code */ @@ -14,7 +14,7 @@ #if GFX_USE_GWIN && GWIN_NEED_GRAPH -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" #define GGRAPH_FLG_CONNECTPOINTS (GWIN_FIRST_CONTROL_FLAG<<0) #define GGRAPH_ARROW_SIZE 5 diff --git a/src/gwin/graph.h b/src/gwin/gwin_graph.h similarity index 98% rename from src/gwin/graph.h rename to src/gwin/gwin_graph.h index be51f66c..eea80679 100644 --- a/src/gwin/graph.h +++ b/src/gwin/gwin_graph.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/graph.h + * @file src/gwin/gwin_graph.h * @brief GWIN GRAPH module header file * * @defgroup Graph Graph @@ -22,7 +22,7 @@ #ifndef _GWIN_GRAPH_H #define _GWIN_GRAPH_H -/* This file is included within "gwin/gwin.h" */ +/* This file is included within "src/gwin/sys_defs.h" */ typedef enum GGraphPointType_e { GGRAPH_POINT_NONE, GGRAPH_POINT_DOT, GGRAPH_POINT_SQUARE, GGRAPH_POINT_CIRCLE diff --git a/src/gwin/gwin.c b/src/gwin/gwin_gwin.c similarity index 99% rename from src/gwin/gwin.c rename to src/gwin/gwin_gwin.c index b5b7ad6b..a4cef125 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin_gwin.c @@ -5,11 +5,16 @@ * http://ugfx.org/license.html */ +/** + * @file src/gwin/gwin_gwin.c + * @brief GWIN sub-system code + */ + #include "gfx.h" #if GFX_USE_GWIN -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" /*----------------------------------------------- * Data diff --git a/src/gwin/gimage.c b/src/gwin/gwin_image.c similarity index 98% rename from src/gwin/gimage.c rename to src/gwin/gwin_image.c index d5ca2c38..370d7bdd 100644 --- a/src/gwin/gimage.c +++ b/src/gwin/gwin_image.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/gimage.c + * @file src/gwin/gwin_image.c * @brief GWIN sub-system image code */ @@ -14,7 +14,7 @@ #if GFX_USE_GWIN && GWIN_NEED_IMAGE -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" #define widget(gh) ((GImageObject *)gh) diff --git a/src/gwin/gimage.h b/src/gwin/gwin_image.h similarity index 97% rename from src/gwin/gimage.h rename to src/gwin/gwin_image.h index 0052f024..2e0a3218 100644 --- a/src/gwin/gimage.h +++ b/src/gwin/gwin_image.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/gimage.h + * @file src/gwin/gwin_image.h * @brief GWIN image widget header file. * * @defgroup ImageBox ImageBox @@ -27,7 +27,7 @@ #ifndef _GWIN_IMAGE_H #define _GWIN_IMAGE_H -// This file is included within "gwin/gwin.h" +// This file is included within "src/gwin/sys_defs.h" // An image window typedef struct GImageObject { diff --git a/src/gwin/label.c b/src/gwin/gwin_label.c similarity index 98% rename from src/gwin/label.c rename to src/gwin/gwin_label.c index 4faba95c..3be9d0a9 100644 --- a/src/gwin/label.c +++ b/src/gwin/gwin_label.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/label.c + * @file src/gwin/gwin_label.c * @brief GWIN label widget header file */ @@ -14,7 +14,7 @@ #if GFX_USE_GWIN && GWIN_NEED_LABEL -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" // macros to assist in data type conversions #define gh2obj ((GLabelObject *)gh) diff --git a/src/gwin/label.h b/src/gwin/gwin_label.h similarity index 97% rename from src/gwin/label.h rename to src/gwin/gwin_label.h index e0b32240..b5c45589 100644 --- a/src/gwin/label.h +++ b/src/gwin/gwin_label.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/label.h + * @file src/gwin/gwin_label.h * @brief GWIN label widget header file * * @defgroup Label Label @@ -27,7 +27,7 @@ #ifndef _GWIN_LABEL_H #define _GWIN_LABEL_H -// This file is included within "gwin/gwin.h" +// This file is included within "src/gwin/gwin_widget.h" // An label window typedef struct GLabelObject { diff --git a/src/gwin/list.c b/src/gwin/gwin_list.c similarity index 99% rename from src/gwin/list.c rename to src/gwin/gwin_list.c index 10926238..265053e1 100644 --- a/src/gwin/list.c +++ b/src/gwin/gwin_list.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/list.c + * @file src/gwin/gwin_list.c * @brief GWIN list widget header file */ @@ -14,7 +14,7 @@ #if GFX_USE_GWIN && GWIN_NEED_LIST -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" #include #include diff --git a/src/gwin/list.h b/src/gwin/gwin_list.h similarity index 99% rename from src/gwin/list.h rename to src/gwin/gwin_list.h index d9979993..a55d4cb8 100644 --- a/src/gwin/list.h +++ b/src/gwin/gwin_list.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/list.h + * @file src/gwin/gwin_list.h * @brief GWIN list widget header file * * @defgroup List List @@ -26,7 +26,7 @@ #ifndef _GWIN_LIST_H #define _GWIN_LIST_H -// This file is included within "gwin/gwin.h" +// This file is included within "src/gwin/gwin_widget.h" /** * @brief The event type for a list event diff --git a/src/gwin/progressbar.c b/src/gwin/gwin_progressbar.c similarity index 99% rename from src/gwin/progressbar.c rename to src/gwin/gwin_progressbar.c index 90be6e43..ef28e8dc 100644 --- a/src/gwin/progressbar.c +++ b/src/gwin/gwin_progressbar.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/progressbar.c + * @file src/gwin/gwin_progressbar.c * @brief GWIN sub-system progressbar code */ @@ -14,7 +14,7 @@ #if (GFX_USE_GWIN && GWIN_NEED_PROGRESSBAR) || defined(__DOXYGEN__) -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" // Reset the display position back to the value predicted by the saved progressbar position static void ResetDisplayPos(GProgressbarObject *gsw) { diff --git a/src/gwin/progressbar.h b/src/gwin/gwin_progressbar.h similarity index 98% rename from src/gwin/progressbar.h rename to src/gwin/gwin_progressbar.h index 4dadf904..49c11a98 100644 --- a/src/gwin/progressbar.h +++ b/src/gwin/gwin_progressbar.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/progressbar.h + * @file src/gwin/gwin_progressbar.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Progressbar Progressbar @@ -22,6 +22,7 @@ #ifndef _GWIN_PROGRESSBAR_H #define _GWIN_PROGRESSBAR_H +/* This file is included within src/gwin/gwin_widget.h */ // A progressbar window typedef struct GProgressbarObject { GWidgetObject w; diff --git a/src/gwin/radio.c b/src/gwin/gwin_radio.c similarity index 99% rename from src/gwin/radio.c rename to src/gwin/gwin_radio.c index 4799c2a4..0bafa7cc 100644 --- a/src/gwin/radio.c +++ b/src/gwin/gwin_radio.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/radio.c + * @file src/gwin/gwin_radio.c * @brief GWIN sub-system radio button code */ @@ -14,7 +14,7 @@ #if GFX_USE_GWIN && GWIN_NEED_RADIO -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" #define GRADIO_TAB_CNR 8 // Diagonal corner on active tab #define GRADIO_TOP_FADE 50 // (GRADIO_TOP_FADE/255)% fade to white for top of tab/button diff --git a/src/gwin/radio.h b/src/gwin/gwin_radio.h similarity index 98% rename from src/gwin/radio.h rename to src/gwin/gwin_radio.h index e13962c7..d5c9c21a 100644 --- a/src/gwin/radio.h +++ b/src/gwin/gwin_radio.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/radio.h + * @file src/gwin/gwin_radio.h * @brief GWIN Graphic window subsystem header file. * * @defgroup RadioButton RadioButton @@ -22,7 +22,7 @@ #ifndef _GWIN_RADIO_H #define _GWIN_RADIO_H -/* This file is included within "gwin/gwidget.h" */ +/* This file is included within "src/gwin/gwin_widget.h" */ /** * @brief The Event Type for a Radio Event diff --git a/src/gwin/slider.c b/src/gwin/gwin_slider.c similarity index 99% rename from src/gwin/slider.c rename to src/gwin/gwin_slider.c index 2329230c..f1230d5a 100644 --- a/src/gwin/slider.c +++ b/src/gwin/gwin_slider.c @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/slider.c + * @file src/gwin/gwin_slider.c * @brief GWIN sub-system slider code */ @@ -14,7 +14,7 @@ #if (GFX_USE_GWIN && GWIN_NEED_SLIDER) || defined(__DOXYGEN__) -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" #ifndef GWIN_SLIDER_DEAD_BAND #define GWIN_SLIDER_DEAD_BAND 5 diff --git a/src/gwin/slider.h b/src/gwin/gwin_slider.h similarity index 98% rename from src/gwin/slider.h rename to src/gwin/gwin_slider.h index 6cd8088b..b88d6dfd 100644 --- a/src/gwin/slider.h +++ b/src/gwin/gwin_slider.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/slider.h + * @file src/gwin/gwin_slider.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Slider Slider @@ -22,7 +22,7 @@ #ifndef _GWIN_SLIDER_H #define _GWIN_SLIDER_H -/* This file is included within "gwin/gwidget.h" */ +/* This file is included within "src/gwin/gwin_widget.h" */ #define GEVENT_GWIN_SLIDER (GEVENT_GWIN_CTRL_FIRST+1) diff --git a/src/gwin/gwidget.c b/src/gwin/gwin_widget.c similarity index 99% rename from src/gwin/gwidget.c rename to src/gwin/gwin_widget.c index e773dc6c..f85e6f20 100644 --- a/src/gwin/gwidget.c +++ b/src/gwin/gwin_widget.c @@ -5,13 +5,18 @@ * http://ugfx.org/license.html */ +/** + * @file src/gwin/gwin_widget.c + * @brief GWIN sub-system widget code + */ + #include "gfx.h" #if GFX_USE_GWIN && GWIN_NEED_WIDGET #include -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" /* Our listener for events for widgets */ static GListener gl; diff --git a/src/gwin/gwidget.h b/src/gwin/gwin_widget.h similarity index 97% rename from src/gwin/gwidget.h rename to src/gwin/gwin_widget.h index 18b42b79..81c76263 100644 --- a/src/gwin/gwidget.h +++ b/src/gwin/gwin_widget.h @@ -6,7 +6,7 @@ */ /** - * @file src/gwin/gwidget.h + * @file src/gwin/gwin_widget.h * @brief GWIN Widgets header file. * * @defgroup Widget Widget @@ -23,7 +23,7 @@ #ifndef _GWIDGET_H #define _GWIDGET_H -/* This file is included within "gwin/gwin.h" */ +/* This file is included within "src/gwin/sys_defs.h" */ // Forward definition struct GWidgetObject; @@ -360,31 +360,31 @@ bool_t gwinAttachListener(GListener *pl); /* Include extra widget types */ #if GWIN_NEED_BUTTON || defined(__DOXYGEN__) - #include "src/gwin/button.h" + #include "gwin_button.h" #endif #if GWIN_NEED_SLIDER || defined(__DOXYGEN__) - #include "src/gwin/slider.h" + #include "gwin_slider.h" #endif #if GWIN_NEED_CHECKBOX || defined(__DOXYGEN__) - #include "src/gwin/checkbox.h" + #include "gwin_checkbox.h" #endif #if GWIN_NEED_RADIO || defined(__DOXYGEN__) - #include "src/gwin/radio.h" + #include "gwin_radio.h" #endif #if GWIN_NEED_LABEL || defined(__DOXYGEN__) - #include "src/gwin/label.h" + #include "gwin_label.h" #endif #if GWIN_NEED_LIST || defined(__DOXYGEN__) - #include "src/gwin/list.h" + #include "gwin_list.h" #endif #if GWIN_NEED_PROGRESSBAR || defined(__DOXYGEN__) - #include "src/gwin/progressbar.h" + #include "gwin_progressbar.h" #endif #endif /* _GWIDGET_H */ diff --git a/src/gwin/gwm.c b/src/gwin/gwin_wm.c similarity index 99% rename from src/gwin/gwm.c rename to src/gwin/gwin_wm.c index ba7a132a..92d68c7b 100644 --- a/src/gwin/gwm.c +++ b/src/gwin/gwin_wm.c @@ -5,6 +5,11 @@ * http://ugfx.org/license.html */ +/** + * @file src/gwin/gwin_wm.c + * @brief GWIN sub-system window manager code + */ + #include "gfx.h" #if GFX_USE_GWIN && !GWIN_NEED_WINDOWMANAGER @@ -13,7 +18,7 @@ */ - #include "src/gwin/class_gwin.h" + #include "gwin_class.h" // Needed if there is no window manager #define MIN_WIN_WIDTH 1 @@ -147,7 +152,7 @@ #if GFX_USE_GWIN && GWIN_NEED_WINDOWMANAGER -#include "src/gwin/class_gwin.h" +#include "gwin_class.h" /*----------------------------------------------- * Data diff --git a/src/gwin/sys_defs.h b/src/gwin/sys_defs.h index 7823eafe..5e08f7a2 100644 --- a/src/gwin/sys_defs.h +++ b/src/gwin/sys_defs.h @@ -950,26 +950,26 @@ extern "C" { /* Include widgets */ #if GWIN_NEED_WIDGET || defined(__DOXYGEN__) - #include "src/gwin/gwidget.h" + #include "gwin_widget.h" #endif /* Include containers */ #if GWIN_NEED_CONTAINERS || defined(__DOXYGEN__) - #include "src/gwin/gcontainer.h" + #include "gwin_container.h" #endif /* Include vanilla window objects */ #if GWIN_NEED_CONSOLE || defined(__DOXYGEN__) - #include "src/gwin/console.h" + #include "gwin_console.h" #endif #if GWIN_NEED_GRAPH || defined(__DOXYGEN__) - #include "src/gwin/graph.h" + #include "gwin_graph.h" #endif #if GWIN_NEED_IMAGE || defined(__DOXYGEN__) - #include "src/gwin/gimage.h" + #include "gwin_image.h" #endif #if GWIN_NEED_GL3D || defined(__DOXYGEN__) - #include "src/gwin/gwin_gl3d.h" + #include "gwin_gl3d.h" #endif #endif /* GFX_USE_GWIN */ diff --git a/src/gwin/sys_make.mk b/src/gwin/sys_make.mk index f905f8d3..81277a4e 100644 --- a/src/gwin/sys_make.mk +++ b/src/gwin/sys_make.mk @@ -1,18 +1,18 @@ -GFXSRC += $(GFXLIB)/src/gwin/gwin.c \ - $(GFXLIB)/src/gwin/gwidget.c \ - $(GFXLIB)/src/gwin/gwm.c \ - $(GFXLIB)/src/gwin/console.c \ - $(GFXLIB)/src/gwin/graph.c \ - $(GFXLIB)/src/gwin/button.c \ - $(GFXLIB)/src/gwin/slider.c \ - $(GFXLIB)/src/gwin/checkbox.c \ - $(GFXLIB)/src/gwin/gimage.c \ - $(GFXLIB)/src/gwin/label.c \ - $(GFXLIB)/src/gwin/radio.c \ - $(GFXLIB)/src/gwin/list.c \ - $(GFXLIB)/src/gwin/progressbar.c \ - $(GFXLIB)/src/gwin/gcontainer.c \ - $(GFXLIB)/src/gwin/frame.c \ +GFXSRC += $(GFXLIB)/src/gwin/gwin_gwin.c \ + $(GFXLIB)/src/gwin/gwin_widget.c \ + $(GFXLIB)/src/gwin/gwin_wm.c \ + $(GFXLIB)/src/gwin/gwin_console.c \ + $(GFXLIB)/src/gwin/gwin_graph.c \ + $(GFXLIB)/src/gwin/gwin_button.c \ + $(GFXLIB)/src/gwin/gwin_slider.c \ + $(GFXLIB)/src/gwin/gwin_checkbox.c \ + $(GFXLIB)/src/gwin/gwin_image.c \ + $(GFXLIB)/src/gwin/gwin_label.c \ + $(GFXLIB)/src/gwin/gwin_radio.c \ + $(GFXLIB)/src/gwin/gwin_list.c \ + $(GFXLIB)/src/gwin/gwin_progressbar.c \ + $(GFXLIB)/src/gwin/gwin_container.c \ + $(GFXLIB)/src/gwin/gwin_frame.c \ $(GFXLIB)/src/gwin/gwin_gl3d.c \ GFXINC += $(GFXLIB)/3rdparty/tinygl-0.4-ugfx/include