u8x8_d_ssd1327.c 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. /*
  2. u8x8_d_ssd1327.c
  3. Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
  4. Copyright (c) 2016, olikraus@gmail.com
  5. All rights reserved.
  6. Redistribution and use in source and binary forms, with or without modification,
  7. are permitted provided that the following conditions are met:
  8. * Redistributions of source code must retain the above copyright notice, this list
  9. of conditions and the following disclaimer.
  10. * Redistributions in binary form must reproduce the above copyright notice, this
  11. list of conditions and the following disclaimer in the documentation and/or other
  12. materials provided with the distribution.
  13. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  14. CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  15. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  16. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  18. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20. NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  22. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  23. STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  24. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  25. ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #include "u8x8.h"
  28. static const uint8_t u8x8_d_ssd1327_96x96_powersave0_seq[] = {
  29. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  30. U8X8_C(0x0af), /* display on */
  31. U8X8_END_TRANSFER(), /* disable chip */
  32. U8X8_END() /* end of sequence */
  33. };
  34. static const uint8_t u8x8_d_ssd1327_96x96_powersave1_seq[] = {
  35. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  36. U8X8_C(0x0ae), /* display off */
  37. U8X8_END_TRANSFER(), /* disable chip */
  38. U8X8_END() /* end of sequence */
  39. };
  40. static const uint8_t u8x8_d_ssd1327_seeed_96x96_flip0_seq[] = {
  41. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  42. U8X8_CA(0x0a2, 0x020), /* display offset, shift mapping ram counter */
  43. U8X8_CA(0x0a0, 0x051), /* remap configuration */
  44. U8X8_END_TRANSFER(), /* disable chip */
  45. U8X8_END() /* end of sequence */
  46. };
  47. static const uint8_t u8x8_d_ssd1327_seeed_96x96_flip1_seq[] = {
  48. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  49. U8X8_CA(0x0a2, 0x060), /* display offset, shift mapping ram counter */
  50. U8X8_CA(0x0a0, 0x042), /* remap configuration */
  51. U8X8_END_TRANSFER(), /* disable chip */
  52. U8X8_END() /* end of sequence */
  53. };
  54. static const uint8_t u8x8_d_ssd1327_winstar_96x64_flip0_seq[] = {
  55. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  56. U8X8_CA(0x0a0, 0x042), /* remap configuration */
  57. U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */
  58. U8X8_END_TRANSFER(), /* disable chip */
  59. U8X8_END() /* end of sequence */
  60. };
  61. static const uint8_t u8x8_d_ssd1327_winstar_96x64_flip1_seq[] = {
  62. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  63. U8X8_CA(0x0a0, 0x051), /* remap configuration */
  64. U8X8_CA(0x0a2, 0x040), /* display offset, shift mapping ram counter */
  65. U8X8_END_TRANSFER(), /* disable chip */
  66. U8X8_END() /* end of sequence */
  67. };
  68. /*
  69. input:
  70. one tile (8 Bytes)
  71. output:
  72. Tile for ssd1327 (32 Bytes)
  73. */
  74. static uint8_t u8x8_ssd1327_8to32_dest_buf[32];
  75. static uint8_t *u8x8_ssd1327_8to32(U8X8_UNUSED u8x8_t *u8x8, uint8_t *ptr)
  76. {
  77. uint8_t v;
  78. uint8_t a,b;
  79. uint8_t i, j;
  80. uint8_t *dest;
  81. for( j = 0; j < 4; j++ )
  82. {
  83. dest = u8x8_ssd1327_8to32_dest_buf;
  84. dest += j;
  85. a =*ptr;
  86. ptr++;
  87. b = *ptr;
  88. ptr++;
  89. for( i = 0; i < 8; i++ )
  90. {
  91. v = 0;
  92. if ( a&1 ) v |= 0xf0;
  93. if ( b&1 ) v |= 0x0f;
  94. *dest = v;
  95. dest+=4;
  96. a >>= 1;
  97. b >>= 1;
  98. }
  99. }
  100. return u8x8_ssd1327_8to32_dest_buf;
  101. }
  102. static uint8_t u8x8_d_ssd1327_96x96_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
  103. {
  104. uint8_t x, y, c;
  105. uint8_t *ptr;
  106. switch(msg)
  107. {
  108. /* handled by the calling function
  109. case U8X8_MSG_DISPLAY_SETUP_MEMORY:
  110. u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_96x96_display_info);
  111. break;
  112. */
  113. /* handled by the calling function
  114. case U8X8_MSG_DISPLAY_INIT:
  115. u8x8_d_helper_display_init(u8x8);
  116. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_96x96_init_seq);
  117. break;
  118. */
  119. case U8X8_MSG_DISPLAY_SET_POWER_SAVE:
  120. if ( arg_int == 0 )
  121. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_96x96_powersave0_seq);
  122. else
  123. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_96x96_powersave1_seq);
  124. break;
  125. #ifdef U8X8_WITH_SET_CONTRAST
  126. case U8X8_MSG_DISPLAY_SET_CONTRAST:
  127. u8x8_cad_StartTransfer(u8x8);
  128. u8x8_cad_SendCmd(u8x8, 0x081 );
  129. u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1327 has range from 0 to 255 */
  130. u8x8_cad_EndTransfer(u8x8);
  131. break;
  132. #endif
  133. case U8X8_MSG_DISPLAY_DRAW_TILE:
  134. u8x8_cad_StartTransfer(u8x8);
  135. x = ((u8x8_tile_t *)arg_ptr)->x_pos;
  136. x *= 4;
  137. x+=u8x8->x_offset/2;
  138. y = (((u8x8_tile_t *)arg_ptr)->y_pos);
  139. y *= 8;
  140. u8x8_cad_SendCmd(u8x8, 0x075 ); /* set row address, moved out of the loop (issue 302) */
  141. u8x8_cad_SendArg(u8x8, y);
  142. u8x8_cad_SendArg(u8x8, y+7);
  143. do
  144. {
  145. c = ((u8x8_tile_t *)arg_ptr)->cnt;
  146. ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
  147. do
  148. {
  149. u8x8_cad_SendCmd(u8x8, 0x015 ); /* set column address */
  150. u8x8_cad_SendArg(u8x8, x ); /* start */
  151. u8x8_cad_SendArg(u8x8, x+3 ); /* end */
  152. u8x8_cad_SendData(u8x8, 32, u8x8_ssd1327_8to32(u8x8, ptr));
  153. ptr += 8;
  154. x += 4;
  155. c--;
  156. } while( c > 0 );
  157. //x += 4;
  158. arg_int--;
  159. } while( arg_int > 0 );
  160. u8x8_cad_EndTransfer(u8x8);
  161. break;
  162. default:
  163. return 0;
  164. }
  165. return 1;
  166. }
  167. /*=============================================*/
  168. /*
  169. Winstar WEA009664B 96x64 OLED Display, 1.1 inch OLED
  170. https://www.winstar.com.tw/products/oled-module/graphic-oled-display/96x64-oled.html
  171. https://github.com/olikraus/u8g2/issues/1050
  172. */
  173. static const u8x8_display_info_t u8x8_ssd1327_winstar_96x64_display_info =
  174. {
  175. /* chip_enable_level = */ 0,
  176. /* chip_disable_level = */ 1,
  177. /* post_chip_enable_wait_ns = */ 20,
  178. /* pre_chip_disable_wait_ns = */ 10,
  179. /* reset_pulse_width_ms = */ 100,
  180. /* post_reset_wait_ms = */ 100, /**/
  181. /* sda_setup_time_ns = */ 100, /* */
  182. /* sck_pulse_width_ns = */ 100, /* */
  183. /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
  184. /* spi_mode = */ 0, /* active high, rising edge */
  185. /* i2c_bus_clock_100kHz = */ 1, /* use 1 instead of 4, because the SSD1327 seems to be very slow */
  186. /* data_setup_time_ns = */ 40,
  187. /* write_pulse_width_ns = */ 60,
  188. /* tile_width = */ 12,
  189. /* tile_hight = */ 8,
  190. /* default_x_offset = */ 16, /* changed to 16, issue 1050 */
  191. /* flipmode_x_offset = */ 16, /* changed to 16, issue 1050 */
  192. /* pixel_width = */ 96,
  193. /* pixel_height = */ 64
  194. };
  195. /*
  196. Write_Cmd(0xAE); //Set Display Off OK
  197. Write_Cmd(0x81); //Contrast Level OK
  198. Write_Cmd(0xdF); // VALUE WRONG????
  199. Write_Cmd(0xD9); //Pre-charge Period
  200. Write_Cmd(0x00);
  201. Write_Cmd(0xA0); //Set Re-map OK
  202. Write_Cmd(0x42); //Default Setting OK
  203. Write_Cmd(0xA1); //Set Display Start Line OK
  204. Write_Cmd(0x00); OK
  205. Write_Cmd(0xA2); //Set Display Offset OK
  206. Write_Cmd(0x00); OK
  207. Write_Cmd(0xA4); //Set Display Mode OK
  208. Write_Cmd(0xA8); //Set Multiplex Ratio OK
  209. Write_Cmd(0x63); //Multiplex OK
  210. Write_Cmd(0xAB); //Set Function SelectionA OK
  211. Write_Cmd(0x01); OK
  212. Write_Cmd(0xB1); //Set Phase Length OK
  213. Write_Cmd(0x47); OK
  214. Write_Cmd(0xB3); //Set Display Clock Divide Ratio/Oscillator Frequency OK
  215. Write_Cmd(0x00); OK
  216. Write_Cmd(0xBC); //Set Prechange Voltage OK
  217. Write_Cmd(0x07); OK
  218. Write_Cmd(0xBE); //Set VCOMH Voltage OK
  219. Write_Cmd(0x07); OK
  220. Write_Cmd(0xB6); //Set Second Pre-charge period OK
  221. Write_Cmd(0x04); OK
  222. Write_Cmd(0xD5); //Set Function selection B OK
  223. Write_Cmd(0x62); OK
  224. Write_Cmd(0xAF); //Set Display On
  225. */
  226. static const uint8_t u8x8_d_ssd1327_winstar_96x64_init_seq[] = {
  227. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  228. U8X8_CA(0x0fd, 0x012), /* unlock display, usually not required because the display is unlocked after reset */
  229. U8X8_C(0x0ae), /* display off */
  230. U8X8_CA(0x0d9, 0x000), /* Pre-charge Period ??? */
  231. U8X8_CA(0x0a0, 0x042), /* remap configuration */
  232. U8X8_CA(0x0a1, 0x000), /* display start line */
  233. U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */
  234. U8X8_CA(0x0a8, 0x063), /* multiplex ratio: 63* 1/64 duty */ /* changed to hex, issue 1050 */
  235. U8X8_CA(0x0ab, 0x001), /* Enable internal VDD regulator (RESET) */
  236. U8X8_CA(0x081, 0x053), /* contrast, brightness, 0..128 */
  237. U8X8_CA(0x0b1, 0x047), /* phase length */
  238. //U8X8_CA(0x0b3, 0x001), /* set display clock divide ratio/oscillator frequency */
  239. U8X8_CA(0x0b3, 0x000), /* set display clock divide ratio/oscillator frequency */
  240. U8X8_C(0x0b9), /* use linear lookup table */
  241. U8X8_CA(0x0bc, 0x007), /* pre-charge voltage level */
  242. U8X8_CA(0x0be, 0x007), /* VCOMH voltage */
  243. U8X8_CA(0x0b6, 0x004), /* second precharge */
  244. U8X8_CA(0x0d5, 0x062), /* enable second precharge, internal vsl (bit0 = 0) */
  245. U8X8_C(0x0a4), /* normal display mode */
  246. U8X8_END_TRANSFER(), /* disable chip */
  247. U8X8_END() /* end of sequence */
  248. };
  249. uint8_t u8x8_d_ssd1327_ws_96x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
  250. {
  251. if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 )
  252. return 1;
  253. if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY )
  254. {
  255. u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_winstar_96x64_display_info);
  256. return 1;
  257. }
  258. else if ( msg == U8X8_MSG_DISPLAY_INIT )
  259. {
  260. u8x8_d_helper_display_init(u8x8);
  261. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_winstar_96x64_init_seq);
  262. return 1;
  263. }
  264. else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE )
  265. {
  266. if ( arg_int == 0 )
  267. {
  268. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_winstar_96x64_flip0_seq);
  269. u8x8->x_offset = u8x8->display_info->default_x_offset;
  270. }
  271. else
  272. {
  273. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_winstar_96x64_flip1_seq);
  274. u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
  275. }
  276. return 1;
  277. }
  278. return 0;
  279. }
  280. /*=============================================*/
  281. /* Seeedstudio Grove OLED 96x96 */
  282. static const u8x8_display_info_t u8x8_ssd1327_96x96_display_info =
  283. {
  284. /* chip_enable_level = */ 0,
  285. /* chip_disable_level = */ 1,
  286. /* post_chip_enable_wait_ns = */ 20,
  287. /* pre_chip_disable_wait_ns = */ 10,
  288. /* reset_pulse_width_ms = */ 100,
  289. /* post_reset_wait_ms = */ 100, /**/
  290. /* sda_setup_time_ns = */ 100, /* */
  291. /* sck_pulse_width_ns = */ 100, /* */
  292. /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
  293. /* spi_mode = */ 0, /* active high, rising edge */
  294. /* i2c_bus_clock_100kHz = */ 1, /* use 1 instead of 4, because the SSD1327 seems to be very slow */
  295. /* data_setup_time_ns = */ 40,
  296. /* write_pulse_width_ns = */ 60,
  297. /* tile_width = */ 12,
  298. /* tile_hight = */ 12,
  299. /* default_x_offset = */ 16,
  300. /* flipmode_x_offset = */ 16,
  301. /* pixel_width = */ 96,
  302. /* pixel_height = */ 96
  303. };
  304. /* https://github.com/SeeedDocument/Grove_OLED_1.12/raw/master/resources/LY120-096096.pdf */
  305. /* http://www.seeedstudio.com/wiki/index.php?title=Twig_-_OLED_96x96 */
  306. /* values from u8glib */
  307. /*
  308. Re-map setting in Graphic Display Data RAM, command 0x0a0
  309. Bit 0: Column Address Re-map
  310. Bit 1: Nibble Re-map
  311. Bit 2: Horizontal/Vertical Address Increment
  312. Bit 3: Not used, must be 0
  313. Bit 4: COM Re-map
  314. Bit 5: Not used, must be 0
  315. Bit 6: COM Split Odd Even
  316. Bit 7: Not used, must be 0
  317. */
  318. static const uint8_t u8x8_d_ssd1327_96x96_init_seq[] = {
  319. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  320. U8X8_CA(0x0fd, 0x012), /* unlock display, usually not required because the display is unlocked after reset */
  321. U8X8_C(0x0ae), /* display off */
  322. //U8X8_CA(0x0a8, 0x03f), /* multiplex ratio: 0x03f * 1/64 duty */
  323. U8X8_CA(0x0a8, 0x05f), /* multiplex ratio: 0x05f * 1/64 duty */
  324. U8X8_CA(0x0a1, 0x000), /* display start line */
  325. //U8X8_CA(0x0a2, 0x04c), /* display offset, shift mapping ram counter */
  326. U8X8_CA(0x0a2, 0x020), /* display offset, shift mapping ram counter */
  327. U8X8_CA(0x0a0, 0x051), /* remap configuration */
  328. U8X8_CA(0x0ab, 0x001), /* Enable internal VDD regulator (RESET) */
  329. //U8X8_CA(0x081, 0x070), /* contrast, brightness, 0..128 */
  330. U8X8_CA(0x081, 0x053), /* contrast, brightness, 0..128 */
  331. //U8X8_CA(0x0b1, 0x055), /* phase length */
  332. U8X8_CA(0x0b1, 0x051), /* phase length */
  333. //U8X8_CA(0x0b3, 0x091), /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */
  334. U8X8_CA(0x0b3, 0x001), /* set display clock divide ratio/oscillator frequency */
  335. //? U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */
  336. //? U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */
  337. U8X8_C(0x0b9), /* use linear lookup table */
  338. //U8X8_CA(0x0bc, 0x010), /* pre-charge voltage level */
  339. U8X8_CA(0x0bc, 0x008), /* pre-charge voltage level */
  340. //U8X8_CA(0x0be, 0x01c), /* VCOMH voltage */
  341. U8X8_CA(0x0be, 0x007), /* VCOMH voltage */
  342. U8X8_CA(0x0b6, 0x001), /* second precharge */
  343. U8X8_CA(0x0d5, 0x062), /* enable second precharge, internal vsl (bit0 = 0) */
  344. U8X8_C(0x0a4), /* normal display mode */
  345. U8X8_END_TRANSFER(), /* disable chip */
  346. U8X8_END() /* end of sequence */
  347. };
  348. uint8_t u8x8_d_ssd1327_seeed_96x96(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
  349. {
  350. if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 )
  351. return 1;
  352. if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY )
  353. {
  354. u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_96x96_display_info);
  355. return 1;
  356. }
  357. else if ( msg == U8X8_MSG_DISPLAY_INIT )
  358. {
  359. u8x8_d_helper_display_init(u8x8);
  360. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_96x96_init_seq);
  361. return 1;
  362. }
  363. else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE )
  364. {
  365. if ( arg_int == 0 )
  366. {
  367. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_seeed_96x96_flip0_seq);
  368. u8x8->x_offset = u8x8->display_info->default_x_offset;
  369. }
  370. else
  371. {
  372. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_seeed_96x96_flip1_seq);
  373. u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
  374. }
  375. return 1;
  376. }
  377. return 0;
  378. }
  379. /*=============================================*/
  380. /* EA W128128 round OLED 128x128 */
  381. /* issue #641 */
  382. /* https://www.lcd-module.de/fileadmin/eng/pdf/grafik/W128128-XR.pdf */
  383. static const u8x8_display_info_t u8x8_ssd1327_ea_w128128_display_info =
  384. {
  385. /* chip_enable_level = */ 0,
  386. /* chip_disable_level = */ 1,
  387. /* post_chip_enable_wait_ns = */ 20,
  388. /* pre_chip_disable_wait_ns = */ 10,
  389. /* reset_pulse_width_ms = */ 100,
  390. /* post_reset_wait_ms = */ 100, /**/
  391. /* sda_setup_time_ns = */ 100, /* */
  392. /* sck_pulse_width_ns = */ 100, /* */
  393. /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
  394. /* spi_mode = */ 0, /* active high, rising edge */
  395. /* i2c_bus_clock_100kHz = */ 1, /* use 1 instead of 4, because the SSD1327 seems to be very slow */
  396. /* data_setup_time_ns = */ 40,
  397. /* write_pulse_width_ns = */ 60,
  398. /* tile_width = */ 16,
  399. /* tile_hight = */ 16,
  400. /* default_x_offset = */ 0,
  401. /* flipmode_x_offset = */ 0,
  402. /* pixel_width = */ 128,
  403. /* pixel_height = */ 128
  404. };
  405. /* this is a copy of the init sequence for the seeed 96x96 oled */
  406. static const uint8_t u8x8_d_ssd1327_ea_w128128_init_seq[] = {
  407. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  408. U8X8_CA(0x0fd, 0x012), /* unlock display, usually not required because the display is unlocked after reset */
  409. U8X8_C(0x0ae), /* display off */
  410. //U8X8_CA(0x0a8, 0x03f), /* multiplex ratio: 0x03f * 1/64 duty */
  411. U8X8_CA(0x0a8, 0x05f), /* multiplex ratio: 0x05f * 1/64 duty */
  412. U8X8_CA(0x0a1, 0x000), /* display start line */
  413. //U8X8_CA(0x0a2, 0x04c), /* display offset, shift mapping ram counter */
  414. U8X8_CA(0x0a2, 0x010), /* display offset, shift mapping ram counter */
  415. U8X8_CA(0x0a0, 0x051), /* remap configuration */
  416. U8X8_CA(0x0ab, 0x001), /* Enable internal VDD regulator (RESET) */
  417. //U8X8_CA(0x081, 0x070), /* contrast, brightness, 0..128 */
  418. U8X8_CA(0x081, 0x053), /* contrast, brightness, 0..128 */
  419. //U8X8_CA(0x0b1, 0x055), /* phase length */
  420. U8X8_CA(0x0b1, 0x051), /* phase length */
  421. //U8X8_CA(0x0b3, 0x091), /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */
  422. U8X8_CA(0x0b3, 0x001), /* set display clock divide ratio/oscillator frequency */
  423. //? U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */
  424. //? U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */
  425. U8X8_C(0x0b9), /* use linear lookup table */
  426. //U8X8_CA(0x0bc, 0x010), /* pre-charge voltage level */
  427. U8X8_CA(0x0bc, 0x008), /* pre-charge voltage level */
  428. //U8X8_CA(0x0be, 0x01c), /* VCOMH voltage */
  429. U8X8_CA(0x0be, 0x007), /* VCOMH voltage */
  430. U8X8_CA(0x0b6, 0x001), /* second precharge */
  431. U8X8_CA(0x0d5, 0x062), /* enable second precharge, internal vsl (bit0 = 0) */
  432. U8X8_C(0x0a4), /* normal display mode */
  433. U8X8_END_TRANSFER(), /* disable chip */
  434. U8X8_END() /* end of sequence */
  435. };
  436. static const uint8_t u8x8_d_ssd1327_ea_w128128_flip0_seq[] = {
  437. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  438. U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */
  439. U8X8_CA(0x0a0, 0x051), /* remap configuration */
  440. U8X8_END_TRANSFER(), /* disable chip */
  441. U8X8_END() /* end of sequence */
  442. };
  443. static const uint8_t u8x8_d_ssd1327_ea_w128128_flip1_seq[] = {
  444. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  445. U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */
  446. U8X8_CA(0x0a0, 0x042), /* remap configuration */
  447. U8X8_END_TRANSFER(), /* disable chip */
  448. U8X8_END() /* end of sequence */
  449. };
  450. uint8_t u8x8_d_ssd1327_ea_w128128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
  451. {
  452. if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 )
  453. return 1;
  454. if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY )
  455. {
  456. u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_ea_w128128_display_info);
  457. return 1;
  458. }
  459. else if ( msg == U8X8_MSG_DISPLAY_INIT )
  460. {
  461. u8x8_d_helper_display_init(u8x8);
  462. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ea_w128128_init_seq);
  463. return 1;
  464. }
  465. else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE )
  466. {
  467. if ( arg_int == 0 )
  468. {
  469. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ea_w128128_flip0_seq);
  470. u8x8->x_offset = u8x8->display_info->default_x_offset;
  471. }
  472. else
  473. {
  474. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ea_w128128_flip1_seq);
  475. u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
  476. }
  477. return 1;
  478. }
  479. return 0;
  480. }
  481. /*=============================================*/
  482. /* MIDAS MCOT128128C1V-YM 128x128 Module */
  483. static const u8x8_display_info_t u8x8_ssd1327_128x128_display_info =
  484. {
  485. /* chip_enable_level = */ 0,
  486. /* chip_disable_level = */ 1,
  487. /* post_chip_enable_wait_ns = */ 20,
  488. /* pre_chip_disable_wait_ns = */ 10,
  489. /* reset_pulse_width_ms = */ 100,
  490. /* post_reset_wait_ms = */ 100, /**/
  491. /* sda_setup_time_ns = */ 100, /* */
  492. /* sck_pulse_width_ns = */ 100, /* */
  493. /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
  494. /* spi_mode = */ 0, /* active high, rising edge */
  495. /* i2c_bus_clock_100kHz = */ 1, /* use 1 instead of 4, because the SSD1327 seems to be very slow, Update 9 Aug 2019: The OLED from aliexpress supports 400kHz */
  496. /* data_setup_time_ns = */ 40,
  497. /* write_pulse_width_ns = */ 60,
  498. /* tile_width = */ 16,
  499. /* tile_hight = */ 16,
  500. /* default_x_offset = */ 0,
  501. /* flipmode_x_offset = */ 0,
  502. /* pixel_width = */ 128,
  503. /* pixel_height = */ 128
  504. };
  505. /* https://github.com/SeeedDocument/Grove_OLED_1.12/raw/master/resources/LY120-096096.pdf */
  506. /* http://www.seeedstudio.com/wiki/index.php?title=Twig_-_OLED_96x96 */
  507. /* values from u8glib */
  508. /*
  509. Re-map setting in Graphic Display Data RAM, command 0x0a0
  510. Bit 0: Column Address Re-map
  511. Bit 1: Nibble Re-map
  512. Bit 2: Horizontal/Vertical Address Increment
  513. Bit 3: Not used, must be 0
  514. Bit 4: COM Re-map
  515. Bit 5: Not used, must be 0
  516. Bit 6: COM Split Odd Even
  517. Bit 7: Not used, must be 0
  518. */
  519. static const uint8_t u8x8_d_ssd1327_128x128_init_seq[] = {
  520. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  521. U8X8_CA(0x0fd, 0x012), /* unlock display, usually not required because the display is unlocked after reset */
  522. U8X8_C(0x0ae), /* display off */
  523. //U8X8_CA(0x0a8, 0x03f), /* multiplex ratio: 0x03f * 1/64 duty */
  524. //U8X8_CA(0x0a8, 0x05f), /* multiplex ratio: 0x05f * 1/64 duty */
  525. U8X8_CA(0x0a8, 0x07f), /* multiplex ratio: 0x05f * 1/128duty */
  526. U8X8_CA(0x0a1, 0x000), /* display start line */
  527. //U8X8_CA(0x0a2, 0x04c), /* display offset, shift mapping ram counter */
  528. U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */
  529. U8X8_CA(0x0a0, 0x051), /* remap configuration */
  530. U8X8_CA(0x0ab, 0x001), /* Enable internal VDD regulator (RESET) */
  531. //U8X8_CA(0x081, 0x070), /* contrast, brightness, 0..128 */
  532. U8X8_CA(0x081, 0x053), /* contrast, brightness, 0..128 */
  533. //U8X8_CA(0x0b1, 0x055), /* phase length */
  534. U8X8_CA(0x0b1, 0x051), /* phase length */
  535. //U8X8_CA(0x0b3, 0x091), /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */
  536. U8X8_CA(0x0b3, 0x001), /* set display clock divide ratio/oscillator frequency */
  537. //? U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */
  538. //? U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */
  539. U8X8_C(0x0b9), /* use linear lookup table */
  540. //U8X8_CA(0x0bc, 0x010), /* pre-charge voltage level */
  541. U8X8_CA(0x0bc, 0x008), /* pre-charge voltage level */
  542. //U8X8_CA(0x0be, 0x01c), /* VCOMH voltage */
  543. U8X8_CA(0x0be, 0x007), /* VCOMH voltage */
  544. U8X8_CA(0x0b6, 0x001), /* second precharge */
  545. U8X8_CA(0x0d5, 0x062), /* enable second precharge, internal vsl (bit0 = 0) */
  546. U8X8_C(0x0a4), /* normal display mode */
  547. U8X8_END_TRANSFER(), /* disable chip */
  548. U8X8_END() /* end of sequence */
  549. };
  550. static const uint8_t u8x8_d_ssd1327_128x128_flip0_seq[] = {
  551. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  552. U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */
  553. U8X8_CA(0x0a0, 0x051), /* remap configuration */
  554. U8X8_END_TRANSFER(), /* disable chip */
  555. U8X8_END() /* end of sequence */
  556. };
  557. static const uint8_t u8x8_d_ssd1327_128x128_flip1_seq[] = {
  558. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  559. U8X8_CA(0x0a2, 0x000), /* display offset, shift mapping ram counter */
  560. U8X8_CA(0x0a0, 0x042), /* remap configuration */
  561. U8X8_END_TRANSFER(), /* disable chip */
  562. U8X8_END() /* end of sequence */
  563. };
  564. uint8_t u8x8_d_ssd1327_midas_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
  565. {
  566. /* call the 96x96 procedure at the moment */
  567. if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 )
  568. return 1;
  569. if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY )
  570. {
  571. u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_128x128_display_info);
  572. return 1;
  573. }
  574. else if ( msg == U8X8_MSG_DISPLAY_INIT )
  575. {
  576. u8x8_d_helper_display_init(u8x8);
  577. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x128_init_seq);
  578. return 1;
  579. }
  580. else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE )
  581. {
  582. if ( arg_int == 0 )
  583. {
  584. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x128_flip0_seq);
  585. u8x8->x_offset = u8x8->display_info->default_x_offset;
  586. }
  587. else
  588. {
  589. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x128_flip1_seq);
  590. u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
  591. }
  592. return 1;
  593. }
  594. return 0;
  595. }
  596. /*=============================================*/
  597. /*
  598. Waveshare 128x128 Module
  599. https://www.waveshare.com/w/upload/8/80/1.5inch_OLED_Module_User_Manual_EN.pdf
  600. https://github.com/olikraus/u8g2/issues/880
  601. This is mostly a takeover of the EA display.
  602. */
  603. /* https://github.com/SeeedDocument/Grove_OLED_1.12/raw/master/resources/LY120-096096.pdf */
  604. /* http://www.seeedstudio.com/wiki/index.php?title=Twig_-_OLED_96x96 */
  605. /* values from u8glib */
  606. /*
  607. Re-map setting in Graphic Display Data RAM, command 0x0a0
  608. Bit 0: Column Address Re-map
  609. Bit 1: Nibble Re-map
  610. Bit 2: Horizontal/Vertical Address Increment
  611. Bit 3: Not used, must be 0
  612. Bit 4: COM Re-map
  613. Bit 5: Not used, must be 0
  614. Bit 6: COM Split Odd Even
  615. Bit 7: Not used, must be 0
  616. */
  617. /* takeover from https://github.com/olikraus/u8g2/issues/880 */
  618. static const uint8_t u8x8_d_ssd1327_ws_128x128_init_seq[] = {
  619. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  620. U8X8_C(0x0ae), //--turn off oled panel
  621. U8X8_CAA(0x015, 0x000, 0x07f), //set column address, start column 0, end column 127
  622. U8X8_CAA(0x075, 0x000, 0x07f), //set row address, start row 0, end row 127
  623. U8X8_CA(0x081, 0x080), //set contrast control
  624. U8X8_CA(0x0a0, 0x051), //gment remap, 51
  625. U8X8_CA(0x0a1, 0x000), //start line
  626. U8X8_CA(0x0a2, 0x000), //display offset
  627. U8X8_CAA(0x0a4, 0x0a8, 0x07f), //rmal display, set multiplex ratio
  628. U8X8_CA(0x0b1, 0x0f1), //set phase leghth
  629. U8X8_CA(0x0b3, 0x000), //set dclk, 80Hz:0xc1 90Hz:0xe1 100Hz:0x00 110Hz:0x30 120Hz:0x50 130Hz:0x70 01
  630. U8X8_CA(0x0ab, 0x001), //
  631. U8X8_CA(0x0b6, 0x00f), //set phase leghth
  632. U8X8_CA(0x0be, 0x00f),
  633. U8X8_CA(0x0bc, 0x008),
  634. U8X8_CA(0x0d5, 0x062),
  635. U8X8_CA(0x0fd, 0x012),
  636. U8X8_END_TRANSFER(), /* disable chip */
  637. U8X8_END() /* end of sequence */
  638. };
  639. uint8_t u8x8_d_ssd1327_ws_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
  640. {
  641. /* call the 96x96 procedure at the moment */
  642. if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 )
  643. return 1;
  644. if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY )
  645. {
  646. u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_ea_w128128_display_info);
  647. return 1;
  648. }
  649. else if ( msg == U8X8_MSG_DISPLAY_INIT )
  650. {
  651. u8x8_d_helper_display_init(u8x8);
  652. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ws_128x128_init_seq);
  653. return 1;
  654. }
  655. else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE )
  656. {
  657. if ( arg_int == 0 )
  658. {
  659. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ea_w128128_flip0_seq);
  660. u8x8->x_offset = u8x8->display_info->default_x_offset;
  661. }
  662. else
  663. {
  664. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_ea_w128128_flip1_seq);
  665. u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
  666. }
  667. return 1;
  668. }
  669. return 0;
  670. }
  671. /*=============================================*/
  672. /*
  673. Visonox VGM128096A4W10 128x96 COB
  674. https://github.com/olikraus/u8g2/files/4052919/M02289_VGM128096A4W10_Y02.pdf
  675. https://github.com/olikraus/u8g2/issues/1090
  676. */
  677. static const u8x8_display_info_t u8x8_ssd1327_128x96_display_info =
  678. {
  679. /* chip_enable_level = */ 0,
  680. /* chip_disable_level = */ 1,
  681. /* post_chip_enable_wait_ns = */ 20,
  682. /* pre_chip_disable_wait_ns = */ 10,
  683. /* reset_pulse_width_ms = */ 100,
  684. /* post_reset_wait_ms = */ 100, /**/
  685. /* sda_setup_time_ns = */ 100, /* */
  686. /* sck_pulse_width_ns = */ 100, /* */
  687. /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
  688. /* spi_mode = */ 0, /* active high, rising edge */
  689. /* i2c_bus_clock_100kHz = */ 1, /* use 1 instead of 4, because the SSD1327 seems to be very slow, Update 9 Aug 2019: The OLED from aliexpress supports 400kHz */
  690. /* data_setup_time_ns = */ 40,
  691. /* write_pulse_width_ns = */ 60,
  692. /* tile_width = */ 16,
  693. /* tile_hight = */ 12,
  694. /* default_x_offset = */ 0,
  695. /* flipmode_x_offset = */ 0,
  696. /* pixel_width = */ 128,
  697. /* pixel_height = */ 96
  698. };
  699. /* https://github.com/SeeedDocument/Grove_OLED_1.12/raw/master/resources/LY120-096096.pdf */
  700. /* http://www.seeedstudio.com/wiki/index.php?title=Twig_-_OLED_96x96 */
  701. /* values from u8glib */
  702. /*
  703. Re-map setting in Graphic Display Data RAM, command 0x0a0
  704. Bit 0: Column Address Re-map
  705. Bit 1: Nibble Re-map
  706. Bit 2: Horizontal/Vertical Address Increment
  707. Bit 3: Not used, must be 0
  708. Bit 4: COM Re-map
  709. Bit 5: Not used, must be 0
  710. Bit 6: COM Split Odd Even
  711. Bit 7: Not used, must be 0
  712. */
  713. /* init values from the Visionox datasheeet section 10.4 */
  714. static const uint8_t u8x8_d_ssd1327_128x96_init_seq[] = {
  715. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  716. U8X8_CA(0x0fd, 0x012), /* unlock display, usually not required because the display is unlocked after reset */
  717. U8X8_C(0x0ae), /* display off */
  718. //U8X8_CA(0x0a8, 0x03f), /* multiplex ratio: 0x03f * 1/64 duty */
  719. U8X8_CA(0x0a8, 0x05f), /* multiplex ratio: 0x05f * 1/64 duty */
  720. //U8X8_CA(0x0a8, 0x07f), /* multiplex ratio: 0x05f * 1/128duty */
  721. U8X8_CA(0x0a1, 0x000), /* display start line */
  722. //U8X8_CA(0x0a2, 0x04c), /* display offset, shift mapping ram counter */
  723. U8X8_CA(0x0a2, 0x020), /* display offset, shift mapping ram counter */
  724. U8X8_CA(0x0a0, 0x051), /* remap configuration */
  725. U8X8_CA(0x0ab, 0x001), /* Enable internal VDD regulator (RESET) */
  726. //U8X8_CA(0x081, 0x070), /* contrast, brightness, 0..128 */
  727. U8X8_CA(0x081, 0x0df), /* contrast, brightness, 0..128 (0xdf as per datasheet) */
  728. U8X8_CA(0x0b1, 0x022), /* phase length */
  729. U8X8_CA(0x0b3, 0x050), /* set display clock divide ratio/oscillator frequency */
  730. //? U8X8_CA(0x0ad, 0x002), /* master configuration: disable embedded DC-DC, enable internal VCOMH */
  731. //? U8X8_C(0x086), /* full current range (0x084, 0x085, 0x086) */
  732. U8X8_C(0x0b9), /* use linear lookup table */
  733. U8X8_CA(0x0bc, 0x010), /* pre-charge voltage level */
  734. U8X8_CA(0x0be, 0x005), /* VCOMH voltage */
  735. U8X8_CA(0x0b6, 0x00a), /* second precharge */
  736. U8X8_CA(0x0d5, 0x062), /* enable second precharge, internal vsl (bit0 = 0) */
  737. U8X8_C(0x0a4), /* normal display mode */
  738. U8X8_END_TRANSFER(), /* disable chip */
  739. U8X8_END() /* end of sequence */
  740. };
  741. static const uint8_t u8x8_d_ssd1327_128x96_flip0_seq[] = {
  742. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  743. U8X8_CA(0x0a2, 0x020), /* display offset, shift mapping ram counter */
  744. U8X8_CA(0x0a0, 0x051), /* remap configuration */
  745. U8X8_END_TRANSFER(), /* disable chip */
  746. U8X8_END() /* end of sequence */
  747. };
  748. static const uint8_t u8x8_d_ssd1327_128x96_flip1_seq[] = {
  749. U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
  750. U8X8_CA(0x0a2, 0x060), /* display offset, shift mapping ram counter */
  751. U8X8_CA(0x0a0, 0x042), /* remap configuration */
  752. U8X8_END_TRANSFER(), /* disable chip */
  753. U8X8_END() /* end of sequence */
  754. };
  755. uint8_t u8x8_d_ssd1327_visionox_128x96(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
  756. {
  757. /* call the 96x96 procedure at the moment */
  758. if ( u8x8_d_ssd1327_96x96_generic(u8x8, msg, arg_int, arg_ptr) != 0 )
  759. return 1;
  760. if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY )
  761. {
  762. u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1327_128x96_display_info);
  763. return 1;
  764. }
  765. else if ( msg == U8X8_MSG_DISPLAY_INIT )
  766. {
  767. u8x8_d_helper_display_init(u8x8);
  768. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x96_init_seq);
  769. return 1;
  770. }
  771. else if ( msg == U8X8_MSG_DISPLAY_SET_FLIP_MODE )
  772. {
  773. if ( arg_int == 0 )
  774. {
  775. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x96_flip0_seq);
  776. u8x8->x_offset = u8x8->display_info->default_x_offset;
  777. }
  778. else
  779. {
  780. u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1327_128x96_flip1_seq);
  781. u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
  782. }
  783. return 1;
  784. }
  785. return 0;
  786. }