From c5a86757bd8309027d50f82d8947250c8e1197e6 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 21 Nov 2015 19:27:08 +1000 Subject: Make all include paths in ugfx relative. The only include path now needed is for drivers (in particular GDISP drivers) --- drivers/ginput/dial/GADC/driver.mk | 5 +- drivers/ginput/dial/GADC/ginput_lld_dial.c | 76 ------------------------- drivers/ginput/dial/GADC/ginput_lld_dial_GADC.c | 76 +++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 80 deletions(-) delete mode 100644 drivers/ginput/dial/GADC/ginput_lld_dial.c create mode 100644 drivers/ginput/dial/GADC/ginput_lld_dial_GADC.c (limited to 'drivers/ginput/dial/GADC') diff --git a/drivers/ginput/dial/GADC/driver.mk b/drivers/ginput/dial/GADC/driver.mk index 763549b8..24370422 100644 --- a/drivers/ginput/dial/GADC/driver.mk +++ b/drivers/ginput/dial/GADC/driver.mk @@ -1,5 +1,2 @@ -# List the required driver. -GFXSRC += $(GFXLIB)/drivers/ginput/dial/GADC/ginput_lld_dial.c - -# Required include directories GFXINC += $(GFXLIB)/drivers/ginput/dial/GADC +GFXSRC += $(GFXLIB)/drivers/ginput/dial/GADC/ginput_lld_dial_GADC.c diff --git a/drivers/ginput/dial/GADC/ginput_lld_dial.c b/drivers/ginput/dial/GADC/ginput_lld_dial.c deleted file mode 100644 index 9ad43748..00000000 --- a/drivers/ginput/dial/GADC/ginput_lld_dial.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 - */ - -#include "gfx.h" - -#if GFX_USE_GINPUT && GINPUT_NEED_DIAL - -#include "src/ginput/ginput_driver_dial.h" - -#if GINPUT_DIAL_NUM_PORTS >= 5 - #error "GINPUT: Dial - GADC driver currently only supports 4 devices" -#endif - -static adcsample_t samplebuf[GINPUT_DIAL_NUM_PORTS]; - -#if GINPUT_DIAL_CYCLE_POLL - static uint16_t cycle; -#endif - -static void GADCCallback(adcsample_t *buffer, void *param) { - ((DialCallbackFn)param)(buffer-samplebuf, buffer[0]); -} - -void ginput_lld_dial_init(void) { - #if GINPUT_DIAL_CYCLE_POLL - cycle = 0; - #endif -} - -void ginput_lld_dial_poll(DialCallbackFn fn) { - #if GINPUT_DIAL_CYCLE_POLL - switch(cycle++) { - #if GINPUT_DIAL_NUM_PORTS >= 1 - case 0: - gadcLowSpeedStart(GINPUT_DIAL_DEVICE0, samplebuf+0, GADCCallback, (void *)fn); - break; - #endif - #if GINPUT_DIAL_NUM_PORTS >= 2 - case 1: - gadcLowSpeedStart(GINPUT_DIAL_DEVICE1, samplebuf+1, GADCCallback, (void *)fn); - break; - #endif - #if GINPUT_DIAL_NUM_PORTS >= 3 - case 2: - gadcLowSpeedStart(GINPUT_DIAL_DEVICE2, samplebuf+2, GADCCallback, (void *)fn); - break; - #endif - #if GINPUT_DIAL_NUM_PORTS >= 4 - case 3: - gadcLowSpeedStart(GINPUT_DIAL_DEVICE3, samplebuf+3, GADCCallback, (void *)fn); - break; - #endif - } - if (cycle >= GINPUT_DIAL_NUM_PORTS) - cycle = 0; - #else - #if GINPUT_DIAL_NUM_PORTS >= 1 - gadcLowSpeedStart(GINPUT_DIAL_DEVICE0, samplebuf+0, GADCCallback, (void *)fn); - #endif - #if GINPUT_DIAL_NUM_PORTS >= 2 - gadcLowSpeedStart(GINPUT_DIAL_DEVICE1, samplebuf+1, GADCCallback, (void *)fn); - #endif - #if GINPUT_DIAL_NUM_PORTS >= 3 - gadcLowSpeedStart(GINPUT_DIAL_DEVICE2, samplebuf+2, GADCCallback, (void *)fn); - #endif - #if GINPUT_DIAL_NUM_PORTS >= 4 - gadcLowSpeedStart(GINPUT_DIAL_DEVICE3, samplebuf+3, GADCCallback, (void *)fn); - #endif - #endif -} - -#endif /* GFX_USE_GINPUT && GINPUT_NEED_DIAL */ diff --git a/drivers/ginput/dial/GADC/ginput_lld_dial_GADC.c b/drivers/ginput/dial/GADC/ginput_lld_dial_GADC.c new file mode 100644 index 00000000..49e59a24 --- /dev/null +++ b/drivers/ginput/dial/GADC/ginput_lld_dial_GADC.c @@ -0,0 +1,76 @@ +/* + * 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 + */ + +#include "gfx.h" + +#if GFX_USE_GINPUT && GINPUT_NEED_DIAL + +#include "../../../../src/ginput/ginput_driver_dial.h" + +#if GINPUT_DIAL_NUM_PORTS >= 5 + #error "GINPUT: Dial - GADC driver currently only supports 4 devices" +#endif + +static adcsample_t samplebuf[GINPUT_DIAL_NUM_PORTS]; + +#if GINPUT_DIAL_CYCLE_POLL + static uint16_t cycle; +#endif + +static void GADCCallback(adcsample_t *buffer, void *param) { + ((DialCallbackFn)param)(buffer-samplebuf, buffer[0]); +} + +void ginput_lld_dial_init(void) { + #if GINPUT_DIAL_CYCLE_POLL + cycle = 0; + #endif +} + +void ginput_lld_dial_poll(DialCallbackFn fn) { + #if GINPUT_DIAL_CYCLE_POLL + switch(cycle++) { + #if GINPUT_DIAL_NUM_PORTS >= 1 + case 0: + gadcLowSpeedStart(GINPUT_DIAL_DEVICE0, samplebuf+0, GADCCallback, (void *)fn); + break; + #endif + #if GINPUT_DIAL_NUM_PORTS >= 2 + case 1: + gadcLowSpeedStart(GINPUT_DIAL_DEVICE1, samplebuf+1, GADCCallback, (void *)fn); + break; + #endif + #if GINPUT_DIAL_NUM_PORTS >= 3 + case 2: + gadcLowSpeedStart(GINPUT_DIAL_DEVICE2, samplebuf+2, GADCCallback, (void *)fn); + break; + #endif + #if GINPUT_DIAL_NUM_PORTS >= 4 + case 3: + gadcLowSpeedStart(GINPUT_DIAL_DEVICE3, samplebuf+3, GADCCallback, (void *)fn); + break; + #endif + } + if (cycle >= GINPUT_DIAL_NUM_PORTS) + cycle = 0; + #else + #if GINPUT_DIAL_NUM_PORTS >= 1 + gadcLowSpeedStart(GINPUT_DIAL_DEVICE0, samplebuf+0, GADCCallback, (void *)fn); + #endif + #if GINPUT_DIAL_NUM_PORTS >= 2 + gadcLowSpeedStart(GINPUT_DIAL_DEVICE1, samplebuf+1, GADCCallback, (void *)fn); + #endif + #if GINPUT_DIAL_NUM_PORTS >= 3 + gadcLowSpeedStart(GINPUT_DIAL_DEVICE2, samplebuf+2, GADCCallback, (void *)fn); + #endif + #if GINPUT_DIAL_NUM_PORTS >= 4 + gadcLowSpeedStart(GINPUT_DIAL_DEVICE3, samplebuf+3, GADCCallback, (void *)fn); + #endif + #endif +} + +#endif /* GFX_USE_GINPUT && GINPUT_NEED_DIAL */ -- cgit v1.2.3