Взято отсюда
http://www.cqham.ru/forum/showthread.php?t=9688Для контроля работоспособности прочитайте регистр типа микросхемы - он в hex содержит 9320
CODE
/* ILI9320.c */
//
//
// TFT панель 320 * 240 ADI_3.2_AM-240320D4TOQW-T00H®
// Только работает медленно.
#include "hardware.h"
#include "display.h"
#include <stdint.h>
#include "synthcalcs.h"
#include "spifuncs.h"
//#include "formats.h" // for debug prints
#if LCDMODE_ILI9320
#include "ili9320.h"
#define ILI9320_SPIMODE SPIC_MODE3
#define targetili9320 targetext1
#if CPUSTYLE_ARM
//#define ILI9320_CMD() do { TARGET_LS020_PORT_S = LS020_RS; } while (0)
//#define ILI9320_DAT() do { TARGET_LS020_PORT_C = LS020_RS; } while (0)
#define ILI9320_RST_SET() do { TARGET_LS020_PORT_S = LS020_RST; } while (0)
#define ILI9320_RST_CLR() do { TARGET_LS020_PORT_C = LS020_RST; } while (0)
#elif CPUSTYLE_ATMEGA
//#define ILI9320_CMD() do { TARGET_LS020_PORT |= LS020_RS; } while (0)
//#define ILI9320_DAT() do { TARGET_LS020_PORT &= ~ LS020_RS; } while (0)
#define ILI9320_RST_SET() do { TARGET_LS020_PORT |= LS020_RST; } while (0)
#define ILI9320_RST_CLR() do { TARGET_LS020_PORT &= ~ LS020_RST; } while (0)
#else
#error Undefined CPUSTYLE_XXX
#endif
static void ili9320_hardware_initialize(void)
{
#if CPUSTYLE_AT91SAM7
enum { WORKMASK = LS020_RST }; // битовая маска, определяет каким выводом шевелить
arm_hardware_pioa_outputs(WORKMASK, WORKMASK);
arm_hardware_pioa_only(WORKMASK);
#elif CPUSTYLE_ATSAM3S
enum { WORKMASK = LS020_RST }; // битовая маска, определяет каким выводом шевелить
arm_hardware_pioa_outputs(WORKMASK, WORKMASK);
arm_hardware_pioa_only(WORKMASK);
#elif CPUSTYLE_ATMEGA
TARGET_LS020_DDR |= (LS020_RST);
#else
#error Undefined CPUSTYLE_XXX
#endif
}
static void
ili9320_select(void)
{
prog_select(targetili9320);
#if WITHSPIHW
hardware_spi_connect(ILI9320_SPIMODE);
#endif /* WITHSPIHW */
}
static void
ili9320_unselect(void)
{
#if WITHSPIHW
hardware_spi_disconnect();
#endif /* WITHSPIHW */
prog_unselect(targetili9320);
}
#if WITHSPIHW
#define ili9320_progval8(v) \
do { hardware_spi_byte(v); } while (0)
#define ili9320_progval8_p1(v) \
do { hardware_spi_byte_p1(v); } while (0) // выдача первого байта в последовательности
#define ili9320_progval8_p2(v) \
do { hardware_spi_byte_p2(v); } while (0) // выдача средних байтов в последовательности
#define ili9320_progval8_p3(v) \
hardware_spi_byte_p3(v) // выдача последнего байта в последовательности
#define ili9320_read_byte() \
hardware_spi_byte(0xff)
#elif WITHSPISW
#define ili9320_progval8(v) \
do { prog_val(targetili9320, v, 8); } while (0)
#define ili9320_progval8_p1(v) \
do { prog_val(targetili9320, v, 8); } while (0)
#define ili9320_progval8_p2(v) \
do { prog_val(targetili9320, v, 8); } while (0)
#define ili9320_progval8_p3(v) \
do { prog_val(targetili9320, v, 8); } while (0)
#define ili9320_read_byte() \
spi_read_byte(targetili9320)
#endif /* WITHSPIHW */
/*
RS R/W Function
0 0 Set an index register
0 1 Read a status
1 0 Write a register or GRAM data
1 1 Read a register or GRAM data
*/
/* SPI interface definitions */
#define ILI9320_SPI_IDCODE (0x70) // постоянная часть первого байта
#define ILI9320_SPI_ID(x) ((x) << 2)
#define ILI9320_SPI_READ (0x01) // WR = 1
#define ILI9320_SPI_WRITE (0x00) // WR = 0
#define ILI9320_SPI_DATA (0x02) // RS = 1
#define ILI9320_SPI_INDEX (0x00) // RS = 0
static void
LCD_CtrlWrite_ILI9320(
uint_fast8_t addr,
uint_fast16_t data
)
{
const uint_fast8_t v1 =
ILI9320_SPI_WRITE |
ILI9320_SPI_INDEX | // RS = 0
ILI9320_SPI_ID(0) |
ILI9320_SPI_IDCODE; //0x70 // постоянная часть первого байта
const uint_fast8_t v2 =
ILI9320_SPI_WRITE |
ILI9320_SPI_DATA | // RS = 1
ILI9320_SPI_ID(0) |
ILI9320_SPI_IDCODE; //0x70 // постоянная часть первого байта
ili9320_select();
ili9320_progval8_p1(v1);
ili9320_progval8_p2(0x00); // high byte of address
ili9320_progval8_p3(addr >> 0); // low byte of address
ili9320_unselect();
ili9320_select();
ili9320_progval8_p1(v2);
ili9320_progval8_p2(data >> 8);
ili9320_progval8_p3(data >> 0);
ili9320_unselect();
}
static uint_fast16_t
LCD_Read_ILI9320(
uint_fast16_t addr
)
{
uint_fast8_t r1, r2;
enum { v1 =
ILI9320_SPI_WRITE |
ILI9320_SPI_INDEX | // rs = 0
ILI9320_SPI_ID(0) |
ILI9320_SPI_IDCODE }; //0x70 // постоянная часть первого байта
enum { v2 =
ILI9320_SPI_READ |
ILI9320_SPI_DATA | // rs = 1
ILI9320_SPI_ID(0) |
ILI9320_SPI_IDCODE }; //0x70 // постоянная часть первого байта
ili9320_select();
ili9320_progval8_p1(v1);
ili9320_progval8_p2(addr >> 8); // high byte of address
ili9320_progval8_p3(addr >> 0); // low byte of address
ili9320_unselect();
ili9320_select();
ili9320_progval8_p1(v2);
ili9320_progval8_p3(0); // dummy
r1 = ili9320_read_byte();
r2 = ili9320_read_byte();
ili9320_unselect();
return r1 * 256 + r2;
}
// в режим передачи данных переводим сразу по окончании команд.
void ili9320_put_char_begin(void)
{
uint_fast16_t addr = 0x22;
const uint_fast8_t v1 =
ILI9320_SPI_WRITE |
ILI9320_SPI_INDEX | // RS = 0
ILI9320_SPI_ID(0) |
ILI9320_SPI_IDCODE; //0x70 // постоянная часть первого байта
const uint_fast8_t v2 =
ILI9320_SPI_WRITE |
ILI9320_SPI_DATA | // RS = 1
ILI9320_SPI_ID(0) |
ILI9320_SPI_IDCODE; //0x70 // постоянная часть первого байта
ili9320_select();
ili9320_progval8_p1(v1);
ili9320_progval8_p2(0x00); // high byte of address
ili9320_progval8_p3(addr >> 0); // low byte of address
ili9320_unselect();
ili9320_select();
ili9320_progval8(v2);
}
void ili9320_put_char_end(void)
{
ili9320_unselect();
}
static void
ili9320_put_pixel_p1(
COLOR_T color
)
{
ili9320_progval8_p1(color >> 8); // смотреть бит TRI а регистре 03
ili9320_progval8_p2(color >> 0); // смотреть бит TRI а регистре 03
}
static void
ili9320_put_pixel_p2(
COLOR_T color
)
{
ili9320_progval8_p2(color >> 8); // смотреть бит TRI а регистре 03
ili9320_progval8_p2(color >> 0); // смотреть бит TRI а регистре 03
}
static void
ili9320_put_pixel_p3(
COLOR_T color
)
{
ili9320_progval8_p2(color >> 8); // смотреть бит TRI а регистре 03
ili9320_progval8_p3(color >> 0); // смотреть бит TRI а регистре 03
}
static COLOR_T color, bkcolor;
void ili9320_setcolor(uint_fast8_t acolor, uint_fast8_t abkcolor)
{
color = acolor;
bkcolor = abkcolor;
}
static void ili9320_pixel_p1(
uint_fast8_t fg
)
{
const COLOR_T cl = fg ? color : bkcolor;
uint_fast8_t n = REP_Y - 1;
ili9320_put_pixel_p1(cl);
while (n --)
{
ili9320_put_pixel_p2(cl);
}
}
static void ili9320_pixel_p2(
uint_fast8_t fg
)
{
const COLOR_T cl = fg ? color : bkcolor;
uint_fast8_t n = REP_Y;
while (n --)
{
ili9320_put_pixel_p2(cl);
}
}
static void ili9320_pixel_p3(
uint_fast8_t fg
)
{
const COLOR_T cl = fg ? color : bkcolor;
uint_fast8_t n = REP_Y - 1;
while (n --)
{
ili9320_put_pixel_p2(cl);
}
ili9320_put_pixel_p3(cl);
}
static void
//NOINLINEAT
ili9320_putoctet(
uint_fast8_t v
)
{
ili9320_pixel_p1(v & 0x80);
ili9320_pixel_p2(v & 0x40);
ili9320_pixel_p2(v & 0x20);
ili9320_pixel_p2(v & 0x10);
ili9320_pixel_p2(v & 0x08);
ili9320_pixel_p2(v & 0x04);
ili9320_pixel_p2(v & 0x02);
ili9320_pixel_p3(v & 0x01);
}
static uint_fast8_t
NOINLINEAT
bigfont_decode(uint_fast8_t c)
{
if (c == ' ' || c == '#')
return 10;
if (c >= '0' && c <= '9')
return c - '0';
return 11; // точка
}
static uint_fast8_t
ascii_decode(uint_fast8_t c)
{
#if 1 // ????
return c - ' ';
#else
static const PROGMEM uint8_t decode_tbl[] =
{
// 0x20 - 0x79 as default but charset = charset - 0x20,
// 0xC0 - 0xFF (RU) - have to decoding
0x21, 0x60, 0x22, 0x61, 0x88, 0x25, 0x63, 0x64, // А - З
0x65, 0x66, 0x2B, 0x67, 0x2D, 0x28, 0x2f, 0x68, // И - П
0x30, 0x23, 0x34, 0x69, 0x6A, 0x38, 0x89, 0x6B, // Р - Ч
0x6C, 0x8A, 0x6D, 0x6E, 0x8F, 0x6F, 0x70, 0x71, // Ш - Я
0x41, 0x72, 0x73, 0x74, 0x8B, 0x45, 0x76, 0x77, // а - з
0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x4f, 0x7E, // и - п
0x50, 0x43, 0x7F, 0x59, 0x8C, 0x58, 0x8D, 0x80, //
0x81, 0x8E, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, //
};
if (c < 0x20)
c = 0x00;
else
{
if (c < 0x80)
c -= 0x20;
else
{
if (c >= 0xC0)
c = pgm_read_byte(& decode_tbl[c - 0xC0]);
else
c = 0x00;
}
}
return c;
#endif
}
// Вызов этой функции только внутри display_wrdata_begin() и display_wrdata_end();
void ili9320_put_char_fast(char cc, uint_fast8_t lowhalf)
{
const uint_fast8_t c = ascii_decode((unsigned char) cc);
enum { NCOLS = (sizeof ls020_font[0][0] / sizeof ls020_font[0][0][0]) };
const uint8_t * p = & ls020_font[c][lowhalf][0];
uint_fast8_t i;
for (i = 0; i < NCOLS; ++ i)
{
const uint_fast8_t v = pgm_read_byte(p ++);
uint_fast8_t n = REP_X;
while (n --)
{
ili9320_putoctet(v);
}
}
}
// Вызов этой функции только внутри display_wrdata_begin() и display_wrdata_end();
void ili9320_put_char_big(char cc, uint_fast8_t lowhalf)
{
uint_fast8_t i = (cc == '.' || cc == '#') ? 12 : 0; // начальная колонка знакогенератора, откуда начинать.
const uint_fast8_t c = bigfont_decode((unsigned char) cc);
enum { NCOLS = (sizeof ls020_bigfont [0][0] / sizeof ls020_bigfont [0][0][0]) };
const uint8_t * p = & ls020_bigfont [c][lowhalf][i];
for (; i < NCOLS; ++ i)
{
const uint_fast8_t v = pgm_read_byte(p ++);
uint_fast8_t n = REP_X;
while (n --)
{
ili9320_putoctet(v);
}
}
}
// Вызов этой функции только внутри display_wrdata_begin() и display_wrdata_end();
void ili9320_put_char_half(char cc, uint_fast8_t lowhalf)
{
const uint_fast8_t c = bigfont_decode((unsigned char) cc);
enum { NCOLS = (sizeof ls020_halffont [0][0] / sizeof ls020_halffont [0][0][0]) };
const uint8_t * p = & ls020_halffont [c][lowhalf][0];
uint_fast8_t i;
for (i = 0; i < NCOLS; ++ i)
{
const uint_fast8_t v = pgm_read_byte(p ++);
uint_fast8_t n = REP_X;
while (n --)
{
ili9320_putoctet(v);
}
}
}
#if WITHBARS
static void ili9320_bar_column(uint_fast8_t v)
{
ili9320_putoctet(v);
}
void ili9320_dispbar(
uint_fast8_t width, // количество знакомест, занимаемых индикатором
uint_fast8_t value, // значение, которое надо отобразить
uint_fast8_t topvalue, // значение, соответствующее полностью заполненному индикатору
uint_fast8_t pattern // DISPLAY_BAR_HALF или DISPLAY_BAR_FULL
)
{
enum { NCOLS = (sizeof ls020_font[0][0] / sizeof ls020_font[0][0][0]) };
const uint_fast8_t t = value * width * NCOLS / topvalue;
uint_fast8_t i, j;
for (i = 0, j = t ; i < j; ++ i)
{
#if CTLSTYLE_SW2011
ili9320_bar_column(pattern);
#else
ili9320_bar_column((i % 2) == 0 ? pattern : PATTERN_BAR_EMPTY);
#endif
}
for (j = width * NCOLS; i < j; ++ i)
ili9320_bar_column(PATTERN_BAR_EMPTY);
}
#endif /* WITHBARS */
void ili9320_set_contrast(uint_fast8_t v) //display contrast
{
}
#define ASX 0x12
#define ASY 0x13
#define APX 0x14
#define AEX 0x15
#define AEY 0x16
#define APY 0x17
/*
Функция установки курсора в позицию x,y
X - координата по горизонтали в пределах 0-175,
Y - координата по вертикали (строка) в пределах 8 бит
*/
void ili9320_set_addr_column(uint_fast16_t x, uint_fast8_t y)
{
LCD_CtrlWrite_ILI9320(0x0020, y);
LCD_CtrlWrite_ILI9320(0x0021, x);
// открыть строку для записи текста
LCD_CtrlWrite_ILI9320(0x0050, y); // Horizontal GRAM Start Address
LCD_CtrlWrite_ILI9320(0x0051, y + CHAR_H - 1); // Horizontal GRAM End Address
//LCD_CtrlWrite_ILI9320(0x0052, x); // Vertical GRAM Start Address
//LCD_CtrlWrite_ILI9320(0x0053, 320 - 1); // Vertical GRAM End Address
}
void ili9320_clear(void)
{
unsigned long i;
// открыть весь экран
LCD_CtrlWrite_ILI9320(0x0050, 0); // Horizontal GRAM Start Address
LCD_CtrlWrite_ILI9320(0x0051, 240 - 1); // Horizontal GRAM End Address
//LCD_CtrlWrite_ILI9320(0x0052, 0); // Vertical GRAM Start Address
//LCD_CtrlWrite_ILI9320(0x0053, 320 - 1); // Vertical GRAM End Address
LCD_CtrlWrite_ILI9320(0x0020, 0);
LCD_CtrlWrite_ILI9320(0x0021, 0);
ili9320_put_char_begin();
for (i = 0; i < (320UL * 256) / 8; ++ i)
{
ili9320_putoctet(BGCOLOR);
}
ili9320_put_char_end();
color = WHITE, bkcolor = BGCOLOR;
}
// скопировано из даташита.
// под разные виды панелей там различные инициализациолнные последовательностти.
// CPT QVGA 3.2" Panel
static
void ILI9320_CPT32_Initial(void)
{
// VCI=2.8V
//************* Reset LCD Driver ****************//
ILI9320_RST_SET(); // Pull RST pin up
_delay_ms(1); // Delay 1ms
ILI9320_RST_CLR(); // Pull RST pin down
_delay_ms(10); // Delay 10ms
ILI9320_RST_SET(); // Pull RST pin up
_delay_ms(50); // Delay 50 ms
//************* Start Initial Sequence **********//
LCD_CtrlWrite_ILI9320(0x00E5, 0x8000); // Set the internal vcore voltage
LCD_CtrlWrite_ILI9320(0x0000, 0x0001); // Start internal OSC.
LCD_CtrlWrite_ILI9320(0x0001, 0x0100); // set SS and SM bit
LCD_CtrlWrite_ILI9320(0x0002, 0x0700); // set 1 line inversion
LCD_CtrlWrite_ILI9320(0x0003, 0x1030 /* 0x1030 */); // set GRAM write direction and BGR=1.
LCD_CtrlWrite_ILI9320(0x0004, 0x0000); // Resize register
LCD_CtrlWrite_ILI9320(0x0008, 0x0202); // set the back porch and front porch
LCD_CtrlWrite_ILI9320(0x0009, 0x0000); // set non-display area refresh cycle ISC[3:0]
LCD_CtrlWrite_ILI9320(0x000A, 0x0000); // FMARK function
LCD_CtrlWrite_ILI9320(0x000C, 0x0000); // RGB interface setting
LCD_CtrlWrite_ILI9320(0x000D, 0x0000); // Frame marker Position
LCD_CtrlWrite_ILI9320(0x000F, 0x0000); // RGB interface polarity
//*************Power On sequence ****************//
LCD_CtrlWrite_ILI9320(0x0010, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
LCD_CtrlWrite_ILI9320(0x0011, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
LCD_CtrlWrite_ILI9320(0x0012, 0x0000); // VREG1OUT voltage
LCD_CtrlWrite_ILI9320(0x0013, 0x0000); // VDV[4:0] for VCOM amplitude
_delay_ms(200); // Dis-charge capacitor power voltage
LCD_CtrlWrite_ILI9320(0x0010, 0x17B0); // SAP, BT[3:0], AP, DSTB, SLP, STB
LCD_CtrlWrite_ILI9320(0x0011, 0x0147); // DC1[2:0], DC0[2:0], VC[2:0]
_delay_ms(50); // Delay 50ms
LCD_CtrlWrite_ILI9320(0x0012, 0x013C); // VREG1OUT voltage
_delay_ms(50); // Delay 50ms
LCD_CtrlWrite_ILI9320(0x0013, 0x0E00); // VDV[4:0] for VCOM amplitude
LCD_CtrlWrite_ILI9320(0x0029, 0x0009); // VCM[4:0] for VCOMH
_delay_ms(50);
LCD_CtrlWrite_ILI9320(0x0020, 0x0000); // GRAM horizontal Address
LCD_CtrlWrite_ILI9320(0x0021, 0x0000); // GRAM Vertical Address
// ----------- Adjust the Gamma Curve ----------//
LCD_CtrlWrite_ILI9320(0x0030, 0x0207);
LCD_CtrlWrite_ILI9320(0x0031, 0x0505);
LCD_CtrlWrite_ILI9320(0x0032, 0x0102);
LCD_CtrlWrite_ILI9320(0x0035, 0x0006);
LCD_CtrlWrite_ILI9320(0x0036, 0x0606);
LCD_CtrlWrite_ILI9320(0x0037, 0x0707);
LCD_CtrlWrite_ILI9320(0x0038, 0x0506);
LCD_CtrlWrite_ILI9320(0x0039, 0x0407);
LCD_CtrlWrite_ILI9320(0x003C, 0x0106);
LCD_CtrlWrite_ILI9320(0x003D, 0x0601);
//------------------ Set GRAM area ---------------//
LCD_CtrlWrite_ILI9320(0x0050, 0x0000); // Horizontal GRAM Start Address
LCD_CtrlWrite_ILI9320(0x0051, 0x00EF); // Horizontal GRAM End Address
LCD_CtrlWrite_ILI9320(0x0052, 0x0000); // Vertical GRAM Start Address
LCD_CtrlWrite_ILI9320(0x0053, 0x013F); // Vertical GRAM End Address
LCD_CtrlWrite_ILI9320(0x0060, 0x2700); // Gate Scan Line
LCD_CtrlWrite_ILI9320(0x0061, 0x0001); // NDL,VLE, REV
LCD_CtrlWrite_ILI9320(0x006A, 0x0000); // set scrolling line
//-------------- Partial Display Control ---------//
LCD_CtrlWrite_ILI9320(0x0080, 0x0000);
LCD_CtrlWrite_ILI9320(0x0081, 0x0000);
LCD_CtrlWrite_ILI9320(0x0082, 0x0000);
LCD_CtrlWrite_ILI9320(0x0083, 0x0000);
LCD_CtrlWrite_ILI9320(0x0084, 0x0000);
LCD_CtrlWrite_ILI9320(0x0085, 0x0000);
//-------------- Panel Control -------------------//
LCD_CtrlWrite_ILI9320(0x0090, 0x0010);
LCD_CtrlWrite_ILI9320(0x0092, 0x0000);
LCD_CtrlWrite_ILI9320(0x0093, 0x0003);
LCD_CtrlWrite_ILI9320(0x0095, 0x0110);
LCD_CtrlWrite_ILI9320(0x0097, 0x0000);
LCD_CtrlWrite_ILI9320(0x0098, 0x0000);
LCD_CtrlWrite_ILI9320(0x0007, 0x0173); // 262K color and display ON
}
static
void LCD_ExitSleep_ILI9320(void)
{
//*************Power On sequence ******************//
LCD_CtrlWrite_ILI9320(0x0010, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
LCD_CtrlWrite_ILI9320(0x0011, 0x0000); // DC1[2:0], DC0[2:0], VC[2:0]
LCD_CtrlWrite_ILI9320(0x0012, 0x0000); // VREG1OUT voltage
LCD_CtrlWrite_ILI9320(0x0013, 0x0000); // VDV[4:0] for VCOM amplitude
_delay_ms(200); // Dis-charge capacitor power voltage
LCD_CtrlWrite_ILI9320(0x0010, 0x17B0); // SAP, BT[3:0], AP, DSTB, SLP, STB
LCD_CtrlWrite_ILI9320(0x0011, 0x0147); // DC1[2:0], DC0[2:0], VC[2:0]
_delay_ms(50); // Delay 50ms
LCD_CtrlWrite_ILI9320(0x0012, 0x013C); // VREG1OUT voltage
_delay_ms(50); // Delay 50ms
LCD_CtrlWrite_ILI9320(0x0013, 0x0E00); // VDV[4:0] for VCOM amplitude
LCD_CtrlWrite_ILI9320(0x0029, 0x0009); // VCM[4:0] for VCOMH
_delay_ms(50);
LCD_CtrlWrite_ILI9320(0x0007, 0x0173); // 262K color and display ON
}
static
void LCD_EnterSleep_ILI9320(void)
{
LCD_CtrlWrite_ILI9320(0x0007, 0x0000); // display OFF
//************* Power OFF sequence **************//
LCD_CtrlWrite_ILI9320(0x0010, 0x0000); // SAP, BT[3:0], APE, AP, DSTB, SLP
LCD_CtrlWrite_ILI9320(0x0011, 0x0000); // DC1[2:0], DC0[2:0], VC[2:0]
LCD_CtrlWrite_ILI9320(0x0012, 0x0000); // VREG1OUT voltage
LCD_CtrlWrite_ILI9320(0x0013, 0x0000); // VDV[4:0] for VCOM amplitude
_delay_ms(200); // Dis-charge capacitor power voltage
LCD_CtrlWrite_ILI9320(0x0010, 0x0002); // SAP, BT[3:0], APE, AP, DSTB, SLP
}
void ili9320_disable(uint_fast8_t state)
{
if (state != 0)
LCD_EnterSleep_ILI9320();
else
LCD_ExitSleep_ILI9320();
}
void ili9320_initialize(void)
{
ili9320_hardware_initialize();
ILI9320_CPT32_Initial();
//ili9320_set_contrast(255);
//ili9320_clear();
#if 0
// Печать параметров на экране
for (;;)
{
//static unsigned count;
//count ++;
char buff [22];
const unsigned long n = 0; //LCD_Read_ILI9320(0x0000); // 0x9242 expected
const unsigned long n2 = LCD_Status_ILI9320();
local_snprintf_P(buff, sizeof buff / sizeof buff [0],
PSTR("%04lX,%04lX"),
n,
n2
);
display_gotoxy(0, 0);
display_string(buff, 0);
}
#endif
//for (;;)
// ;
}
#endif /* LCDMODE_ILI9320 */