Fix GDISP_NEED_CONTROL for the STM32F429i-Discovery board.

This commit is contained in:
inmarket 2014-11-07 13:06:02 +10:00
parent 2a1c7785cc
commit baebbad623
2 changed files with 13 additions and 36 deletions

View File

@ -60,17 +60,17 @@ static inline void init_board(GDisplay *g) {
palSetPadMode(GPIOF, GPIOF_LCD_DCX, PAL_MODE_ALTERNATE(5));
palSetPadMode(GPIOF, GPIOF_LCD_DE, PAL_MODE_ALTERNATE(14));
#define STM32_SAISRC_NOCLOCK (0 << 23) /**< No clock. */
#define STM32_SAISRC_PLL (1 << 23) /**< SAI_CKIN is PLL. */
#define STM32_SAIR_DIV2 (0 << 16) /**< R divided by 2. */
#define STM32_SAIR_DIV4 (1 << 16) /**< R divided by 4. */
#define STM32_SAIR_DIV8 (2 << 16) /**< R divided by 8. */
#define STM32_SAIR_DIV16 (3 << 16) /**< R divided by 16. */
#define STM32_SAISRC_NOCLOCK (0 << 23) /**< No clock. */
#define STM32_SAISRC_PLL (1 << 23) /**< SAI_CKIN is PLL. */
#define STM32_SAIR_DIV2 (0 << 16) /**< R divided by 2. */
#define STM32_SAIR_DIV4 (1 << 16) /**< R divided by 4. */
#define STM32_SAIR_DIV8 (2 << 16) /**< R divided by 8. */
#define STM32_SAIR_DIV16 (3 << 16) /**< R divided by 16. */
#define STM32_PLLSAIN_VALUE 192
#define STM32_PLLSAIQ_VALUE 7
#define STM32_PLLSAIR_VALUE 4
#define STM32_PLLSAIR_POST STM32_SAIR_DIV4
#define STM32_PLLSAIN_VALUE 192
#define STM32_PLLSAIQ_VALUE 7
#define STM32_PLLSAIR_VALUE 4
#define STM32_PLLSAIR_POST STM32_SAIR_DIV4
/* PLLSAI activation.*/
RCC->PLLSAICFGR = (STM32_PLLSAIN_VALUE << 6) | (STM32_PLLSAIR_VALUE << 28) | (STM32_PLLSAIQ_VALUE << 24);
@ -92,32 +92,9 @@ static inline void post_init_board(GDisplay *g) {
(void) g;
}
static inline void setpin_reset(GDisplay *g, bool_t state) {
(void) g;
(void) state;
/*
if(state) {
// reset lcd
palClearPad(GPIOE, GPIOE_LCD_RST);
} else {
palSetPad(GPIOE, GPIOE_LCD_RST);
}
*/
}
static inline void set_backlight(GDisplay *g, uint8_t percent) {
(void) g;
(void) percent;
// TODO: can probably pwm this
/*
if(percent) {
// turn back light on
palSetPad(GPIOE, GPIOE_LCD_BLED);
} else {
// turn off
palClearPad(GPIOE, GPIOE_LCD_BLED);
}
*/
}
static inline void acquire_bus(GDisplay *g) {

View File

@ -354,7 +354,7 @@ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
return;
switch((powermode_t)g->p.ptr) {
case powerOff: case powerOn: case powerSleep: case powerDeepSleep:
board_power(g, (powermode_t)g->p.ptr);
// TODO
break;
default:
return;
@ -394,13 +394,13 @@ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
case GDISP_CONTROL_BACKLIGHT:
if ((unsigned)g->p.ptr > 100) g->p.ptr = (void *)100;
board_backlight(g, (unsigned)g->p.ptr);
set_backlight(g, (unsigned)g->p.ptr);
g->g.Backlight = (unsigned)g->p.ptr;
return;
case GDISP_CONTROL_CONTRAST:
if ((unsigned)g->p.ptr > 100) g->p.ptr = (void *)100;
board_contrast(g, (unsigned)g->p.ptr);
// TODO
g->g.Contrast = (unsigned)g->p.ptr;
return;
}