Krolyxon
Commit 1d55752

Branches

Tags

Refs →

orion-rf.piolibdepsesp32-s3-n16r8U8g2srcclibu8x8_d_ssd1309.c

499 lines · 17.8 KB · C

1/*
2
3 u8x8_d_ssd1309.c
4
5 Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
6
7 Copyright (c) 2017, olikraus@gmail.com
8 All rights reserved.
9
10 Redistribution and use in source and binary forms, with or without modification,
11 are permitted provided that the following conditions are met:
12
13 * Redistributions of source code must retain the above copyright notice, this list
14 of conditions and the following disclaimer.
15
16 * Redistributions in binary form must reproduce the above copyright notice, this
17 list of conditions and the following disclaimer in the documentation and/or other
18 materials provided with the distribution.
19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
21 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
22 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
25 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34*/
35
36#include "u8x8.h"
37
38static const uint8_t u8x8_d_ssd1309_powersave0_seq[] = {
39 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
40 U8X8_C(0x0af), /* display on */
41 U8X8_END_TRANSFER(), /* disable chip */
42 U8X8_END() /* end of sequence */
43};
44
45static const uint8_t u8x8_d_ssd1309_powersave1_seq[] = {
46 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
47 U8X8_C(0x0ae), /* display off */
48 U8X8_END_TRANSFER(), /* disable chip */
49 U8X8_END() /* end of sequence */
50};
51
52/* ==> CSC rename u8x8_d_ssd1309_128x64_flip0_seq => u8x8_d_ssd1309_flip0_seq <== */
53static const uint8_t u8x8_d_ssd1309_flip0_seq[] = {
54 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
55 U8X8_C(0x0a1), /* segment remap a0/a1*/
56 U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */
57 U8X8_END_TRANSFER(), /* disable chip */
58 U8X8_END() /* end of sequence */
59};
60
61/* ==> CSC rename u8x8_d_ssd1309_128x64_flip1_seq => u8x8_d_ssd1309_flip1_seq <== */
62static const uint8_t u8x8_d_ssd1309_flip1_seq[] = {
63 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
64 U8X8_C(0x0a0), /* segment remap a0/a1*/
65 U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */
66 U8X8_END_TRANSFER(), /* disable chip */
67 U8X8_END() /* end of sequence */
68};
69
70static uint8_t u8x8_d_ssd1309_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
71{
72 uint8_t x, c;
73 uint8_t *ptr;
74 switch(msg)
75 {
76 case U8X8_MSG_DISPLAY_DRAW_TILE:
77 u8x8_cad_StartTransfer(u8x8);
78 x = ((u8x8_tile_t *)arg_ptr)->x_pos;
79 x *= 8;
80 x += u8x8->x_offset;
81
82 u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) );
83 u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15)));
84 u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos) );
85
86
87 do
88 {
89 c = ((u8x8_tile_t *)arg_ptr)->cnt;
90 ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
91 u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */
92 /*
93 do
94 {
95 u8x8_cad_SendData(u8x8, 8, ptr);
96 ptr += 8;
97 c--;
98 } while( c > 0 );
99 */
100 arg_int--;
101 } while( arg_int > 0 );
102
103 u8x8_cad_EndTransfer(u8x8);
104 break;
105 case U8X8_MSG_DISPLAY_SET_POWER_SAVE:
106 if ( arg_int == 0 )
107 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_powersave0_seq);
108 else
109 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_powersave1_seq);
110 break;
111#ifdef U8X8_WITH_SET_CONTRAST
112 case U8X8_MSG_DISPLAY_SET_CONTRAST:
113 u8x8_cad_StartTransfer(u8x8);
114 u8x8_cad_SendCmd(u8x8, 0x081 );
115 u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1309 has range from 0 to 255 */
116 u8x8_cad_EndTransfer(u8x8);
117 break;
118#endif
119 default:
120 return 0;
121 }
122 return 1;
123}
124
125
126/*=================================================*/
127/* offset 2 version */
128
129/* timing from SSD1306 */
130static const u8x8_display_info_t u8x8_ssd1309_128x64_noname2_display_info =
131{
132 /* chip_enable_level = */ 0,
133 /* chip_disable_level = */ 1,
134
135 /* post_chip_enable_wait_ns = */ 20,
136 /* pre_chip_disable_wait_ns = */ 10,
137 /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */
138 /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */
139 /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */
140 /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */
141 /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
142 /* spi_mode = */ 0, /* active high, rising edge */
143 /* i2c_bus_clock_100kHz = */ 4,
144 /* data_setup_time_ns = */ 40,
145 /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */
146 /* tile_width = */ 16,
147 /* tile_height = */ 8,
148 /* default_x_offset = */ 2,
149 /* flipmode_x_offset = */ 2,
150 /* pixel_width = */ 128,
151 /* pixel_height = */ 64
152};
153
154
155static const uint8_t u8x8_d_ssd1309_128x64_noname_init_seq[] = {
156
157 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
158
159 U8X8_C(0x0ae), /* display off */
160 U8X8_CA(0x0d5, 0x0a0), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
161 //U8X8_CA(0x0a8, 0x03f), /* multiplex ratio */
162 U8X8_C(0x040), /* set display start line to 0 */
163 U8X8_CA(0x020, 0x002), /* horizontal addressing mode */
164
165 U8X8_C(0x0a1), /* segment remap a0/a1*/
166 U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */
167 // Flipmode
168 // U8X8_C(0x0a0), /* segment remap a0/a1*/
169 // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */
170
171 U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
172
173 U8X8_CA(0x081, 0x06f), /* [2] set contrast control */
174 U8X8_CA(0x0d9, 0x0d3), /* [2] pre-charge period 0x022/f1*/
175 U8X8_CA(0x0db, 0x020), /* vcomh deselect level */
176 // if vcomh is 0, then this will give the biggest range for contrast control issue #98
177 // restored the old values for the noname constructor, because vcomh=0 will not work for all OLEDs, #116
178
179 U8X8_C(0x02e), /* Deactivate scroll */
180 U8X8_C(0x0a4), /* output ram to display */
181 U8X8_C(0x0a6), /* none inverted normal display mode */
182
183 //U8X8_C(0x0af), /* display on */
184
185 U8X8_END_TRANSFER(), /* disable chip */
186 U8X8_END() /* end of sequence */
187};
188
189/* CSC ==> */
190static const uint8_t u8x8_d_ssd1309_128x128_noname_init_seq[] = {
191
192 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
193
194 U8X8_C(0x0ae), /* display off */
195 U8X8_CA(0x0d5, 0x0a0), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
196 U8X8_CA(0x0a8, 0x07f), /* multiplex ratio */ /* 128 Zeilen 0x07f, 64 Zeilen 0x03f */
197 U8X8_C(0x040), /* set display start line to 0 */
198 U8X8_CA(0x020, 0x002), /* horizontal addressing mode */
199
200 U8X8_C(0x0a1), /* segment remap a0/a1*/
201 U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */
202 // Flipmode
203 // U8X8_C(0x0a0), /* segment remap a0/a1*/
204 // U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */
205
206 U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
207
208 U8X8_CA(0x081, 0x06f), /* [2] set contrast control */
209 U8X8_CA(0x0d9, 0x0d3), /* [2] pre-charge period 0x022/f1*/
210 U8X8_CA(0x0db, 0x020), /* vcomh deselect level */
211 // if vcomh is 0, then this will give the biggest range for contrast control issue #98
212 // restored the old values for the noname constructor, because vcomh=0 will not work for all OLEDs, #116
213
214 U8X8_C(0x02e), /* Deactivate scroll */
215 U8X8_C(0x0a4), /* output ram to display */
216 U8X8_C(0x0a6), /* none inverted normal display mode */
217
218 //U8X8_C(0x0af), /* display on */
219
220 U8X8_END_TRANSFER(), /* disable chip */
221 U8X8_END() /* end of sequence */
222};
223/* <== CSC */
224
225uint8_t u8x8_d_ssd1309_128x64_noname2(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
226{
227
228 if ( u8x8_d_ssd1309_generic(u8x8, msg, arg_int, arg_ptr) != 0 )
229 return 1;
230
231 switch(msg)
232 {
233 case U8X8_MSG_DISPLAY_SET_FLIP_MODE:
234 if ( arg_int == 0 )
235 {
236 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_flip0_seq);
237 u8x8->x_offset = u8x8->display_info->default_x_offset;
238 }
239 else
240 {
241 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_flip1_seq);
242 u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
243 }
244 break;
245 case U8X8_MSG_DISPLAY_INIT:
246 u8x8_d_helper_display_init(u8x8);
247 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_noname_init_seq);
248 break;
249 case U8X8_MSG_DISPLAY_SETUP_MEMORY:
250 u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1309_128x64_noname2_display_info);
251 break;
252 default:
253 return 0;
254 }
255 return 1;
256}
257
258
259/*=================================================*/
260/* offset 0 version */
261
262/* timing from SSD1306 */
263static const u8x8_display_info_t u8x8_ssd1309_128x64_noname0_display_info =
264{
265 /* chip_enable_level = */ 0,
266 /* chip_disable_level = */ 1,
267
268 /* post_chip_enable_wait_ns = */ 20,
269 /* pre_chip_disable_wait_ns = */ 10,
270 /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */
271 /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */
272 /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */
273 /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */
274 /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
275 /* spi_mode = */ 0, /* active high, rising edge */
276 /* i2c_bus_clock_100kHz = */ 4,
277 /* data_setup_time_ns = */ 40,
278 /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */
279 /* tile_width = */ 16,
280 /* tile_height = */ 8,
281 /* default_x_offset = */ 0,
282 /* flipmode_x_offset = */ 0,
283 /* pixel_width = */ 128,
284 /* pixel_height = */ 64
285};
286
287/* CSC ==> */
288static const u8x8_display_info_t u8x8_ssd1309_128x128_noname0_display_info =
289{
290 /* chip_enable_level = */ 0,
291 /* chip_disable_level = */ 1,
292
293 /* post_chip_enable_wait_ns = */ 20,
294 /* pre_chip_disable_wait_ns = */ 10,
295 /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */
296 /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */
297 /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */
298 /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */
299 /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
300 /* spi_mode = */ 0, /* active high, rising edge */
301 /* i2c_bus_clock_100kHz = */ 4,
302 /* data_setup_time_ns = */ 40,
303 /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */
304 /* tile_width = */ 16,
305 /* tile_height = */ 16,
306 /* default_x_offset = */ 0,
307 /* flipmode_x_offset = */ 0,
308 /* pixel_width = */ 128,
309 /* pixel_height = */ 128
310};
311/* <== CSC */
312
313uint8_t u8x8_d_ssd1309_128x64_noname0(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
314{
315
316 if ( u8x8_d_ssd1309_generic(u8x8, msg, arg_int, arg_ptr) != 0 )
317 return 1;
318
319 switch(msg)
320 {
321 case U8X8_MSG_DISPLAY_SET_FLIP_MODE:
322 if ( arg_int == 0 )
323 {
324 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_flip0_seq);
325 u8x8->x_offset = u8x8->display_info->default_x_offset;
326 }
327 else
328 {
329 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_flip1_seq);
330 u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
331 }
332 break;
333 case U8X8_MSG_DISPLAY_INIT:
334 u8x8_d_helper_display_init(u8x8);
335 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_noname_init_seq);
336 break;
337 case U8X8_MSG_DISPLAY_SETUP_MEMORY:
338 u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1309_128x64_noname0_display_info);
339 break;
340 default:
341 return 0;
342 }
343 return 1;
344}
345
346/* CSC ==> */
347uint8_t u8x8_d_ssd1309_128x128_noname0(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
348{
349
350 if ( u8x8_d_ssd1309_generic(u8x8, msg, arg_int, arg_ptr) != 0 )
351 return 1;
352
353 switch(msg)
354 {
355 case U8X8_MSG_DISPLAY_SET_FLIP_MODE:
356 if ( arg_int == 0 )
357 {
358 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_flip0_seq);
359 u8x8->x_offset = u8x8->display_info->default_x_offset;
360 }
361 else
362 {
363 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_flip1_seq);
364 u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
365 }
366 break;
367 case U8X8_MSG_DISPLAY_INIT:
368 u8x8_d_helper_display_init(u8x8);
369 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x128_noname_init_seq);
370 break;
371 case U8X8_MSG_DISPLAY_SETUP_MEMORY:
372 u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1309_128x128_noname0_display_info);
373 break;
374 default:
375 return 0;
376 }
377 return 1;
378}
379/* <== CSC */
380
381/*=================================================*/
382/*
383 EA OLEDS102
384 Contributed here: https://github.com/olikraus/u8g2/pull/1497/files
385 Manually added here, device renamed from SSD1309 to SSD1306
386*/
387
388static const uint8_t u8x8_d_ssd1309_102x64_ea_oleds102_init_seq[] = {
389
390 U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
391
392 U8X8_C(0x40), //Set Display start line
393 U8X8_C(0xA0), //Bottom View no Segment remap
394 U8X8_C(0xC0), //Bottom View COM scan direction normal
395 U8X8_C(0x2E), //StartColumnAddress
396 U8X8_CA(0x8D, 0x95), //Switch Charge Pump (9V)
397 U8X8_CA(0x20, 0x02), //Set Memory AddressMode
398 U8X8_CA(0x81, 0xFF), //Set Brightness
399 U8X8_CA(0xD5, 0x40), //Set Display Clock Divide
400 U8X8_CA(0xD9, 0xF1), //Set Precharge Periode
401 U8X8_CA(0xAD, 0x30), //Set Internal Ref
402 U8X8_CAA(0x21, 0x0D, 0x72), //Set ColumnAddress to 13x8 + 10 = 114/0x72
403 U8X8_CAA(0x22, 0x00, 0x3F), //Set PageAddress
404 U8X8_C(0xAF), //Display on
405
406 U8X8_END_TRANSFER(), /* disable chip */
407 U8X8_END() /* end of sequence */
408};
409
410/* timing from SSD1306 */
411static const u8x8_display_info_t u8x8_ssd1309_102x64_ea_oleds102_display_info =
412{
413 /* chip_enable_level = */ 0,
414 /* chip_disable_level = */ 1,
415
416 /* post_chip_enable_wait_ns = */ 20,
417 /* pre_chip_disable_wait_ns = */ 10,
418 /* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */
419 /* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */
420 /* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */
421 /* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */
422 /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
423 /* spi_mode = */ 0, /* active high, rising edge */
424 /* i2c_bus_clock_100kHz = */ 4,
425 /* data_setup_time_ns = */ 40,
426 /* write_pulse_width_ns = */ 150, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */
427 /* tile_width = */ 13, /* width of 13*8=104 pixel */
428 /* tile_height = */ 8,
429 /* default_x_offset = */ 13,
430 /* flipmode_x_offset = */ 13,
431 /* pixel_width = */ 102,
432 /* pixel_height = */ 64
433};
434
435uint8_t u8x8_d_ssd1306_102x64_ea_oleds102(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
436{
437 uint8_t x, c;
438 uint8_t *ptr;
439
440 switch(msg)
441 {
442 case U8X8_MSG_DISPLAY_SET_FLIP_MODE:
443 if ( arg_int == 0 )
444 {
445 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_flip0_seq);
446 u8x8->x_offset = u8x8->display_info->default_x_offset;
447 }
448 else
449 {
450 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_flip1_seq);
451 u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
452 }
453 break;
454 case U8X8_MSG_DISPLAY_INIT:
455 u8x8_d_helper_display_init(u8x8);
456 u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_102x64_ea_oleds102_init_seq);
457 break;
458 case U8X8_MSG_DISPLAY_SETUP_MEMORY:
459 u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1309_102x64_ea_oleds102_display_info);
460 break;
461 case U8X8_MSG_DISPLAY_SET_CONTRAST:
462 u8x8_cad_StartTransfer(u8x8);
463 u8x8_cad_SendCmd(u8x8, 0x081 );
464 u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1309 has range from 0 to 255 */
465 u8x8_cad_EndTransfer(u8x8);
466 break;
467 case U8X8_MSG_DISPLAY_DRAW_TILE:
468 u8x8_cad_StartTransfer(u8x8);
469
470 x = ((u8x8_tile_t *)arg_ptr)->x_pos;
471 x *= 8;
472 x += u8x8->x_offset;
473 u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) );
474 u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15)));
475 u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos));
476
477 c = ((u8x8_tile_t *)arg_ptr)->cnt;
478 c *= 8;
479 ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
480
481 if ( c + x > 115u )
482 {
483 c = 115u;
484 c -= x;
485 }
486 do
487 {
488 u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */
489 arg_int--;
490 } while( arg_int > 0 );
491
492 u8x8_cad_EndTransfer(u8x8);
493 break;
494 default:
495 return 0;
496 }
497 return 1;
498}
499