#ifndef __OTM8009A_LCD_H #define __OTM8009A_LCD_H #include #ifndef OTM_BUS_WIDTH #define OTM_BUS_WIDTH 16 #endif #if OTM_BUS_WIDTH == 16 typedef uint16_t otm_data_t; #elif OTM_BUS_WIDTH == 8 typedef uint8_t otm_data_t; #elif #error "OTM_BUS_WIDTH MUST be 16bit or 8bit." #endif #ifndef OTM_PANEL_SELECTION #define OTM_PANEL_SELECTION otm8009a_800480_16b_init_sequence #endif typedef enum { OTM_OK, OTM_ERROR } otm_ret_t; typedef enum { OTM_HORIZONTAL, OTM_HORIZONTAL_INV, OTM_VERTICAL, OTM_VERTICAL_INV } otm_direction_t; typedef struct { otm_ret_t (*write_reg_cb)(void *handle, otm_data_t *reg, uint8_t len); otm_ret_t (*write_data_cb)(void *handle, otm_data_t *data, uint32_t len); otm_ret_t (*delay_cb)(void *handle, uint32_t usec); } otm_cb_t; typedef struct { otm_direction_t direction; void *user_data; otm_cb_t cb; } otm_t; #define OTM_ERROR_CHECK(x) if(x != OTM_OK) return OTM_ERROR otm_ret_t otm_lcd_init(otm_t *lcd); otm_ret_t otm_lcd_display(otm_t *lcd, uint8_t on); otm_ret_t otm_lcd_upload(otm_t *lcd, uint16_t x1, uint16_t x2, uint16_t y1, uint16_t y2, uint16_t *data); otm_ret_t otm_lcd_direction(otm_t *lcd, otm_direction_t direction); #endif