; ***************************************************************************
; copyright   : (C) 2025 by Martin Preuss
; email       : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome".                              *
; * Please see toplevel file COPYING of that project for license details.   *
; ***************************************************************************

#ifndef AQH_AVR_ILI9341_DEFS_ASM
#define AQH_AVR_ILI9341_DEFS_ASM


.equ DISPLAY_IMAGETYPE_IDX2       = 1 ; 2 bit indexed image
.equ DISPLAY_IMAGETYPE_IDX2RLE    = 2 ; 2 bit indexed image, RLE-encoded



#define ILI9341_FRAMERATE_61_HZ 0x1F
#define ILI9341_FRAMERATE_63_HZ 0x1E
#define ILI9341_FRAMERATE_65_HZ 0x1D
#define ILI9341_FRAMERATE_68_HZ 0x1C
#define ILI9341_FRAMERATE_70_HZ 0x1B
#define ILI9341_FRAMERATE_73_HZ 0x1A
#define ILI9341_FRAMERATE_76_HZ 0x19
#define ILI9341_FRAMERATE_79_HZ 0x18
#define ILI9341_FRAMERATE_83_HZ 0x17
#define ILI9341_FRAMERATE_86_HZ 0x16
#define ILI9341_FRAMERATE_90_HZ 0x15
#define ILI9341_FRAMERATE_95_HZ 0x14
#define ILI9341_FRAMERATE_100_HZ 0x13
#define ILI9341_FRAMERATE_106_HZ 0x12
#define ILI9341_FRAMERATE_112_HZ 0x11
#define ILI9341_FRAMERATE_119_HZ 0x10

#define ILI9341_MADCTL_MY  0x80  ; row address order
#define ILI9341_MADCTL_MX  0x40  ; column address order
#define ILI9341_MADCTL_MV  0x20  ; row/column exchange
#define ILI9341_MADCTL_ML  0x10  ; vertical refresh order
#define ILI9341_MADCTL_RGB 0x00  ; RGB color order
#define ILI9341_MADCTL_BGR 0x08  ; BGR color order
#define ILI9341_MADCTL_MH  0x04  ; horizontal refresh order


#define ILI9341_CMD_CASET    0x2A
#define ILI9341_CMD_PASET    0x2B
#define ILI9341_CMD_RAMWR    0x2C
#define ILI9341_CMD_RAMRD    0x2E

#define ILI9341_CMD_COLORSET 0x2d
#define ILI9341_CMD_SETDSPBRIGHTNESS 0x51
#define ILI9341_CMD_WRITECTLDISPLAY  0x53



.equ WIN_OFFS_BGCOLOR_LOW  = 0
.equ WIN_OFFS_BGCOLOR_HIGH = 1

.equ WIN_OFFS_FGCOLOR_LOW  = 2
.equ WIN_OFFS_FGCOLOR_HIGH = 3

.equ WIN_OFFS_WIDTH_LOW    = 4
.equ WIN_OFFS_WIDTH_HIGH   = 5

.equ WIN_OFFS_HEIGHT_LOW   = 6
.equ WIN_OFFS_HEIGHT_HIGH  = 7

.equ WIN_OFFS_ABS_X_LOW    = 8
.equ WIN_OFFS_ABS_X_HIGH   = 9

.equ WIN_OFFS_REL_X_LOW    = 10
.equ WIN_OFFS_REL_X_HIGH   = 11



#endif ; AQH_AVR_ILI9341_DEFS_ASM

