components/u8g2/csrc/u8x8_d_sed1330.c

Tue, 08 Oct 2019 12:00:31 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 08 Oct 2019 12:00:31 +0200
changeset 0
88d965579617
permissions
-rw-r--r--

Initial import of the CO2 meter application.

0
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 u8x8_d_sed1330.c
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 Copyright (c) 2016, olikraus@gmail.com
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 All rights reserved.
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 Redistribution and use in source and binary forms, with or without modification,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 are permitted provided that the following conditions are met:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * Redistributions of source code must retain the above copyright notice, this list
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 of conditions and the following disclaimer.
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * Redistributions in binary form must reproduce the above copyright notice, this
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 list of conditions and the following disclaimer in the documentation and/or other
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 materials provided with the distribution.
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 The device might also work with the RA8835, SED1335 and SED1336 controller.
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 The following devices might be compatible:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 RA8835
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 SED1330
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 SED1335
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 S1D13700
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 #include "u8x8.h"
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 static const uint8_t u8x8_d_sed1330_powersave0_seq[] = {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 U8X8_CA(0x040, 0x030), /* sys init (0x040) with one arg, where 0x030 is a wild guess */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 U8X8_CA(0x059, 0x004), /* send display on command (hex 0x059, see p37 ) */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 /* display cmd has one arg: 01010100 should enable all three blocks, but disable the cursor*/
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 U8X8_END_TRANSFER(), /* disable chip */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 U8X8_END() /* end of sequence */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 };
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 static const uint8_t u8x8_d_sed1330_powersave1_seq[] = {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 U8X8_CA(0x058, 0x000), /* send display off command (hex 0x059, see p37) and turn of all banks */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 /* maybe send a sleep in cmd */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 //U8X8_C(0x053) /* sleep in: 0x053 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 U8X8_END_TRANSFER(), /* disable chip */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 U8X8_END() /* end of sequence */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 };
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 uint8_t u8x8_d_sed1330_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 uint8_t c, i;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 uint16_t y;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 uint8_t *ptr;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 switch(msg)
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 /* U8X8_MSG_DISPLAY_SETUP_MEMORY is handled by the calling function */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 /*
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 case U8X8_MSG_DISPLAY_SETUP_MEMORY:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 break;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 case U8X8_MSG_DISPLAY_INIT:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 break;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 case U8X8_MSG_DISPLAY_SET_POWER_SAVE:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 if ( arg_int == 0 )
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 u8x8_cad_SendSequence(u8x8, u8x8_d_sed1330_powersave0_seq);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 else
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 u8x8_cad_SendSequence(u8x8, u8x8_d_sed1330_powersave1_seq);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 break;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 case U8X8_MSG_DISPLAY_DRAW_TILE:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 y = (((u8x8_tile_t *)arg_ptr)->y_pos);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 y*=8;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 y*= u8x8->display_info->tile_width;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 u8x8_cad_StartTransfer(u8x8);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 c = ((u8x8_tile_t *)arg_ptr)->cnt; /* number of tiles */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; /* data ptr to the tiles */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 for( i = 0; i < 8; i++ )
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 u8x8_cad_SendCmd(u8x8, 0x046 ); /* CSRW command*/
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 u8x8_cad_SendArg(u8x8, y&255); /* CSRW low adr byte */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 u8x8_cad_SendArg(u8x8, y>>8); /* CSRW high adr byte */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 u8x8_cad_SendCmd(u8x8, 0x042 ); /* MWRITE */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes, send one line of data */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 ptr += u8x8->display_info->tile_width;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 y += u8x8->display_info->tile_width;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 }
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 /* sometimes the display switches off... so just sent a display on command */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 u8x8_cad_SendCmd(u8x8, 0x059 ); /* display on */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 u8x8_cad_SendArg(u8x8, 0x004); /* arg for display on */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 u8x8_cad_EndTransfer(u8x8);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 //u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, 200, NULL); /* extra dely required */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 break;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 default:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 return 0;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 }
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 return 1;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 }
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 /*=============================================*/
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 static const u8x8_display_info_t u8x8_sed1330_240x128_display_info =
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 /* chip_enable_level = */ 0,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 /* chip_disable_level = */ 1,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 /* post_chip_enable_wait_ns = */ 30, /* G242CX Datasheet p5 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 /* pre_chip_disable_wait_ns = */ 10, /* G242CX Datasheet p5 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 /* reset_pulse_width_ms = */ 1,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 /* post_reset_wait_ms = */ 6,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 /* sda_setup_time_ns = */ 20,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 /* sck_pulse_width_ns = */ 140,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 /* spi_mode = */ 0,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 /* i2c_bus_clock_100kHz = */ 4,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 /* data_setup_time_ns = */ 120, /* G242CX Datasheet p5 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 /* write_pulse_width_ns = */ 220, /* G242CX Datasheet p5 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 /* tile_width = */ 0x01e,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 /* tile_hight = */ 16,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 /* default_x_offset = */ 0,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 /* flipmode_x_offset = */ 0,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 /* pixel_width = */ 240,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 /* pixel_height = */ 128
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 };
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 /* 240x128 Seiko G242C */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 static const uint8_t u8x8_d_sed1330_240x128_init_seq[] = {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 /* system init command, see also u8x8_d_sed1330_powersave0_seq */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 U8X8_CA(0x040, 0x030), /* sys init (0x040) with one arg, where 0x030 is a wild guess */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 /* system init has total 8 parameters, so 7 more are here */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 U8X8_A(0x087), /* no idea here... WF (topmost bit) is set to one because it is suggested in the datasheet, lowest 3 bits refer to text mode only */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 U8X8_A(0x007), /* FY: height of a char+1, does not matter here (hopefully), because we use graphics mode only */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 U8X8_A(0x01d), /* C/R: this could be the number of horizontal bytes - 1 (Value confirmed with app notes p41) */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 U8X8_A(0x050), /* TC/R: According to app notes fOSC=6Mhz fFF=70Hz --> TC/R = 74d*/
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 U8X8_A(0x080), /* L/F: Lines per frame - 1, probably this is the height of the display - 1 (value confirmed with app notes p41)*/
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 U8X8_A(0x01e), /* Low byte of the virtual screen size. (Value confirmed with app notes p41) */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 U8X8_A(0), /* High byte of the virtual screen size, see also section 9.1.2 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 U8X8_C(0x044), /* SCROLL */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 U8X8_A(0x080),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 U8X8_A(0x040),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 U8X8_A(0x080),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 U8X8_CA(0x05a, 0), /* HDOT SCR: Horizontal dotwise scroll... set to 0 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 U8X8_CA(0x05b, 0x0c), /* OVLAY: 2-layer, all graphics, OR between layer 1 and 2 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 U8X8_END_TRANSFER(), /* disable chip */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188 };
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 /* RA8835 NHD-240128BZ */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 static const uint8_t u8x8_d_rh8835_nhd_240128_init_seq[] = {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 /* system init command, see also u8x8_d_sed1330_powersave0_seq */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 U8X8_CA(0x040, 0x030), /* sys init (0x040) with one arg, where 0x030 is a wild guess */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 /* system init has total 8 parameters, so 7 more are here */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 U8X8_A(0x087), /* no idea here... WF (topmost bit) is set to one because it is suggested in the datasheet, lowest 3 bits refer to text mode only */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 U8X8_A(0x007), /* FY: height of a char+1, does not matter here (hopefully), because we use graphics mode only */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 U8X8_A(0x01d), /* C/R: this could be the number of horizontal bytes - 1 (Value confirmed with app notes p41) */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 U8X8_A(0x050), /* TC/R: According to app notes fOSC=6Mhz fFF=70Hz --> TC/R = 74d*/
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 U8X8_A(0x080), /* L/F: Lines per frame - 1, probably this is the height of the display - 1 (value confirmed with app notes p41)*/
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 U8X8_A(0x01e), /* Low byte of the virtual screen size. (Value confirmed with app notes p41) */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 U8X8_A(0), /* High byte of the virtual screen size, see also section 9.1.2 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 U8X8_C(0x044), /* SCROLL */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 U8X8_A(0x080),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 U8X8_A(0x040),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 U8X8_A(0x080),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 //U8X8_CA(0x05a, 0), /* HDOT SCR: Horizontal dotwise scroll... set to 0 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 U8X8_CA(0x05b, 0x0c), /* OVLAY: 2-layer, all graphics, OR between layer 1 and 2 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 //U8X8_CA(0x059, 0x04), /* send display on command (hex 0x059, see p37 ) */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 U8X8_END_TRANSFER(), /* disable chip */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 };
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 uint8_t u8x8_d_sed1330_240x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 switch(msg)
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 case U8X8_MSG_DISPLAY_SETUP_MEMORY:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sed1330_240x128_display_info);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 break;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 case U8X8_MSG_DISPLAY_INIT:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 u8x8_d_helper_display_init(u8x8);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 u8x8_cad_SendSequence(u8x8, u8x8_d_sed1330_240x128_init_seq);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 break;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 default:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 return u8x8_d_sed1330_common(u8x8, msg, arg_int, arg_ptr);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 }
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 return 1;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 }
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 uint8_t u8x8_d_ra8835_nhd_240x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 switch(msg)
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 case U8X8_MSG_DISPLAY_SETUP_MEMORY:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sed1330_240x128_display_info);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 break;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 case U8X8_MSG_DISPLAY_INIT:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 u8x8_d_helper_display_init(u8x8);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 u8x8_cad_SendSequence(u8x8, u8x8_d_rh8835_nhd_240128_init_seq);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 break;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 default:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 return u8x8_d_sed1330_common(u8x8, msg, arg_int, arg_ptr);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 }
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 return 1;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 }
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 /*=============================================*/
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272 static const u8x8_display_info_t u8x8_sed1330_320x240_display_info =
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 /* chip_enable_level = */ 0,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 /* chip_disable_level = */ 1,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 /* post_chip_enable_wait_ns = */ 30, /* G242CX Datasheet p5 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 /* pre_chip_disable_wait_ns = */ 10, /* G242CX Datasheet p5 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 /* reset_pulse_width_ms = */ 1,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 /* post_reset_wait_ms = */ 6,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 /* sda_setup_time_ns = */ 20,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 /* sck_pulse_width_ns = */ 140,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 /* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 /* spi_mode = */ 0,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 /* i2c_bus_clock_100kHz = */ 4,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 /* data_setup_time_ns = */ 120, /* G242CX Datasheet p5 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 /* write_pulse_width_ns = */ 220, /* G242CX Datasheet p5 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 /* tile_width = */ 40,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 /* tile_hight = */ 30,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 /* default_x_offset = */ 0,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 /* flipmode_x_offset = */ 0,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 /* pixel_width = */ 320,
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 /* pixel_height = */ 240
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 };
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
296 static const uint8_t u8x8_d_sed1330_320x240_init_seq[] = {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
297 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301 /* system init command, see also u8x8_d_sed1330_powersave0_seq */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
302 U8X8_CA(0x040, 0x030), /* sys init (0x040) with one arg, where 0x030 is a wild guess */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 /* system init has total 8 parameters, so 7 more are here */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 U8X8_A(0x087), /* no idea here... WF (topmost bit) is set to one because it is suggested in the datasheet, lowest 3 bits refer to text mode only */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 U8X8_A(0x007), /* FY: height of a char+1, does not matter here (hopefully), because we use graphics mode only */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 U8X8_A(0x027), /* 40-1 */ /* C/R: this could be the number of horizontal bytes - 1 (Value confirmed with app notes p41) */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307 U8X8_A(0x039), /* TC/R: According to app notes fOSC=6Mhz fFF=70Hz --> TC/R = 74d*/
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
308 U8X8_A(0x0ef), /* L/F: Lines per frame - 1, probably this is the height of the display - 1 (value confirmed with app notes p41)*/
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309 U8X8_A(0x028), /* Low byte of the virtual screen size. (Value confirmed with app notes p41) */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
310 U8X8_A(0), /* High byte of the virtual screen size, see also section 9.1.2 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
311
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
312 U8X8_C(0x044), /* SCROLL */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
315 U8X8_A(0x0ef),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316 U8X8_A(0x0b0),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 U8X8_A(0x004),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 U8X8_A(0x0ef),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322 U8X8_A(0x000),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 U8X8_CA(0x05a, 0), /* HDOT SCR: Horizontal dotwise scroll... set to 0 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 U8X8_CA(0x05b, 0x0c), /* OVLAY: 2-layer, all graphics, OR between layer 1 and 2 */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 U8X8_END_TRANSFER(), /* disable chip */
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331 U8X8_DLY(100),
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 };
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
334
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 uint8_t u8x8_d_ra8835_320x240(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
337 {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 switch(msg)
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 {
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 case U8X8_MSG_DISPLAY_SETUP_MEMORY:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341 u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sed1330_320x240_display_info);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 break;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343 case U8X8_MSG_DISPLAY_INIT:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344 u8x8_d_helper_display_init(u8x8);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 u8x8_cad_SendSequence(u8x8, u8x8_d_sed1330_320x240_init_seq);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 break;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
347 default:
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 return u8x8_d_sed1330_common(u8x8, msg, arg_int, arg_ptr);
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 }
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
350 return 1;
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 }

mercurial