Change to gdisp low level driver API. Display number is now in the GDriver structure (It was required for a Nokia driver).

ugfx_release_2.6
inmarket 2013-10-19 15:36:05 +10:00
parent 443d14c21f
commit 87a6af81f4
24 changed files with 84 additions and 106 deletions

View File

@ -64,17 +64,13 @@ static const SPIConfig spi1cfg_16bit = {
SPI_CR1_DFF //SPI_CR1_BR_0 SPI_CR1_DFF //SPI_CR1_BR_0
}; };
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
// As we are not using multiple displays we set g->priv to NULL as we don't use it. // As we are not using multiple displays we set g->priv to NULL as we don't use it.
g->priv = 0; g->priv = 0;
if (display == 0) { switch(g->controllerdisplay) {
case 0: // Set up for Display 0
/**
* Set up for Display 0
*/
/* Display backlight control */ /* Display backlight control */
/* TIM4 is an alternate function 2 (AF2) */ /* TIM4 is an alternate function 2 (AF2) */
pwmStart(&PWMD4, &pwmcfg); pwmStart(&PWMD4, &pwmcfg);
@ -96,6 +92,7 @@ static inline void init_board(GDisplay *g, unsigned display) {
palSetPadMode(GPIOA, 5, PAL_MODE_ALTERNATE(5)|PAL_STM32_OSPEED_HIGHEST); /* SCK. */ palSetPadMode(GPIOA, 5, PAL_MODE_ALTERNATE(5)|PAL_STM32_OSPEED_HIGHEST); /* SCK. */
palSetPadMode(GPIOA, 6, PAL_MODE_ALTERNATE(5)); /* MISO. */ palSetPadMode(GPIOA, 6, PAL_MODE_ALTERNATE(5)); /* MISO. */
palSetPadMode(GPIOA, 7, PAL_MODE_ALTERNATE(5)|PAL_STM32_OSPEED_HIGHEST); /* MOSI. */ palSetPadMode(GPIOA, 7, PAL_MODE_ALTERNATE(5)|PAL_STM32_OSPEED_HIGHEST); /* MOSI. */
break;
} }
} }

View File

@ -20,16 +20,14 @@
* @brief Initialise the board for the display. * @brief Initialise the board for the display.
* *
* @param[in] g The GDisplay structure * @param[in] g The GDisplay structure
* @param[in] display The display number on this controller (0..n)
* *
* @note Set the g->priv member to whatever is appropriate. For multiple * @note Set the g->priv member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set. * displays this might be a pointer to the appropriate register set.
* *
* @notapi * @notapi
*/ */
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
(void) g; (void) g;
(void) display;
} }
/** /**

View File

@ -61,9 +61,9 @@ static inline void set_viewport(GDisplay* g) {
/* Driver exported functions. */ /* Driver exported functions. */
/*===========================================================================*/ /*===========================================================================*/
LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) { LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
/* Initialise your display */ /* Initialise your display */
init_board(g, display); init_board(g);
// Hardware reset // Hardware reset
setpin_reset(g, TRUE); setpin_reset(g, TRUE);

View File

@ -17,17 +17,13 @@
#define noinline __attribute__((noinline)) #define noinline __attribute__((noinline))
#endif #endif
static void init_board(GDisplay *g, unsigned display) { static void init_board(GDisplay *g) {
// As we are not using multiple displays we set g->priv to NULL as we don't use it. // As we are not using multiple displays we set g->priv to NULL as we don't use it.
g->priv = 0; g->priv = 0;
if (display == 0) { switch(g->controllerdisplay) {
case 0: // Set up for Display 0
/**
* Set up for Display 0
*/
// RST // RST
palSetPadMode(IOPORTA, 7, PAL_MODE_OUTPUT); palSetPadMode(IOPORTA, 7, PAL_MODE_OUTPUT);
palClearPad(IOPORTA, 7); palClearPad(IOPORTA, 7);
@ -59,6 +55,7 @@ static void init_board(GDisplay *g, unsigned display) {
PMCONbits.PMPEN = 1; PMCONbits.PMPEN = 1;
palClearPad(IOPORTA, 9); palClearPad(IOPORTA, 9);
break;
} }
} }

View File

@ -18,17 +18,13 @@
#define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */ #define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */
#define GDISP_RAM (*((volatile uint16_t *) 0x60100000)) /* RS = 1 */ #define GDISP_RAM (*((volatile uint16_t *) 0x60100000)) /* RS = 1 */
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
// As we are not using multiple displays we set g->priv to NULL as we don't use it. // As we are not using multiple displays we set g->priv to NULL as we don't use it.
g->priv = 0; g->priv = 0;
if (display == 0) { switch(g->controllerdisplay) {
case 0: // Set up for Display 0
/**
* Set up for Display 0
*/
/* FSMC setup for F1 */ /* FSMC setup for F1 */
rccEnableAHB(RCC_AHBENR_FSMCEN, 0); rccEnableAHB(RCC_AHBENR_FSMCEN, 0);
@ -46,6 +42,7 @@ static inline void init_board(GDisplay *g, unsigned display) {
/* Bank1 NOR/SRAM control register configuration /* Bank1 NOR/SRAM control register configuration
* This is actually not needed as already set by default after reset */ * This is actually not needed as already set by default after reset */
FSMC_Bank1->BTCR[0] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN; FSMC_Bank1->BTCR[0] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN;
break;
} }
} }

View File

@ -20,16 +20,14 @@
* @brief Initialise the board for the display. * @brief Initialise the board for the display.
* *
* @param[in] g The GDisplay structure * @param[in] g The GDisplay structure
* @param[in] display The display number on this controller (0..n)
* *
* @note Set the g->priv member to whatever is appropriate. For multiple * @note Set the g->priv member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set. * displays this might be a pointer to the appropriate register set.
* *
* @notapi * @notapi
*/ */
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
(void) g; (void) g;
(void) display;
} }
/** /**

View File

@ -95,11 +95,11 @@ static void set_viewport(GDisplay *g) {
} }
} }
LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) { LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
uint16_t cver; uint16_t cver;
/* Initialise your display */ /* Initialise your display */
init_board(g, display); init_board(g);
/* Hardware reset */ /* Hardware reset */
setpin_reset(g, TRUE); setpin_reset(g, TRUE);

View File

@ -31,17 +31,13 @@
#define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */ #define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */
#define GDISP_RAM (*((volatile uint16_t *) 0x60020000)) /* RS = 1 */ #define GDISP_RAM (*((volatile uint16_t *) 0x60020000)) /* RS = 1 */
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
// As we are not using multiple displays we set g->priv to NULL as we don't use it. // As we are not using multiple displays we set g->priv to NULL as we don't use it.
g->priv = 0; g->priv = 0;
if (display == 0) { switch(g->controllerdisplay) {
case 0: // Set up for Display 0
/**
* Set up for Display 0
*/
/* FSMC setup for F1 */ /* FSMC setup for F1 */
rccEnableAHB(RCC_AHBENR_FSMCEN, 0); rccEnableAHB(RCC_AHBENR_FSMCEN, 0);
@ -61,6 +57,7 @@ static inline void init_board(GDisplay *g, unsigned display) {
/* Bank1 NOR/SRAM control register configuration /* Bank1 NOR/SRAM control register configuration
* This is actually not needed as already set by default after reset */ * This is actually not needed as already set by default after reset */
FSMC_Bank1->BTCR[FSMC_Bank] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN; FSMC_Bank1->BTCR[FSMC_Bank] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN;
break;
} }
} }

View File

@ -20,16 +20,14 @@
* @brief Initialise the board for the display. * @brief Initialise the board for the display.
* *
* @param[in] g The GDisplay structure * @param[in] g The GDisplay structure
* @param[in] display The display number on this controller (0..n)
* *
* @note Set the g->priv member to whatever is appropriate. For multiple * @note Set the g->priv member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set. * displays this might be a pointer to the appropriate register set.
* *
* @notapi * @notapi
*/ */
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
(void) g; (void) g;
(void) display;
} }
/** /**

View File

@ -96,11 +96,11 @@ static void set_viewport(GDisplay* g) {
} }
} }
LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) { LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
uint16_t cver; uint16_t cver;
/* Initialise your display */ /* Initialise your display */
init_board(g, display); init_board(g);
/* Hardware reset */ /* Hardware reset */
setpin_reset(g, TRUE); setpin_reset(g, TRUE);

View File

@ -25,16 +25,13 @@
#define SET_RD palSetPad(GPIOD, 15); #define SET_RD palSetPad(GPIOD, 15);
#define CLR_RD palClearPad(GPIOD, 15); #define CLR_RD palClearPad(GPIOD, 15);
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
// As we are not using multiple displays we set g->priv to NULL as we don't use it. // As we are not using multiple displays we set g->priv to NULL as we don't use it.
g->priv = 0; g->priv = 0;
if (display == 0) { switch(g->controllerdisplay) {
case 0: // Set up for Display 0
/**
* Set up for Display 0
*/
palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL); palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOD, 12, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOD, 12, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOD, 13, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOD, 13, PAL_MODE_OUTPUT_PUSHPULL);
@ -46,6 +43,7 @@ static inline void init_board(GDisplay *g, unsigned display) {
SET_RD; SET_RD;
SET_WR; SET_WR;
CLR_CS; CLR_CS;
break;
} }
} }

View File

@ -21,16 +21,14 @@
* @brief Initialise the board for the display. * @brief Initialise the board for the display.
* *
* @param[in] g The GDisplay structure * @param[in] g The GDisplay structure
* @param[in] display The display number on this controller (0..n)
* *
* @note Set the g->priv member to whatever is appropriate. For multiple * @note Set the g->priv member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set. * displays this might be a pointer to the appropriate register set.
* *
* @notapi * @notapi
*/ */
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
(void) g; (void) g;
(void) display;
} }
/** /**

View File

@ -70,9 +70,9 @@ static void set_viewport(GDisplay* g) {
/* Driver exported functions. */ /* Driver exported functions. */
/*===========================================================================*/ /*===========================================================================*/
LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) { LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
/* Initialise your display */ /* Initialise your display */
init_board(g, display); init_board(g);
/* Hardware reset */ /* Hardware reset */
setpin_reset(g, TRUE); setpin_reset(g, TRUE);

View File

@ -20,17 +20,13 @@
#define FSMC_BANK 4 #define FSMC_BANK 4
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
// As we are not using multiple displays we set g->priv to NULL as we don't use it. // As we are not using multiple displays we set g->priv to NULL as we don't use it.
g->priv = 0; g->priv = 0;
if (display == 0) { switch(g->controllerdisplay) {
case 0: // Set up for Display 0
/**
* Set up for Display 0
*/
/* set pins to FSMC mode */ /* set pins to FSMC mode */
IOBus busD = {GPIOD, (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5) | (1 << 8) | IOBus busD = {GPIOD, (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5) | (1 << 8) |
(1 << 9) | (1 << 10) | (1 << 11) | (1 << 14) | (1 << 15), 0}; (1 << 9) | (1 << 10) | (1 << 11) | (1 << 14) | (1 << 15), 0};
@ -52,6 +48,7 @@ static inline void init_board(GDisplay *g, unsigned display) {
/* Bank1 NOR/SRAM control register configuration /* Bank1 NOR/SRAM control register configuration
* This is actually not needed as already set by default after reset */ * This is actually not needed as already set by default after reset */
FSMC_Bank1->BTCR[FSMC_BANK] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN; FSMC_Bank1->BTCR[FSMC_BANK] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN;
break;
} }
} }

View File

@ -20,14 +20,14 @@
* @brief Initialise the board for the display. * @brief Initialise the board for the display.
* *
* @param[in] g The GDisplay structure * @param[in] g The GDisplay structure
* @param[in] display The display number on this controller (0..n)
* *
* @note Set the g->priv member to whatever is appropriate. For multiple * @note Set the g->priv member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set. * displays this might be a pointer to the appropriate register set.
* *
* @notapi * @notapi
*/ */
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
(void) g;
} }
/** /**
@ -38,6 +38,7 @@ static inline void init_board(GDisplay *g, unsigned display) {
* @notapi * @notapi
*/ */
static inline void post_init_board(GDisplay *g) { static inline void post_init_board(GDisplay *g) {
(void) g;
} }
/** /**
@ -49,7 +50,8 @@ static inline void post_init_board(GDisplay *g) {
* @notapi * @notapi
*/ */
static inline void setpin_reset(GDisplay *g, bool_t state) { static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
} }
/** /**
@ -60,7 +62,7 @@ static inline void setpin_reset(GDisplay *g, bool_t state) {
* @notapi * @notapi
*/ */
static inline void acquire_bus(GDisplay *g) { static inline void acquire_bus(GDisplay *g) {
(void) g;
} }
/** /**
@ -71,7 +73,7 @@ static inline void acquire_bus(GDisplay *g) {
* @notapi * @notapi
*/ */
static inline void release_bus(GDisplay *g) { static inline void release_bus(GDisplay *g) {
(void) g;
} }
/** /**
@ -83,7 +85,8 @@ static inline void release_bus(GDisplay *g) {
* @notapi * @notapi
*/ */
static inline void write_index(GDisplay *g, uint16_t index) { static inline void write_index(GDisplay *g, uint16_t index) {
(void) g;
(void) index;
} }
/** /**
@ -95,7 +98,8 @@ static inline void write_index(GDisplay *g, uint16_t index) {
* @notapi * @notapi
*/ */
static inline void write_data(GDisplay *g, uint16_t data) { static inline void write_data(GDisplay *g, uint16_t data) {
(void) g;
(void) data;
} }
/** /**
@ -106,7 +110,7 @@ static inline void write_data(GDisplay *g, uint16_t data) {
* @notapi * @notapi
*/ */
static inline void setreadmode(GDisplay *g) { static inline void setreadmode(GDisplay *g) {
(void) g;
} }
/** /**
@ -117,7 +121,7 @@ static inline void setreadmode(GDisplay *g) {
* @notapi * @notapi
*/ */
static inline void setwritemode(GDisplay *g) { static inline void setwritemode(GDisplay *g) {
(void) g;
} }
/** /**
@ -132,9 +136,8 @@ static inline void setwritemode(GDisplay *g) {
* @notapi * @notapi
*/ */
static inline uint16_t read_data(GDisplay *g) { static inline uint16_t read_data(GDisplay *g) {
(void) g;
} }
#endif /* _GDISP_LLD_BOARD_H */ #endif /* _GDISP_LLD_BOARD_H */
/** @} */ /** @} */

View File

@ -106,9 +106,9 @@ static inline void set_backlight(GDisplay* g, uint8_t percent) {
/* Driver exported functions. */ /* Driver exported functions. */
/*===========================================================================*/ /*===========================================================================*/
LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) { LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
/* Initialise your display */ /* Initialise your display */
init_board(g, display); init_board(g);
// Hardware reset // Hardware reset
setpin_reset(g, TRUE); setpin_reset(g, TRUE);

View File

@ -24,16 +24,13 @@
#define SET_RD palSetPad(GPIOD, 15); #define SET_RD palSetPad(GPIOD, 15);
#define CLR_RD palClearPad(GPIOD, 15); #define CLR_RD palClearPad(GPIOD, 15);
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
// As we are not using multiple displays we set g->priv to NULL as we don't use it. // As we are not using multiple displays we set g->priv to NULL as we don't use it.
g->priv = 0; g->priv = 0;
if (display == 0) { switch(g->controllerdisplay) {
case 0: // Set up for Display 0
/**
* Set up for Display 0
*/
palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL); palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOD, 12, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOD, 12, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOD, 13, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOD, 13, PAL_MODE_OUTPUT_PUSHPULL);
@ -45,6 +42,7 @@ static inline void init_board(GDisplay *g, unsigned display) {
SET_RD; SET_RD;
SET_WR; SET_WR;
CLR_CS; CLR_CS;
break;
} }
} }

View File

@ -34,16 +34,14 @@ static const PWMConfig pwmcfg = {
0 0
}; };
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
// As we are not using multiple displays we set g->priv to NULL as we don't use it. // As we are not using multiple displays we set g->priv to NULL as we don't use it.
g->priv = 0; g->priv = 0;
if (display == 0) { switch(g->controllerdisplay) {
case 0: // Set up for Display 0
/** /**
* Set up for Display 0
*
* Performs the following functions: * Performs the following functions:
* 1. initialise the io port used by the display * 1. initialise the io port used by the display
* 2. initialise the reset pin (initial state not-in-reset) * 2. initialise the reset pin (initial state not-in-reset)
@ -95,6 +93,7 @@ static inline void init_board(GDisplay *g, unsigned display) {
pwmStart(&PWMD3, &pwmcfg); pwmStart(&PWMD3, &pwmcfg);
palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATE(2)); palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATE(2));
pwmEnableChannel(&PWMD3, 2, 100); pwmEnableChannel(&PWMD3, 2, 100);
break;
} }
} }

View File

@ -20,16 +20,14 @@
* @brief Initialise the board for the display. * @brief Initialise the board for the display.
* *
* @param[in] g The GDisplay structure * @param[in] g The GDisplay structure
* @param[in] display The display number on this controller (0..n)
* *
* @note Set the g->priv member to whatever is appropriate. For multiple * @note Set the g->priv member to whatever is appropriate. For multiple
* displays this might be a pointer to the appropriate register set. * displays this might be a pointer to the appropriate register set.
* *
* @notapi * @notapi
*/ */
static inline void init_board(GDisplay *g, unsigned display) { static inline void init_board(GDisplay *g) {
(void) g; (void) g;
(void) display;
} }
/** /**

View File

@ -114,9 +114,9 @@ static void set_viewport(GDisplay* g) {
/* Driver exported functions. */ /* Driver exported functions. */
/*===========================================================================*/ /*===========================================================================*/
LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) { LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
/* Initialise your display */ /* Initialise your display */
init_board(g, display); init_board(g);
// Hardware reset // Hardware reset
setpin_reset(g, TRUE); setpin_reset(g, TRUE);

View File

@ -381,7 +381,7 @@ static DECLARE_THREAD_FUNCTION(WindowThread, param) {
/* Driver exported functions. */ /* Driver exported functions. */
/*===========================================================================*/ /*===========================================================================*/
LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) { LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
winPriv * priv; winPriv * priv;
char buf[132]; char buf[132];
@ -426,13 +426,13 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) {
// Turn on toggles for the first GINPUT_TOGGLE_CONFIG_ENTRIES windows // Turn on toggles for the first GINPUT_TOGGLE_CONFIG_ENTRIES windows
#if GINPUT_NEED_TOGGLE #if GINPUT_NEED_TOGGLE
if (display < GINPUT_TOGGLE_CONFIG_ENTRIES) if (g->controllerdisplay < GINPUT_TOGGLE_CONFIG_ENTRIES)
g->flags |= GDISP_FLG_HASTOGGLE; g->flags |= GDISP_FLG_HASTOGGLE;
#endif #endif
// Only turn on mouse on the first window for now // Only turn on mouse on the first window for now
#if GINPUT_NEED_MOUSE #if GINPUT_NEED_MOUSE
if (!display) if (!g->controllerdisplay)
g->flags |= GDISP_FLG_HASMOUSE; g->flags |= GDISP_FLG_HASMOUSE;
#endif #endif
@ -443,13 +443,13 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) {
g->priv = priv; g->priv = priv;
// Create the window in the message thread // Create the window in the message thread
PostThreadMessage(winThreadId, WM_USER, (WPARAM)display, (LPARAM)g); PostThreadMessage(winThreadId, WM_USER, (WPARAM)g->controllerdisplay, (LPARAM)g);
// Wait for the window creation to complete (for safety) // Wait for the window creation to complete (for safety)
while(!(((volatile GDisplay *)g)->flags & GDISP_FLG_READY)) while(!(((volatile GDisplay *)g)->flags & GDISP_FLG_READY))
Sleep(1); Sleep(1);
sprintf(buf, APP_NAME " - %u", display+1); sprintf(buf, APP_NAME " - %u", g->systemdisplay+1);
SetWindowText(priv->hwnd, buf); SetWindowText(priv->hwnd, buf);
ShowWindow(priv->hwnd, SW_SHOW); ShowWindow(priv->hwnd, SW_SHOW);
UpdateWindow(priv->hwnd); UpdateWindow(priv->hwnd);

View File

@ -145,7 +145,7 @@ static int FatalXIOError(Display *d) {
exit(0); exit(0);
} }
LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) { LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
XSizeHints *pSH; XSizeHints *pSH;
XSetWindowAttributes xa; XSetWindowAttributes xa;
XTextProperty WindowTitle; XTextProperty WindowTitle;
@ -208,7 +208,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) {
{ {
char buf[132]; char buf[132];
sprintf(buf, "uGFX - %u", display+1); sprintf(buf, "uGFX - %u", g->systemdisplay+1);
WindowTitleText = buf; WindowTitleText = buf;
XStringListToTextProperty(&WindowTitleText, 1, &WindowTitle); XStringListToTextProperty(&WindowTitleText, 1, &WindowTitle);
XSetWMName(dis, priv->win, &WindowTitle); XSetWMName(dis, priv->win, &WindowTitle);

View File

@ -172,7 +172,8 @@
/*===========================================================================*/ /*===========================================================================*/
struct GDisplay { struct GDisplay {
GDISPControl g; // The public GDISP stuff - must be the first element // The public GDISP stuff - must be the first element
GDISPControl g;
#if GDISP_TOTAL_CONTROLLERS > 1 #if GDISP_TOTAL_CONTROLLERS > 1
const struct GDISPVMT const * vmt; // The Virtual Method Table const struct GDISPVMT const * vmt; // The Virtual Method Table
@ -180,7 +181,8 @@ struct GDisplay {
void * priv; // A private area just for the drivers use. void * priv; // A private area just for the drivers use.
uint8_t systemdisplay;
uint8_t controllerdisplay;
uint16_t flags; uint16_t flags;
#define GDISP_FLG_INSTREAM 0x0001 // We are in a user based stream operation #define GDISP_FLG_INSTREAM 0x0001 // We are in a user based stream operation
#define GDISP_FLG_SCRSTREAM 0x0002 // The stream area currently covers the whole screen #define GDISP_FLG_SCRSTREAM 0x0002 // The stream area currently covers the whole screen
@ -241,10 +243,9 @@ struct GDisplay {
* @brief Initialize the driver. * @brief Initialize the driver.
* @return TRUE if successful. * @return TRUE if successful.
* @param[in] g The driver structure * @param[in] g The driver structure
* @param[in] display The display number for this controller 0..n
* @param[out] g->g The driver must fill in the GDISPControl structure * @param[out] g->g The driver must fill in the GDISPControl structure
*/ */
LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display); LLDSPEC bool_t gdisp_lld_init(GDisplay *g);
#if GDISP_HARDWARE_STREAM_WRITE || defined(__DOXYGEN__) #if GDISP_HARDWARE_STREAM_WRITE || defined(__DOXYGEN__)
/** /**
@ -477,7 +478,7 @@ struct GDisplay {
#if GDISP_TOTAL_CONTROLLERS > 1 #if GDISP_TOTAL_CONTROLLERS > 1
typedef struct GDISPVMT { typedef struct GDISPVMT {
bool_t (*init)(GDisplay *g, unsigned display); bool_t (*init)(GDisplay *g);
void (*writestart)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy void (*writestart)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy
void (*writepos)(GDisplay *g); // Uses p.x,p.y void (*writepos)(GDisplay *g); // Uses p.x,p.y
void (*writecolor)(GDisplay *g); // Uses p.color void (*writecolor)(GDisplay *g); // Uses p.color
@ -569,7 +570,7 @@ struct GDisplay {
}}; }};
#else #else
#define gdisp_lld_init(g, display) g->vmt->init(g, display) #define gdisp_lld_init(g) g->vmt->init(g)
#define gdisp_lld_write_start(g) g->vmt->writestart(g) #define gdisp_lld_write_start(g) g->vmt->writestart(g)
#define gdisp_lld_write_pos(g) g->vmt->writepos(g) #define gdisp_lld_write_pos(g) g->vmt->writepos(g)
#define gdisp_lld_write_color(g) g->vmt->writecolor(g) #define gdisp_lld_write_color(g) g->vmt->writecolor(g)

View File

@ -493,9 +493,9 @@ static void line_clip(GDisplay *g) {
/* Our module initialiser */ /* Our module initialiser */
void _gdispInit(void) { void _gdispInit(void) {
GDisplay *g; GDisplay *g;
unsigned i; uint16_t i;
#if GDISP_TOTAL_CONTROLLERS > 1 #if GDISP_TOTAL_CONTROLLERS > 1
unsigned j; uint16_t j;
#endif #endif
@ -504,13 +504,17 @@ void _gdispInit(void) {
for(g = GDisplayArray, j=0; j < GDISP_TOTAL_CONTROLLERS; j++) for(g = GDisplayArray, j=0; j < GDISP_TOTAL_CONTROLLERS; j++)
for(i = 0; i < DisplayCountList[j]; g++, i++) { for(i = 0; i < DisplayCountList[j]; g++, i++) {
g->vmt = ControllerList[j]; g->vmt = ControllerList[j];
g->systemdisplay = j*GDISP_TOTAL_CONTROLLERS+i;
g->controllerdisplay = i;
#else #else
for(g = GDisplayArray, i = 0; i < GDISP_TOTAL_DISPLAYS; g++, i++) { for(g = GDisplayArray, i = 0; i < GDISP_TOTAL_DISPLAYS; g++, i++) {
g->systemdisplay = i;
g->controllerdisplay = i;
#endif #endif
MUTEX_INIT(g); MUTEX_INIT(g);
MUTEX_ENTER(g); MUTEX_ENTER(g);
g->flags = 0; g->flags = 0;
gdisp_lld_init(g, i); gdisp_lld_init(g);
// Set the initial clipping region // Set the initial clipping region
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP