diff --git a/inc/mk_ili9225.h b/inc/mk_ili9225.h index 308b8df..c5777a3 100644 --- a/inc/mk_ili9225.h +++ b/inc/mk_ili9225.h @@ -50,6 +50,12 @@ extern void mk_ili9225_set_rs(bool state); */ extern void mk_ili9225_set_cs(bool state); +/** + * Controls state of LED pin. + * \param state Set to 0 on low output, else high. + */ +extern void mk_ili9225_set_led(bool state); + /** * Sends data to the ILI9225 using SPI. Return only after sending data. * \param halfword Data to send. diff --git a/src/main.c b/src/main.c index 932a784..dfe9198 100644 --- a/src/main.c +++ b/src/main.c @@ -223,7 +223,7 @@ void core1_lcd_draw_line(const uint_fast8_t line) } //mk_ili9225_set_address(line + 16, LCD_WIDTH + 30); - mk_ili9225_set_x((SCREEN_SIZE_X - 16) - line); + mk_ili9225_set_x(line + 16); #if USE_DMA mk_ili9225_write_pixels_start(); @@ -279,7 +279,7 @@ void main_core1(void) /* Set LCD window to DMG size. */ mk_ili9225_set_window(16, LCD_HEIGHT + 15, 31, LCD_WIDTH + 30); - //mk_ili9225_set_address(16, LCD_WIDTH + 30); + mk_ili9225_set_address(16, LCD_WIDTH + 30); //mk_ili9225_set_x(15); #if 0 @@ -358,8 +358,8 @@ int main(void) { /* The value for VCO set here is meant for least power * consumption. */ - const unsigned vco = 532000000; /* 266MHz/133MHz */ - const unsigned div1 = 2, div2 = 1; + const unsigned vco = 792000000; /* 264MHz/132MHz */ + const unsigned div1 = 3, div2 = 1; vreg_set_voltage(VREG_VOLTAGE_1_15); sleep_ms(2); diff --git a/src/mk_ili9225.c b/src/mk_ili9225.c index e6757aa..9a4879a 100644 --- a/src/mk_ili9225.c +++ b/src/mk_ili9225.c @@ -333,6 +333,9 @@ unsigned mk_ili9225_init(void) /* Bring ILI9225 out of reset. */ mk_ili9225_set_rst(1); mk_ili9225_delay_ms(50); + + /* Turn backlight off initially */ + mk_ili9225_set_led(0); /* Initialise power registers. */ /* FIXME: This may not be required. All are initialised to 0x00, @@ -455,6 +458,9 @@ unsigned mk_ili9225_init(void) */ set_register(MK_ILI9225_REG_DISPLAY_CTRL, 0x1017); mk_ili9225_delay_ms(50); + + /* Turn on backlight */ + mk_ili9225_set_led(1); #if MK_ILI9225_READ_AVAILABLE /* ret should be 0 if the returned ID was 0x9225. */