Skip to content

Commit

Permalink
[lcd] add amigo ips(2) in config.json
Browse files Browse the repository at this point in the history
  • Loading branch information
junhuanchen committed Dec 23, 2020
1 parent 72a8065 commit ef8e57e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/drivers/lcd/include/lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ uint16_t lcd_get_height();
typedef void (*lcd_preinit_handler_t)(void);
void lcd_preinit_register_handler(lcd_preinit_handler_t handler);
void lcd_init_sequence_for_ili9486(void);

void lcd_init_sequence_for_ili9481(void);
#endif

13 changes: 11 additions & 2 deletions components/drivers/lcd/src/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ void lcd_preinit_register_handler(lcd_preinit_handler_t handler)
lcd_preinit_handler = handler;
}

void lcd_init_sequence_for_ili9481(void)
{
uint8_t t[2];
// lcd.clear((99, 99, 99))
lcd_clear(0xc63);
// lcd.register(0xD1, 0x00)
tft_write_command(0xD1); /* Unk */
t[0] = (0x00);
tft_write_byte(t, 1);
}

void lcd_init_sequence_for_ili9486(void)
{
uint8_t t[15];
Expand Down Expand Up @@ -250,8 +261,6 @@ uint16_t lcd_get_height()
return g_lcd_h;
}

#include "printf.h"

void lcd_set_direction(lcd_dir_t dir)
{
if(!g_lcd_init)
Expand Down
9 changes: 7 additions & 2 deletions components/micropython/port/src/omv/py/py_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ static uint16_t screen_dir = DIR_YX_RLDU;

static enum
{
LCD_TYPE_ST7789 = 0,
LCD_TYPE_ILI9486 = 1,
LCD_TYPE_ST7789,
LCD_TYPE_ILI9486,
LCD_TYPE_ILI9481,
} lcd_type_t;
typedef struct
{
Expand Down Expand Up @@ -274,6 +275,10 @@ static mp_obj_t py_lcd_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k
}
ret = lcd_init(args[ARG_freq].u_int, true, lcd_cfg.offset_w0, lcd_cfg.offset_h0,
lcd_cfg.offset_w1, lcd_cfg.offset_h1, invert, lcd_cfg.dir, width_curr, height_curr);
if (lcd_cfg.lcd_type == LCD_TYPE_ILI9481)
{
lcd_preinit_register_handler(&lcd_init_sequence_for_ili9481);
}
if (0 != lcd_cfg.dir)
{
lcd_set_direction(lcd_cfg.dir);
Expand Down

0 comments on commit ef8e57e

Please sign in to comment.