diff options
Diffstat (limited to 'drivers/gdisp')
20 files changed, 63 insertions, 90 deletions
diff --git a/drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h b/drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h index 4899baa5..daabe75d 100644 --- a/drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h +++ b/drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h @@ -64,17 +64,13 @@ static const SPIConfig spi1cfg_16bit = { 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. g->priv = 0; - if (display == 0) { - - /** - * Set up for Display 0 - */ - + switch(g->controllerdisplay) { + case 0: // Set up for Display 0 /* Display backlight control */ /* TIM4 is an alternate function 2 (AF2) */ 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, 6, PAL_MODE_ALTERNATE(5)); /* MISO. */ palSetPadMode(GPIOA, 7, PAL_MODE_ALTERNATE(5)|PAL_STM32_OSPEED_HIGHEST); /* MOSI. */ + break; } } diff --git a/drivers/gdisp/HX8347D/board_HX8347D_template.h b/drivers/gdisp/HX8347D/board_HX8347D_template.h index 528fb027..58fd9338 100644 --- a/drivers/gdisp/HX8347D/board_HX8347D_template.h +++ b/drivers/gdisp/HX8347D/board_HX8347D_template.h @@ -20,16 +20,14 @@ * @brief Initialise the board for the display. * * @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 * displays this might be a pointer to the appropriate register set. * * @notapi */ -static inline void init_board(GDisplay *g, unsigned display) { +static inline void init_board(GDisplay *g) { (void) g; - (void) display; } /** diff --git a/drivers/gdisp/HX8347D/gdisp_lld.c b/drivers/gdisp/HX8347D/gdisp_lld.c index 19d1b822..8cdbb781 100644 --- a/drivers/gdisp/HX8347D/gdisp_lld.c +++ b/drivers/gdisp/HX8347D/gdisp_lld.c @@ -61,9 +61,9 @@ static inline void set_viewport(GDisplay* g) { /* Driver exported functions. */
/*===========================================================================*/
-LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) {
+LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
/* Initialise your display */
- init_board(g, display);
+ init_board(g);
// Hardware reset
setpin_reset(g, TRUE);
diff --git a/drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h b/drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h index 81d493ed..cf101aaf 100644 --- a/drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h +++ b/drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h @@ -17,17 +17,13 @@ #define noinline __attribute__((noinline)) #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. g->priv = 0; - if (display == 0) { - - /** - * Set up for Display 0 - */ - + switch(g->controllerdisplay) { + case 0: // Set up for Display 0 // RST palSetPadMode(IOPORTA, 7, PAL_MODE_OUTPUT); palClearPad(IOPORTA, 7); @@ -59,6 +55,7 @@ static void init_board(GDisplay *g, unsigned display) { PMCONbits.PMPEN = 1; palClearPad(IOPORTA, 9); + break; } } diff --git a/drivers/gdisp/ILI9320/board_ILI9320_olimex_stm32_lcd.h b/drivers/gdisp/ILI9320/board_ILI9320_olimex_stm32_lcd.h index df02a716..4738db61 100644 --- a/drivers/gdisp/ILI9320/board_ILI9320_olimex_stm32_lcd.h +++ b/drivers/gdisp/ILI9320/board_ILI9320_olimex_stm32_lcd.h @@ -18,17 +18,13 @@ #define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */ #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. g->priv = 0; - if (display == 0) { - - /** - * Set up for Display 0 - */ - + switch(g->controllerdisplay) { + case 0: // Set up for Display 0 /* FSMC setup for F1 */ rccEnableAHB(RCC_AHBENR_FSMCEN, 0); @@ -46,6 +42,7 @@ static inline void init_board(GDisplay *g, unsigned display) { /* Bank1 NOR/SRAM control register configuration * 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; + break; } } diff --git a/drivers/gdisp/ILI9320/board_ILI9320_template.h b/drivers/gdisp/ILI9320/board_ILI9320_template.h index ead9aee0..4725e1eb 100644 --- a/drivers/gdisp/ILI9320/board_ILI9320_template.h +++ b/drivers/gdisp/ILI9320/board_ILI9320_template.h @@ -20,16 +20,14 @@ * @brief Initialise the board for the display. * * @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 * displays this might be a pointer to the appropriate register set. * * @notapi */ -static inline void init_board(GDisplay *g, unsigned display) { +static inline void init_board(GDisplay *g) { (void) g; - (void) display; } /** diff --git a/drivers/gdisp/ILI9320/gdisp_lld.c b/drivers/gdisp/ILI9320/gdisp_lld.c index 3747b3d7..d4639617 100644 --- a/drivers/gdisp/ILI9320/gdisp_lld.c +++ b/drivers/gdisp/ILI9320/gdisp_lld.c @@ -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; /* Initialise your display */ - init_board(g, display); + init_board(g); /* Hardware reset */ setpin_reset(g, TRUE); diff --git a/drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h b/drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h index 166ebc33..ae9e96fc 100644 --- a/drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h +++ b/drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h @@ -31,17 +31,13 @@ #define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */ #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. g->priv = 0; - if (display == 0) { - - /** - * Set up for Display 0 - */ - + switch(g->controllerdisplay) { + case 0: // Set up for Display 0 /* FSMC setup for F1 */ rccEnableAHB(RCC_AHBENR_FSMCEN, 0); @@ -61,6 +57,7 @@ static inline void init_board(GDisplay *g, unsigned display) { /* Bank1 NOR/SRAM control register configuration * 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; + break; } } diff --git a/drivers/gdisp/ILI9325/board_ILI9325_template.h b/drivers/gdisp/ILI9325/board_ILI9325_template.h index 7b067293..65ab5704 100644 --- a/drivers/gdisp/ILI9325/board_ILI9325_template.h +++ b/drivers/gdisp/ILI9325/board_ILI9325_template.h @@ -20,16 +20,14 @@ * @brief Initialise the board for the display. * * @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 * displays this might be a pointer to the appropriate register set. * * @notapi */ -static inline void init_board(GDisplay *g, unsigned display) { +static inline void init_board(GDisplay *g) { (void) g; - (void) display; } /** diff --git a/drivers/gdisp/ILI9325/gdisp_lld.c b/drivers/gdisp/ILI9325/gdisp_lld.c index 42acdc46..8a4b8603 100644 --- a/drivers/gdisp/ILI9325/gdisp_lld.c +++ b/drivers/gdisp/ILI9325/gdisp_lld.c @@ -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; /* Initialise your display */ - init_board(g, display); + init_board(g); /* Hardware reset */ setpin_reset(g, TRUE); diff --git a/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h b/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h index 6614d578..9933d17b 100644 --- a/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h +++ b/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h @@ -25,16 +25,13 @@ #define SET_RD palSetPad(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. g->priv = 0; - if (display == 0) { - - /** - * Set up for Display 0 - */ + switch(g->controllerdisplay) { + case 0: // Set up for Display 0 palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOD, 12, 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_WR; CLR_CS; + break; } } diff --git a/drivers/gdisp/ILI9481/board_ILI9481_template.h b/drivers/gdisp/ILI9481/board_ILI9481_template.h index f3f8bbb7..8dcee19c 100644 --- a/drivers/gdisp/ILI9481/board_ILI9481_template.h +++ b/drivers/gdisp/ILI9481/board_ILI9481_template.h @@ -21,16 +21,14 @@ * @brief Initialise the board for the display. * * @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 * displays this might be a pointer to the appropriate register set. * * @notapi */ -static inline void init_board(GDisplay *g, unsigned display) { +static inline void init_board(GDisplay *g) { (void) g; - (void) display; } /** diff --git a/drivers/gdisp/ILI9481/gdisp_lld.c b/drivers/gdisp/ILI9481/gdisp_lld.c index 06a9e681..fc00be10 100644 --- a/drivers/gdisp/ILI9481/gdisp_lld.c +++ b/drivers/gdisp/ILI9481/gdisp_lld.c @@ -70,9 +70,9 @@ static void set_viewport(GDisplay* g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) { +LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { /* Initialise your display */ - init_board(g, display); + init_board(g); /* Hardware reset */ setpin_reset(g, TRUE); diff --git a/drivers/gdisp/RA8875/board_RA8875_marlin.h b/drivers/gdisp/RA8875/board_RA8875_marlin.h index 95fb7f9d..88523060 100644 --- a/drivers/gdisp/RA8875/board_RA8875_marlin.h +++ b/drivers/gdisp/RA8875/board_RA8875_marlin.h @@ -20,17 +20,13 @@ #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. g->priv = 0; - if (display == 0) { - - /** - * Set up for Display 0 - */ - + switch(g->controllerdisplay) { + case 0: // Set up for Display 0 /* set pins to FSMC mode */ IOBus busD = {GPIOD, (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5) | (1 << 8) | (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 * 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; + break; } } diff --git a/drivers/gdisp/RA8875/board_RA8875_template.h b/drivers/gdisp/RA8875/board_RA8875_template.h index 564f60c0..32d12de5 100644 --- a/drivers/gdisp/RA8875/board_RA8875_template.h +++ b/drivers/gdisp/RA8875/board_RA8875_template.h @@ -20,14 +20,14 @@ * @brief Initialise the board for the display. * * @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 * displays this might be a pointer to the appropriate register set. * * @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 */ static inline void post_init_board(GDisplay *g) { + (void) g; } /** @@ -49,7 +50,8 @@ static inline void post_init_board(GDisplay *g) { * @notapi */ 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 */ static inline void acquire_bus(GDisplay *g) { - + (void) g; } /** @@ -71,7 +73,7 @@ static inline void acquire_bus(GDisplay *g) { * @notapi */ static inline void release_bus(GDisplay *g) { - + (void) g; } /** @@ -83,7 +85,8 @@ static inline void release_bus(GDisplay *g) { * @notapi */ 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 */ 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 */ static inline void setreadmode(GDisplay *g) { - + (void) g; } /** @@ -117,7 +121,7 @@ static inline void setreadmode(GDisplay *g) { * @notapi */ static inline void setwritemode(GDisplay *g) { - + (void) g; } /** @@ -132,9 +136,8 @@ static inline void setwritemode(GDisplay *g) { * @notapi */ static inline uint16_t read_data(GDisplay *g) { - + (void) g; } #endif /* _GDISP_LLD_BOARD_H */ /** @} */ - diff --git a/drivers/gdisp/RA8875/gdisp_lld.c b/drivers/gdisp/RA8875/gdisp_lld.c index 4c146321..6697d9fd 100644 --- a/drivers/gdisp/RA8875/gdisp_lld.c +++ b/drivers/gdisp/RA8875/gdisp_lld.c @@ -106,9 +106,9 @@ static inline void set_backlight(GDisplay* g, uint8_t percent) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) { +LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { /* Initialise your display */ - init_board(g, display); + init_board(g); // Hardware reset setpin_reset(g, TRUE); diff --git a/drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h b/drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h index df7594f8..338d9799 100644 --- a/drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h +++ b/drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h @@ -24,16 +24,13 @@ #define SET_RD palSetPad(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. g->priv = 0; - if (display == 0) { - - /** - * Set up for Display 0 - */ + switch(g->controllerdisplay) { + case 0: // Set up for Display 0 palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOD, 12, 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_WR; CLR_CS; + break; } } diff --git a/drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h b/drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h index 84082089..d1e23c4a 100644 --- a/drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h +++ b/drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h @@ -34,16 +34,14 @@ static const PWMConfig pwmcfg = { 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. 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: * 1. initialise the io port used by the display * 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); palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATE(2)); pwmEnableChannel(&PWMD3, 2, 100); + break; } } diff --git a/drivers/gdisp/SSD1289/board_SSD1289_template.h b/drivers/gdisp/SSD1289/board_SSD1289_template.h index b24789ea..8bef95b9 100644 --- a/drivers/gdisp/SSD1289/board_SSD1289_template.h +++ b/drivers/gdisp/SSD1289/board_SSD1289_template.h @@ -20,16 +20,14 @@ * @brief Initialise the board for the display. * * @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 * displays this might be a pointer to the appropriate register set. * * @notapi */ -static inline void init_board(GDisplay *g, unsigned display) { +static inline void init_board(GDisplay *g) { (void) g; - (void) display; } /** diff --git a/drivers/gdisp/SSD1289/gdisp_lld.c b/drivers/gdisp/SSD1289/gdisp_lld.c index dca11d5d..b376083c 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld.c +++ b/drivers/gdisp/SSD1289/gdisp_lld.c @@ -114,9 +114,9 @@ static void set_viewport(GDisplay* g) { /* Driver exported functions. */
/*===========================================================================*/
-LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) {
+LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
/* Initialise your display */
- init_board(g, display);
+ init_board(g);
// Hardware reset
setpin_reset(g, TRUE);
|