diff --git a/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c b/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c index e96ad3b2..82c0e2ff 100644 --- a/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c +++ b/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c @@ -161,7 +161,6 @@ static DECLARE_THREAD_FUNCTION(NetThread, param) { SOCKET_TYPE listenfd, fdmax, i, clientfd; socklen_t len; int leni; - unsigned disp; fd_set master, read_fds; struct sockaddr_in addr; GDisplay * g; diff --git a/src/gdisp/driver.h b/src/gdisp/driver.h index 10f9fd87..f8d66f4b 100644 --- a/src/gdisp/driver.h +++ b/src/gdisp/driver.h @@ -617,7 +617,7 @@ typedef struct GDISPVMT { #endif // Routines needed by the general driver VMT - bool_t _gdispInitDriver(GDriver *g, int driverinstance, int systeminstance); + bool_t _gdispInitDriver(GDriver *g, unsigned driverinstance, unsigned systeminstance); void _gdispPostInitDriver(GDriver *g); void _gdispDeInitDriver(GDriver *g); diff --git a/src/gdisp/gdisp_gdisp.c b/src/gdisp/gdisp_gdisp.c index 0e5cacb5..4a149faa 100644 --- a/src/gdisp/gdisp_gdisp.c +++ b/src/gdisp/gdisp_gdisp.c @@ -569,7 +569,7 @@ void _gdispInit(void) // GDISP_DRIVER_LIST is defined - create each driver instance #if defined(GDISP_DRIVER_LIST) { - int i; + unsigned i; extern GDriverVMTList GDISP_DRIVER_LIST; static const struct GDriverVMT const * dclist[] = {GDISP_DRIVER_LIST}; @@ -579,7 +579,8 @@ void _gdispInit(void) } #elif GDISP_TOTAL_DISPLAYS > 1 { - int i; + unsigned i; + extern GDriverVMTList GDISPVMT_OnlyOne; for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++) gdriverRegister(GDISPVMT_OnlyOne); @@ -622,7 +623,7 @@ void _gdispDeinit(void) /* ToDo */ } -bool_t _gdispInitDriver(GDriver *g, int driverinstance, int systeminstance) { +bool_t _gdispInitDriver(GDriver *g, unsigned driverinstance, unsigned systeminstance) { #define gd ((GDisplay *)g) bool_t ret; @@ -694,10 +695,18 @@ void _gdispDeInitDriver(GDriver *g) { #undef gd } +GDisplay *gdispGetDisplay(unsigned display) { + return (GDisplay *)gdriverGetInstance(GDRIVER_TYPE_DISPLAY, display); +} + void gdispSetDisplay(GDisplay *g) { if (g) GDISP = g; } +unsigned gdispGetDisplayCount(void) { + return gdriverInstanceCount(GDRIVER_TYPE_DISPLAY); +} + coord_t gdispGGetWidth(GDisplay *g) { return g->g.Width; } coord_t gdispGGetHeight(GDisplay *g) { return g->g.Height; } powermode_t gdispGGetPowerMode(GDisplay *g) { return g->g.Powermode; } diff --git a/src/gdisp/sys_defs.h b/src/gdisp/sys_defs.h index 0d51d639..35844e2d 100644 --- a/src/gdisp/sys_defs.h +++ b/src/gdisp/sys_defs.h @@ -219,7 +219,7 @@ color_t gdispContrastColor(color_t color); * * @api */ -#define gdispGetDisplay(display) ((GDisplay *)gdriverGetInstance(GDRIVER_TYPE_DISPLAY, display)) +GDisplay *gdispGetDisplay(unsigned display); /** * @brief Set the current default display to the specified display @@ -241,7 +241,7 @@ void gdispSetDisplay(GDisplay *g); * * @note Displays are numbered from 0 to @p gdispGetDisplayCount() - 1 */ -#define gdispGetDisplayCount() gdriverInstanceCount(GDRIVER_TYPE_DISPLAY) +unsigned gdispGetDisplayCount(void); /* Property Functions */ diff --git a/src/gdisp/sys_rules.h b/src/gdisp/sys_rules.h index 90b07138..79df2d88 100644 --- a/src/gdisp/sys_rules.h +++ b/src/gdisp/sys_rules.h @@ -26,7 +26,7 @@ #endif #if defined(GDISP_DRIVER_LIST) #if GDISP_TOTAL_DISPLAYS != 1 - #error "GDISP Multiple Drivers: You can't specify both GDISP_TOTAL_DISPLAYS and GDISP_DRIVER_LIST + #error "GDISP Multiple Drivers: You can't specify both GDISP_TOTAL_DISPLAYS and GDISP_DRIVER_LIST" #endif #ifndef GDISP_PIXELFORMAT #error "GDISP Multiple Drivers: You must specify a value for GDISP_PIXELFORMAT when using GDISP_DRIVER_LIST" diff --git a/src/gdriver/gdriver_gdriver.c b/src/gdriver/gdriver_gdriver.c index 90a1d932..0a53aaf7 100644 --- a/src/gdriver/gdriver_gdriver.c +++ b/src/gdriver/gdriver_gdriver.c @@ -34,9 +34,9 @@ void _gdriverDeinit(void) { GDriver *gdriverRegister(const GDriverVMT *vmt) { - GDriver *pd; - GDriver *dtail; - int dinstance, sinstance; + GDriver * pd; + GDriver * dtail; + unsigned dinstance, sinstance; // Loop to find the driver instance and the system instance numbers dinstance = sinstance = 0; @@ -98,9 +98,9 @@ void gdriverUnRegister(GDriver *driver) { gfxFree(driver); } -GDriver *gdriverGetInstance(uint16_t type, int instance) { +GDriver *gdriverGetInstance(uint16_t type, unsigned instance) { GDriver *pd; - int sinstance; + unsigned sinstance; // Loop to find the system instance sinstance = 0; @@ -114,9 +114,9 @@ GDriver *gdriverGetInstance(uint16_t type, int instance) { return 0; } -int gdriverInstanceCount(uint16_t type) { +unsigned gdriverInstanceCount(uint16_t type) { GDriver *pd; - int sinstance; + unsigned sinstance; // Loop to count the system instances sinstance = 0; diff --git a/src/gdriver/sys_defs.h b/src/gdriver/sys_defs.h index 7f50fc6d..546246de 100644 --- a/src/gdriver/sys_defs.h +++ b/src/gdriver/sys_defs.h @@ -67,7 +67,7 @@ typedef struct GDriverVMT { uint16_t type; // @< What type of driver this is uint16_t flags; // @< Flags for the driver. Meaning is specific to each driver type. uint32_t objsize; // @< How big the runtime driver structure is - bool_t (*init)(GDriver *driver, int driverinstance, int systeminstance); // @< Initialise the driver. Returns TRUE if OK. + bool_t (*init)(GDriver *driver, unsigned driverinstance, unsigned systeminstance); // @< Initialise the driver. Returns TRUE if OK. // driverinstance is the instance 0..n of this driver. // systeminstance is the instance 0..n of this type of device. void (*postinit)(GDriver *driver); // @< Called once the driver is registered. @@ -118,7 +118,7 @@ extern "C" { * @param[in] type The type of driver to find * @param[in] instance The instance (0..n) to find */ - GDriver *gdriverGetInstance(uint16_t type, int instance); + GDriver *gdriverGetInstance(uint16_t type, unsigned instance); /** * @brief Get the count of instances of a type of device @@ -128,7 +128,7 @@ extern "C" { * * @param[in] type The type of driver to find */ - int gdriverInstanceCount(uint16_t type); + unsigned gdriverInstanceCount(uint16_t type); /** * @brief Get the next driver for a type of device diff --git a/src/gfile/gfile_fs_fatfs.c b/src/gfile/gfile_fs_fatfs.c index 2e4ef52b..c76b0659 100644 --- a/src/gfile/gfile_fs_fatfs.c +++ b/src/gfile/gfile_fs_fatfs.c @@ -14,7 +14,7 @@ #if GFX_USE_GFILE && GFILE_NEED_FATFS #include "gfile_fs.h" -#include "fatfs_wrapper.h" +#include "gfile_fatfs_wrapper.h" /******************************************************** * The FAT file-system VMT diff --git a/src/gfile/gfile_fs_petitfs.c b/src/gfile/gfile_fs_petitfs.c index 9b3b510b..443de42c 100644 --- a/src/gfile/gfile_fs_petitfs.c +++ b/src/gfile/gfile_fs_petitfs.c @@ -14,7 +14,7 @@ #if GFX_USE_GFILE && GFILE_NEED_PETITFS #include "gfile_fs.h" -#include "petitfs_wrapper.h" +#include "gfile_petitfs_wrapper.h" static bool_t petitfsExists(const char* fname); static bool_t petitfsOpen(GFILE* f, const char* fname); diff --git a/src/gfile/sys_options.h b/src/gfile/sys_options.h index 354d4f2b..5581b13b 100644 --- a/src/gfile/sys_options.h +++ b/src/gfile/sys_options.h @@ -127,7 +127,7 @@ * @note PETITFS can only have one file open at a time. */ #ifndef GFILE_NEED_PETITFS - #define GFILE_NEED_FATFS FALSE + #define GFILE_NEED_PETITFS FALSE #endif /** * @brief Include the operating system's native file system