annotate target-utils/lunadrv/formike.c @ 1011:6d9b10633f10 default tip

etmsync Pirelli IMEI retrieval: fix poor use of printf() Bug reported by Vadim Yanitskiy <fixeria@osmocom.org>: the construct where a static-allocated string was passed to printf() without any format arguments causes newer compilers to report a security problem. Given that formatted output is not needed here, just fixed string output, change printf() to fputs(), and direct the error message to stderr while at it.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 23 May 2024 17:29:57 +0000
parents 21e0e6492cda
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
700
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include "types.h"
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include "luna.h"
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 /*
832
21e0e6492cda lunadrv: add init-kwh for KWH020ST23-F01 LCD
Mychaela Falconia <falcon@freecalypso.org>
parents: 700
diff changeset
5 * ILI9225G register init for Formike KWH020ST23-F01 LCD. This initialization
21e0e6492cda lunadrv: add init-kwh for KWH020ST23-F01 LCD
Mychaela Falconia <falcon@freecalypso.org>
parents: 700
diff changeset
6 * is almost exactly the same as for our previous HaoRan HT020K1QC36S LCD,
21e0e6492cda lunadrv: add init-kwh for KWH020ST23-F01 LCD
Mychaela Falconia <falcon@freecalypso.org>
parents: 700
diff changeset
7 * except for a different VCOMH setting in register 0x14. Our Formike sales
21e0e6492cda lunadrv: add init-kwh for KWH020ST23-F01 LCD
Mychaela Falconia <falcon@freecalypso.org>
parents: 700
diff changeset
8 * engineer confirmed that the new register setting is required for the new LCD.
700
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 */
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
832
21e0e6492cda lunadrv: add init-kwh for KWH020ST23-F01 LCD
Mychaela Falconia <falcon@freecalypso.org>
parents: 700
diff changeset
11 init_formike()
700
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 {
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 /* reset pulse */
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 CNTL_RST_REG |= EXT_RESET;
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 wait_ARM_cycles(DELAY_1MS * 10);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 CNTL_RST_REG &= ~EXT_RESET;
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 wait_ARM_cycles(DELAY_1MS * 50);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 /* start register init */
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 LCD_REG_WR(0x0001, 0x011c); // set SS and NL bit
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 LCD_REG_WR(0x0002, 0x0100); // set 1 line inversion
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 LCD_REG_WR(0x0003, 0x1030); // set GRAM write direction and BGR=1.
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 LCD_REG_WR(0x0008, 0x0808); // set BP and FP
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 LCD_REG_WR(0x000F, 0x0901); // Set frame rate
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 wait_ARM_cycles(DELAY_1MS * 10);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 LCD_REG_WR(0x0010, 0x0000); // Set SAP,DSTB,STB
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 LCD_REG_WR(0x0011, 0x1B41); // Set APON,PON,AON,VCI1EN,VC
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 wait_ARM_cycles(DELAY_1MS * 50);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 LCD_REG_WR(0x0012, 0x200E); // Internal reference voltage= Vci;
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 LCD_REG_WR(0x0013, 0x0052); // Set GVDD
832
21e0e6492cda lunadrv: add init-kwh for KWH020ST23-F01 LCD
Mychaela Falconia <falcon@freecalypso.org>
parents: 700
diff changeset
30 LCD_REG_WR(0x0014, 0x535C); // new VCOMH setting for KWH020ST23-F01
700
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 //------------- Set GRAM area ------------------//
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 LCD_REG_WR(0x0030, 0x0000);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 LCD_REG_WR(0x0031, 0x00DB);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 LCD_REG_WR(0x0032, 0x0000);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 LCD_REG_WR(0x0033, 0x0000);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 LCD_REG_WR(0x0034, 0x00DB);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 LCD_REG_WR(0x0035, 0x0000);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 LCD_REG_WR(0x0036, 0x00AF);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 LCD_REG_WR(0x0037, 0x0000);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 LCD_REG_WR(0x0038, 0x00DB);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 LCD_REG_WR(0x0039, 0x0000);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 // ----------- Adjust the Gamma Curve ----------//
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 LCD_REG_WR(0x0050, 0x0000);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 LCD_REG_WR(0x0051, 0x0705);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 LCD_REG_WR(0x0052, 0x0C0A);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 LCD_REG_WR(0x0053, 0x0401);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 LCD_REG_WR(0x0054, 0x040C);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 LCD_REG_WR(0x0055, 0x0608);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 LCD_REG_WR(0x0056, 0x0000);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 LCD_REG_WR(0x0057, 0x0104);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 LCD_REG_WR(0x0058, 0x0E06);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 LCD_REG_WR(0x0059, 0x060E);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 wait_ARM_cycles(DELAY_1MS * 50);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 LCD_REG_WR(0x0007, 0x1017);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 return(0);
db9a8e88e63f target-utils lunadrv program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 }