LibDriver SSD1315
Loading...
Searching...
No Matches
driver_ssd1315.c
Go to the documentation of this file.
1
36
37#include "driver_ssd1315.h"
38#include "driver_ssd1315_font.h"
39
43#define CHIP_NAME "Solomon Systech SSD1315"
44#define MANUFACTURER_NAME "Solomon Systech"
45#define SUPPLY_VOLTAGE_MIN 1.65f
46#define SUPPLY_VOLTAGE_MAX 3.5f
47#define MAX_CURRENT 1.00f
48#define TEMPERATURE_MIN -40.0f
49#define TEMPERATURE_MAX 85.0f
50#define DRIVER_VERSION 1000
51
55#define SSD1315_CMD 0
56#define SSD1315_DATA 1
57
61#define SSD1315_CMD_LOWER_COLUMN_START_ADDRESS 0x00
62#define SSD1315_CMD_HIGHER_COLUMN_START_ADDRESS 0x10
63#define SSD1315_CMD_MEMORY_ADDRESSING_MODE 0x20
64#define SSD1315_CMD_SET_COLUMN_ADDRESS 0x21
65#define SSD1315_CMD_SET_PAGE_ADDRESS 0x22
66#define SSD1315_CMD_SET_FADE_OUT_AND_BLINKING 0x23
67#define SSD1315_CMD_RIGHT_HORIZONTAL_SCROLL 0x26
68#define SSD1315_CMD_LEFT_HORIZONTAL_SCROLL 0x27
69#define SSD1315_CMD_VERTICAL_RIGHT_HORIZONTAL_SCROLL 0x29
70#define SSD1315_CMD_VERTICAL_LEFT_HORIZONTAL_SCROLL 0x2A
71#define SSD1315_CMD_RIGHT_HORIZONTAL_SCROLL_SETUP 0x2C
72#define SSD1315_CMD_LEFT_HORIZONTAL_SCROLL_SETUP 0x2D
73#define SSD1315_CMD_DEACTIVATE_SCROLL 0x2E
74#define SSD1315_CMD_ACTIVATE_SCROLL 0x2F
75#define SSD1315_CMD_DISPLAY_START_LINE 0x40
76#define SSD1315_CMD_CONTRAST_CONTROL 0x81
77#define SSD1315_CMD_CHARGE_PUMP_SETTING 0x8D
78#define SSD1315_CMD_COLUMN_0_MAPPED_TO_SEG0 0xA0
79#define SSD1315_CMD_COLUMN_127_MAPPED_TO_SEG0 0xA1
80#define SSD1315_CMD_VERTICAL_SCROLL_AREA 0xA3
81#define SSD1315_CMD_ENTIRE_DISPLAY_OFF 0xA4
82#define SSD1315_CMD_ENTIRE_DISPLAY_ON 0xA5
83#define SSD1315_CMD_NORMAL_DISPLAY 0xA6
84#define SSD1315_CMD_INVERSE_DISPLAY 0xA7
85#define SSD1315_CMD_MULTIPLEX_RATIO 0xA8
86#define SSD1315_CMD_INTERNAL_IREF_SETTING 0xAD
87#define SSD1315_CMD_DISPLAY_OFF 0xAE
88#define SSD1315_CMD_DISPLAY_ON 0xAF
89#define SSD1315_CMD_PAGE_ADDR 0xB0
90#define SSD1315_CMD_SCAN_DIRECTION_COM0_START 0xC0
91#define SSD1315_CMD_SCAN_DIRECTION_COMN_1_START 0xC8
92#define SSD1315_CMD_DISPLAY_OFFSET 0xD3
93#define SSD1315_CMD_DISPLAY_CLOCK_DIVIDE 0xD5
94#define SSD1315_CMD_SET_ZOOM_IN 0xD6
95#define SSD1315_CMD_PRE_CHARGE_PERIOD 0xD9
96#define SSD1315_CMD_COM_PINS_CONF 0xDA
97#define SSD1315_CMD_COMH_DESLECT_LEVEL 0xDB
98#define SSD1315_CMD_NOP 0xE3
99
110static uint8_t a_ssd1315_write_byte(ssd1315_handle_t *handle, uint8_t data, uint8_t cmd)
111{
112 uint8_t res;
113
114 if (handle->iic_spi == SSD1315_INTERFACE_IIC) /* if iic */
115 {
116 if (cmd != 0) /* if data */
117 {
118 if (handle->iic_write(handle->iic_addr, 0x40, &data, 1) != 0) /* write data */
119 {
120 return 1; /* return error */
121 }
122 else
123 {
124 return 0; /* success return 0 */
125 }
126 }
127 else
128 {
129 if (handle->iic_write(handle->iic_addr, 0x00, &data, 1) != 0) /* write command */
130 {
131 return 1; /* return error */
132 }
133 else
134 {
135 return 0; /* success return 0 */
136 }
137 }
138 }
139 else if (handle->iic_spi == SSD1315_INTERFACE_SPI) /* if spi */
140 {
141 res = handle->spi_cmd_data_gpio_write(cmd); /* write data command */
142 if (res != 0) /* check error */
143 {
144 return 1; /* return error */
145 }
146
147 if (handle->spi_write_cmd(&data, 1) != 0) /* write command */
148 {
149 return 1; /* return error */
150 }
151 else
152 {
153 return 0; /* success return 0 */
154 }
155 }
156 else
157 {
158 return 1; /* return error */
159 }
160}
161
173static uint8_t a_ssd1315_multiple_write_byte(ssd1315_handle_t *handle, uint8_t *data, uint8_t len, uint8_t cmd)
174{
175 uint8_t res;
176
177 if (handle->iic_spi == SSD1315_INTERFACE_IIC) /* if iic */
178 {
179 if (cmd != 0) /* if data */
180 {
181 if (handle->iic_write(handle->iic_addr, 0x40, data, len) != 0) /* write data */
182 {
183 return 1; /* return error */
184 }
185 else
186 {
187 return 0; /* success return 0 */
188 }
189 }
190 else
191 {
192 if (handle->iic_write(handle->iic_addr, 0x00, data, len) != 0) /* write command */
193 {
194 return 1; /* return error */
195 }
196 else
197 {
198 return 0; /* success return 0 */
199 }
200 }
201 }
202 else if (handle->iic_spi == SSD1315_INTERFACE_SPI) /* if spi */
203 {
204 res = handle->spi_cmd_data_gpio_write(cmd); /* write data command */
205 if (res != 0) /* check error */
206 {
207 return 1; /* return error */
208 }
209
210 if (handle->spi_write_cmd(data, len) != 0) /* write command */
211 {
212 return 1; /* return error */
213 }
214 else
215 {
216 return 0; /* success return 0 */
217 }
218 }
219 else
220 {
221 return 1; /* return error */
222 }
223}
224
236static uint8_t a_ssd1315_gram_draw_point(ssd1315_handle_t *handle, uint8_t x, uint8_t y, uint8_t data)
237{
238 uint8_t pos;
239 uint8_t bx;
240 uint8_t temp = 0;
241
242 pos = y / 8; /* get y page */
243 bx = y % 8; /* get y point */
244 temp = 1 << bx; /* set data */
245 if (data != 0) /* if 1 */
246 {
247 handle->gram[x][pos] |= temp; /* set 1 */
248 }
249 else
250 {
251 handle->gram[x][pos] &= ~temp; /* set 0 */
252 }
253
254 return 0; /* success return 0 */
255}
256
270static uint8_t a_ssd1315_gram_show_char(ssd1315_handle_t *handle, uint8_t x, uint8_t y, uint8_t chr, uint8_t size, uint8_t mode)
271{
272 uint8_t temp, t, t1;
273 uint8_t y0 = y;
274 uint8_t csize = (size / 8 + ((size % 8) ? 1 : 0)) * (size / 2); /* get size */
275
276 chr = chr - ' '; /* get index */
277 for (t = 0; t < csize; t++) /* write size */
278 {
279 if (size == 12) /* if size 12 */
280 {
281 temp = gsc_ssd1315_ascii_1206[chr][t]; /* get ascii 1206 */
282 }
283 else if (size == 16) /* if size 16 */
284 {
285 temp = gsc_ssd1315_ascii_1608[chr][t]; /* get ascii 1608 */
286 }
287 else if(size == 24) /* if size 24 */
288 {
289 temp = gsc_ssd1315_ascii_2412[chr][t]; /* get ascii 2412 */
290 }
291 else
292 {
293 return 1; /* return error */
294 }
295 for (t1 = 0; t1 < 8; t1++) /* write one line */
296 {
297 if ((temp & 0x80) != 0) /* if 1 */
298 {
299 if (a_ssd1315_gram_draw_point(handle, x, y, mode) != 0) /* draw point */
300 {
301 return 1; /* return error */
302 }
303 }
304 else
305 {
306 if (a_ssd1315_gram_draw_point(handle, x, y, !mode) != 0) /* draw point */
307 {
308 return 1; /* return error */
309 }
310 }
311 temp <<= 1; /* left shift 1 */
312 y++;
313 if ((y - y0) == size) /* reset size */
314 {
315 y = y0; /* set y */
316 x++; /* x++ */
317
318 break; /* break */
319 }
320 }
321 }
322
323 return 0; /* success return 0 */
324}
325
337{
338 uint8_t i;
339 uint8_t n;
340
341 if (handle == NULL) /* check handle */
342 {
343 return 2; /* return error */
344 }
345 if (handle->inited != 1) /* check handle initialization */
346 {
347 return 3; /* return error */
348 }
349
350 for (i = 0; i < 8; i++) /* write 8 page */
351 {
352 if (a_ssd1315_write_byte(handle, SSD1315_CMD_PAGE_ADDR + i, SSD1315_CMD) != 0) /* set page */
353 {
354 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
355
356 return 1; /* return error */
357 }
358 if (a_ssd1315_write_byte(handle, SSD1315_CMD_LOWER_COLUMN_START_ADDRESS, SSD1315_CMD) != 0) /* set lower column 0 */
359 {
360 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
361
362 return 1; /* return error */
363 }
364 if (a_ssd1315_write_byte(handle, SSD1315_CMD_HIGHER_COLUMN_START_ADDRESS, SSD1315_CMD) != 0) /* set higher column 0 */
365 {
366 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
367
368 return 1; /* return error */
369 }
370 for (n = 0; n < 128; n++) /* write 128 */
371 {
372 handle->gram[n][i] = 0x00; /* set black */
373 if (a_ssd1315_write_byte(handle, handle->gram[n][i], SSD1315_DATA) != 0) /* write data */
374 {
375 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
376
377 return 1; /* return error */
378 }
379 }
380 }
381
382 return 0; /* success return 0 */
383}
384
396{
397 uint8_t i;
398 uint8_t n;
399
400 if (handle == NULL) /* check handle */
401 {
402 return 2; /* return error */
403 }
404 if (handle->inited != 1) /* check handle initialization */
405 {
406 return 3; /* return error */
407 }
408
409 for (i = 0; i < 8; i++) /* write 8 page */
410 {
411 if (a_ssd1315_write_byte(handle, SSD1315_CMD_PAGE_ADDR + i, SSD1315_CMD) != 0) /* set page */
412 {
413 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
414
415 return 1; /* return error */
416 }
417 if (a_ssd1315_write_byte(handle, SSD1315_CMD_LOWER_COLUMN_START_ADDRESS, SSD1315_CMD) != 0) /* set lower column 0 */
418 {
419 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
420
421 return 1; /* return error */
422 }
423 if (a_ssd1315_write_byte(handle, SSD1315_CMD_HIGHER_COLUMN_START_ADDRESS, SSD1315_CMD) != 0) /* set higher column 0 */
424 {
425 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
426
427 return 1; /* return error */
428 }
429 for (n = 0; n < 128; n++) /* write 128 */
430 {
431 if (a_ssd1315_write_byte(handle, handle->gram[n][i], SSD1315_DATA) != 0) /* write data */
432 {
433 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
434
435 return 1; /* return error */
436 }
437 }
438 }
439
440 return 0; /* success return 0 */
441}
442
457uint8_t ssd1315_write_point(ssd1315_handle_t *handle, uint8_t x, uint8_t y, uint8_t data)
458{
459 uint8_t pos;
460 uint8_t bx;
461 uint8_t temp = 0;
462
463 if (handle == NULL) /* check handle */
464 {
465 return 2; /* return error */
466 }
467 if (handle->inited != 1) /* check handle initialization */
468 {
469 return 3; /* return error */
470 }
471 if ((x > 127) || (y > 63)) /* check x, y */
472 {
473 handle->debug_print("ssd1315: x or y is invalid.\n"); /* x or y is invalid */
474
475 return 4; /* return error */
476 }
477
478 pos = y / 8; /* get y page */
479 bx = y % 8; /* get y point */
480 temp = 1 << bx; /* set data */
481 if (data != 0) /* check the data */
482 {
483 handle->gram[x][pos] |= temp; /* set 1 */
484 }
485 else
486 {
487 handle->gram[x][pos] &= ~temp; /* set 0 */
488 }
489 if (a_ssd1315_write_byte(handle, SSD1315_CMD_PAGE_ADDR + pos, SSD1315_CMD) != 0) /* write page addr */
490 {
491 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
492
493 return 1; /* return error */
494 }
495 if (a_ssd1315_write_byte(handle, SSD1315_CMD_LOWER_COLUMN_START_ADDRESS | (x & 0x0F), SSD1315_CMD) != 0) /* write lower column */
496 {
497 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
498
499 return 1; /* return error */
500 }
501 if (a_ssd1315_write_byte(handle, SSD1315_CMD_HIGHER_COLUMN_START_ADDRESS | ((x > 4) & 0x0F),
502 SSD1315_CMD) != 0) /* write higher column */
503 {
504 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
505
506 return 1; /* return error */
507 }
508 if (a_ssd1315_write_byte(handle, handle->gram[x][pos], SSD1315_DATA) != 0) /* write data */
509 {
510 handle->debug_print("ssd1315: write byte failed.\n"); /* write byte failed */
511
512 return 1; /* return error */
513 }
514 else
515 {
516 return 0; /* success return 0 */
517 }
518}
519
534uint8_t ssd1315_read_point(ssd1315_handle_t *handle, uint8_t x, uint8_t y, uint8_t *data)
535{
536 uint8_t pos;
537 uint8_t bx;
538 uint8_t temp = 0;
539
540 if (handle == NULL) /* check handle */
541 {
542 return 2; /* return error */
543 }
544 if (handle->inited != 1) /* check handle initialization */
545 {
546 return 3; /* return error */
547 }
548 if ((x > 127) || (y > 63)) /* check x, y */
549 {
550 handle->debug_print("ssd1315: x or y is invalid.\n"); /* x or y is invalid */
551
552 return 4; /* return error */
553 }
554
555 pos = y / 8; /* get y page */
556 bx = y % 8; /* get y point */
557 temp = 1 << bx; /* set data */
558 if ((handle->gram[x][pos] & temp) != 0) /* get data */
559 {
560 *data = 1; /* set 1 */
561 }
562 else
563 {
564 *data = 0; /* set 0 */
565 }
566
567 return 0; /* success return 0 */
568}
569
584uint8_t ssd1315_gram_write_point(ssd1315_handle_t *handle, uint8_t x, uint8_t y, uint8_t data)
585{
586 uint8_t pos;
587 uint8_t bx;
588 uint8_t temp = 0;
589
590 if (handle == NULL) /* check handle */
591 {
592 return 2; /* return error */
593 }
594 if (handle->inited != 1) /* check handle initialization */
595 {
596 return 3; /* return error */
597 }
598 if ((x > 127) || (y > 63)) /* check x, y */
599 {
600 handle->debug_print("ssd1315: x or y is invalid.\n"); /* x or y is invalid */
601
602 return 4; /* return error */
603 }
604
605 pos = y / 8; /* get y page */
606 bx = y % 8; /* get y point */
607 temp = 1 << bx; /* set data */
608 if (data != 0) /* if 1 */
609 {
610 handle->gram[x][pos] |= temp; /* set 1 */
611 }
612 else
613 {
614 handle->gram[x][pos] &= ~temp; /* set 0 */
615 }
616
617 return 0; /* success return 0 */
618}
619
634uint8_t ssd1315_gram_read_point(ssd1315_handle_t *handle, uint8_t x, uint8_t y, uint8_t *data)
635{
636 uint8_t pos;
637 uint8_t bx;
638 uint8_t temp = 0;
639
640 if (handle == NULL) /* check handle */
641 {
642 return 2; /* return error */
643 }
644 if (handle->inited != 1) /* check handle initialization */
645 {
646 return 3; /* return error */
647 }
648 if ((x > 127) || (y > 63)) /* check x, y */
649 {
650 handle->debug_print("ssd1315: x or y is invalid.\n"); /* x or y is invalid */
651
652 return 4; /* return error */
653 }
654
655 pos = y / 8; /* get y page */
656 bx = y % 8; /* get y point */
657 temp = 1 << bx; /* set data */
658 if ((handle->gram[x][pos] & temp) != 0) /* get data */
659 {
660 *data = 1; /* set 1 */
661 }
662 else
663 {
664 *data = 0; /* set 0 */
665 }
666
667 return 0; /* success return 0 */
668}
669
687uint8_t ssd1315_gram_write_string(ssd1315_handle_t *handle, uint8_t x, uint8_t y, char *str, uint16_t len, uint8_t color, ssd1315_font_t font)
688{
689 if (handle == NULL) /* check handle */
690 {
691 return 2; /* return error */
692 }
693 if (handle->inited != 1) /* check handle initialization */
694 {
695 return 3; /* return error */
696 }
697 if((x > 127) || (y > 63)) /* check x, y */
698 {
699 handle->debug_print("ssd1315: x or y is invalid.\n"); /* x or y is invalid */
700
701 return 4; /* return error */
702 }
703
704 while ((len != 0) && (*str <= '~') && (*str >= ' ')) /* write all string */
705 {
706 if (x > (127 - (font / 2))) /* check x point */
707 {
708 x = 0; /* set x */
709 y += (uint8_t)font; /* set next row */
710 }
711 if (y > (63 - font)) /* check y pont */
712 {
713 y = x = 0; /* reset to 0,0 */
714 }
715 if (a_ssd1315_gram_show_char(handle, x, y, *str, font, color) != 0) /* show a char */
716 {
717 return 1; /* return error */
718 }
719 x += (uint8_t)(font / 2); /* x + font/2 */
720 str++; /* str address++ */
721 len--; /* str length-- */
722 }
723
724 return 0; /* success return 0 */
725}
726
745uint8_t ssd1315_gram_fill_rect(ssd1315_handle_t *handle, uint8_t left, uint8_t top, uint8_t right, uint8_t bottom, uint8_t color)
746{
747 uint8_t x, y;
748
749 if (handle == NULL) /* check handle */
750 {
751 return 2; /* return error */
752 }
753 if (handle->inited != 1) /* check handle initialization */
754 {
755 return 3; /* return error */
756 }
757 if ((left > 127) || (top > 63)) /* check left top */
758 {
759 handle->debug_print("ssd1315: left or top is invalid.\n"); /* left or top is invalid */
760
761 return 4; /* return error */
762 }
763 if ((right > 127) || (bottom > 63)) /* check right bottom */
764 {
765 handle->debug_print("ssd1315: right or bottom is invalid.\n"); /* right or bottom is invalid */
766
767 return 5; /* return error */
768 }
769 if ((left > right) || (top > bottom)) /* check left right top bottom */
770 {
771 handle->debug_print("ssd1315: left > right or top > bottom.\n"); /* left > right or top > bottom */
772
773 return 6; /* return error */
774 }
775
776 for (x = left; x <= right; x++) /* write x */
777 {
778 for (y = top; y <= bottom; y++) /* write y */
779 {
780 if (a_ssd1315_gram_draw_point(handle, x, y, color) != 0) /* draw point */
781 {
782 return 1; /* return error */
783 }
784 }
785 }
786
787 return 0; /* return error */
788}
789
808uint8_t ssd1315_gram_draw_picture(ssd1315_handle_t *handle, uint8_t left, uint8_t top, uint8_t right, uint8_t bottom, uint8_t *img)
809{
810 uint8_t x, y;
811
812 if (handle == NULL) /* check handle */
813 {
814 return 2; /* return error */
815 }
816 if (handle->inited != 1) /* check handle initialization */
817 {
818 return 3; /* return error */
819 }
820 if ((left > 127) || (top > 63)) /* check left top */
821 {
822 handle->debug_print("ssd1315: left or top is invalid.\n"); /* left or top is invalid */
823
824 return 4; /* return error */
825 }
826 if ((right > 127) || (bottom > 63)) /* check right bottom */
827 {
828 handle->debug_print("ssd1315: right or bottom is invalid.\n"); /* right or bottom is invalid */
829
830 return 5; /* return error */
831 }
832 if ((left > right) || (top > bottom)) /* check left right top bottom */
833 {
834 handle->debug_print("ssd1315: left > right or top > bottom.\n"); /* left > right or top > bottom */
835
836 return 6; /* return error */
837 }
838
839 for (x = left; x <= right; x++) /* write x */
840 {
841 for (y = top; y <= bottom; y++) /* write y */
842 {
843 if (a_ssd1315_gram_draw_point(handle, x, y, *img) != 0) /* draw point */
844 {
845 return 1; /* return error */
846 }
847 img++; /* img++ */
848 }
849 }
850
851 return 0; /* succeed return 0 */
852}
853
868{
869 if (handle == NULL) /* check handle */
870 {
871 return 2; /* return error */
872 }
873 if (handle->debug_print == NULL) /* check debug_print */
874 {
875 return 3; /* return error */
876 }
877 if (handle->iic_init == NULL) /* check iic_init */
878 {
879 handle->debug_print("ssd1315: iic_init is null.\n"); /* iic_init is null */
880
881 return 3; /* return error */
882 }
883 if (handle->iic_deinit == NULL) /* check iic_deinit */
884 {
885 handle->debug_print("ssd1315: iic_deinit is null.\n"); /* iic_deinit is null */
886
887 return 3; /* return error */
888 }
889 if (handle->iic_write == NULL) /* check iic_write */
890 {
891 handle->debug_print("ssd1315: iic_write is null.\n"); /* iic_write is null */
892
893 return 3; /* return error */
894 }
895 if (handle->spi_init == NULL) /* check spi_init */
896 {
897 handle->debug_print("ssd1315: spi_init is null.\n"); /* spi_init is null */
898
899 return 3; /* return error */
900 }
901 if (handle->spi_deinit == NULL) /* check spi_deinit */
902 {
903 handle->debug_print("ssd1315: spi_deinit is null.\n"); /* spi_deinit is null */
904
905 return 3; /* return error */
906 }
907 if (handle->spi_write_cmd == NULL) /* check spi_write_cmd */
908 {
909 handle->debug_print("ssd1315: spi_write_cmd is null.\n"); /* spi_write_cmd is null */
910
911 return 3; /* return error */
912 }
913 if (handle->delay_ms == NULL) /* check delay_ms */
914 {
915 handle->debug_print("ssd1315: delay_ms is null.\n"); /* delay_ms is null */
916
917 return 3; /* return error */
918 }
919 if (handle->spi_cmd_data_gpio_init == NULL) /* check spi_cmd_data_gpio_init */
920 {
921 handle->debug_print("ssd1315: spi_cmd_data_gpio_init is null.\n"); /* spi_cmd_data_gpio_init is null */
922
923 return 3; /* return error */
924 }
925 if (handle->spi_cmd_data_gpio_deinit == NULL) /* check spi_cmd_data_gpio_deinit */
926 {
927 handle->debug_print("ssd1315: spi_cmd_data_gpio_deinit is null.\n"); /* spi_cmd_data_gpio_deinit is null */
928
929 return 3; /* return error */
930 }
931 if (handle->spi_cmd_data_gpio_write == NULL) /* check spi_cmd_data_gpio_write */
932 {
933 handle->debug_print("ssd1315: spi_cmd_data_gpio_write is null.\n"); /* spi_cmd_data_gpio_write is null */
934
935 return 3; /* return error */
936 }
937 if (handle->reset_gpio_init == NULL) /* check reset_gpio_init */
938 {
939 handle->debug_print("ssd1315: reset_gpio_init is null.\n"); /* reset_gpio_init is null */
940
941 return 3; /* return error */
942 }
943 if (handle->reset_gpio_deinit == NULL) /* check reset_gpio_deinit */
944 {
945 handle->debug_print("ssd1315: reset_gpio_deinit is null.\n"); /* reset_gpio_deinit is null */
946
947 return 3; /* return error */
948 }
949 if(handle->reset_gpio_write == NULL) /* check reset_gpio_write */
950 {
951 handle->debug_print("ssd1315: reset_gpio_write is null.\n"); /* reset_gpio_write is null */
952
953 return 3; /* return error */
954 }
955
956 if (handle->spi_cmd_data_gpio_init() != 0) /* check spi_cmd_data_gpio_init */
957 {
958 handle->debug_print("ssd1315: spi cmd data gpio init failed.\n"); /* spi cmd data gpio init failed */
959
960 return 5; /* return error */
961 }
962 if (handle->reset_gpio_init() != 0) /* reset gpio init */
963 {
964 handle->debug_print("ssd1315: reset gpio init failed.\n"); /* reset gpio init failed */
965 (void)handle->spi_cmd_data_gpio_deinit(); /* spi_cmd_data_gpio_deinit */
966
967 return 4; /* return error */
968 }
969 if (handle->reset_gpio_write(0) != 0) /* write 0 */
970 {
971 handle->debug_print("ssd1315: reset gpio write failed.\n"); /* reset gpio write failed */
972 (void)handle->spi_cmd_data_gpio_deinit(); /* spi_cmd_data_gpio_deinit */
973 (void)handle->reset_gpio_deinit(); /* reset_gpio_deinit */
974
975 return 4; /* return error */
976 }
977 handle->delay_ms(100); /* delay 100 ms */
978 if (handle->reset_gpio_write(1) != 0) /* write 1 */
979 {
980 handle->debug_print("ssd1315: reset gpio write failed.\n"); /* reset gpio write failed */
981 (void)handle->spi_cmd_data_gpio_deinit(); /* spi_cmd_data_gpio_deinit */
982 (void)handle->reset_gpio_deinit(); /* reset_gpio_deinit */
983
984 return 4; /* return error */
985 }
986 if (handle->iic_spi == SSD1315_INTERFACE_IIC) /* if iic interface */
987 {
988 if (handle->iic_init() != 0) /* iic init */
989 {
990 handle->debug_print("ssd1315: iic init failed.\n"); /* iic init failed */
991 (void)handle->spi_cmd_data_gpio_deinit(); /* spi_cmd_data_gpio_deinit */
992 (void)handle->reset_gpio_deinit(); /* reset_gpio_deinit */
993
994 return 1; /* return error */
995 }
996 }
997 else if (handle->iic_spi == SSD1315_INTERFACE_SPI) /* if spi interface */
998 {
999 if (handle->spi_init() != 0) /* spi init */
1000 {
1001 handle->debug_print("ssd1315: spi init failed.\n"); /* spi init failed */
1002 (void)handle->spi_cmd_data_gpio_deinit(); /* spi_cmd_data_gpio_deinit */
1003 (void)handle->reset_gpio_deinit(); /* reset_gpio_deinit */
1004
1005 return 1; /* return error */
1006 }
1007 }
1008 else
1009 {
1010 handle->debug_print("ssd1315: interface is invalid.\n"); /* interface is invalid */
1011 (void)handle->spi_cmd_data_gpio_deinit(); /* spi_cmd_data_gpio_deinit */
1012 (void)handle->reset_gpio_deinit(); /* reset_gpio_deinit */
1013
1014 return 6; /* return error */
1015 }
1016 handle->inited = 1; /* flag inited */
1017
1018 return 0; /* success return 0 */
1019}
1020
1036{
1037 uint8_t buf[2];
1038
1039 if (handle == NULL) /* check handle */
1040 {
1041 return 2; /* return error */
1042 }
1043 if (handle->inited != 1) /* check handle initialization */
1044 {
1045 return 3; /* return error */
1046 }
1047
1048 buf[0] = SSD1315_CMD_CHARGE_PUMP_SETTING; /* charge pump off */
1049 buf[1] = 0x10 | (0 << 2); /* set charge pump */
1050 if (a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD) != 0) /* write command */
1051 {
1052 handle->debug_print("ssd1315: write command failed.\n"); /* write command failed */
1053
1054 return 4; /* return error */
1055 }
1056 if (a_ssd1315_write_byte(handle, SSD1315_CMD_DISPLAY_OFF, SSD1315_CMD) != 0) /* write display off */
1057 {
1058 handle->debug_print("ssd1315: write command failed.\n"); /* write command failed */
1059
1060 return 4; /* return error */
1061 }
1062 if (handle->reset_gpio_deinit() != 0) /* reset gpio deinit */
1063 {
1064 handle->debug_print("ssd1315: reset gpio deinit failed.\n"); /* reset gpio deinit failed */
1065
1066 return 5; /* return error */
1067 }
1068 if (handle->spi_cmd_data_gpio_deinit() != 0) /* spi cmd data gpio deinit */
1069 {
1070 handle->debug_print("ssd1315: spi cmd data gpio deinit failed.\n"); /* spi cmd data gpio deinit failed */
1071
1072 return 6; /* return error */
1073 }
1074 if (handle->iic_spi == SSD1315_INTERFACE_IIC) /* if iic interface */
1075 {
1076 if (handle->iic_deinit() != 0) /* iic deinit */
1077 {
1078 handle->debug_print("ssd1315: iic deinit failed.\n"); /* iic deinit failed */
1079
1080 return 1; /* return error */
1081 }
1082 }
1083 else if (handle->iic_spi == SSD1315_INTERFACE_SPI) /* if spi interface */
1084 {
1085 if (handle->spi_deinit() != 0) /* spi deinit */
1086 {
1087 handle->debug_print("ssd1315: spi deinit failed.\n"); /* spi deinit failed */
1088
1089 return 1; /* return error */
1090 }
1091 }
1092 else
1093 {
1094 handle->debug_print("ssd1315: interface is invalid.\n"); /* interface is invalid */
1095
1096 return 7; /* return error */
1097 }
1098 handle->inited = 0; /* flag close */
1099
1100 return 0; /* success return 0 */
1101}
1102
1113{
1114 if (handle == NULL) /* check handle */
1115 {
1116 return 2; /* return error */
1117 }
1118
1119 handle->iic_spi = (uint8_t)interface; /* set interface */
1120
1121 return 0; /* success return 0 */
1122}
1123
1134{
1135 if (handle == NULL) /* check handle */
1136 {
1137 return 2; /* return error */
1138 }
1139
1140 *interface = (ssd1315_interface_t)(handle->iic_spi); /* get interface */
1141
1142 return 0; /* success return 0 */
1143}
1144
1155{
1156 if (handle == NULL) /* check handle */
1157 {
1158 return 2; /* return error */
1159 }
1160
1161 handle->iic_addr = (uint8_t)addr_pin; /* set addr pin */
1162
1163 return 0; /* success return 0 */
1164}
1165
1176{
1177 if (handle == NULL) /* check handle */
1178 {
1179 return 2; /* return error */
1180 }
1181
1182 *addr_pin = (ssd1315_address_t)(handle->iic_addr); /* set address */
1183
1184 return 0; /* success return 0 */
1185}
1186
1200{
1201 if (handle == NULL) /* check handle */
1202 {
1203 return 2; /* return error */
1204 }
1205 if (handle->inited != 1) /* check handle initialization */
1206 {
1207 return 3; /* return error */
1208 }
1209 if (addr > 0x0F) /* check addr */
1210 {
1211 handle->debug_print("ssd1315: addr is invalid.\n"); /* addr is invalid */
1212
1213 return 4; /* return error */
1214 }
1215
1216 return a_ssd1315_write_byte(handle, SSD1315_CMD_LOWER_COLUMN_START_ADDRESS | (addr & 0x0F), SSD1315_CMD); /* write command */
1217}
1218
1232{
1233 if (handle == NULL) /* check handle */
1234 {
1235 return 2; /* return error */
1236 }
1237 if (handle->inited != 1) /* check handle initialization */
1238 {
1239 return 3; /* return error */
1240 }
1241 if (addr > 0x07) /* check addr */
1242 {
1243 handle->debug_print("ssd1315: addr is invalid.\n"); /* addr is invalid */
1244
1245 return 4; /* return error */
1246 }
1247
1248 return a_ssd1315_write_byte(handle, SSD1315_CMD_HIGHER_COLUMN_START_ADDRESS | (addr & 0x07), SSD1315_CMD); /* write command */
1249}
1250
1263{
1264 uint8_t buf[2];
1265
1266 if (handle == NULL) /* check handle */
1267 {
1268 return 2; /* return error */
1269 }
1270 if (handle->inited != 1) /* check handle initialization */
1271 {
1272 return 3; /* return error */
1273 }
1274
1275 buf[0] = SSD1315_CMD_MEMORY_ADDRESSING_MODE; /* set command mode */
1276 buf[1] = mode; /* set mode */
1277
1278 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
1279}
1280
1295uint8_t ssd1315_set_column_address_range(ssd1315_handle_t *handle, uint8_t start_addr, uint8_t end_addr)
1296{
1297 uint8_t buf[3];
1298
1299 if (handle == NULL) /* check handle */
1300 {
1301 return 2; /* return error */
1302 }
1303 if (handle->inited != 1) /* check handle initialization */
1304 {
1305 return 3; /* return error */
1306 }
1307 if (start_addr > 0x7F) /* check start addr */
1308 {
1309 handle->debug_print("ssd1315: start addr is invalid.\n"); /* start addr is invalid */
1310
1311 return 4; /* return error */
1312 }
1313 if (end_addr > 0x7F) /* check end addr */
1314 {
1315 handle->debug_print("ssd1315: end addr is invalid.\n"); /* end addr is invalid */
1316
1317 return 5; /* return error */
1318 }
1319
1320 buf[0] = SSD1315_CMD_SET_COLUMN_ADDRESS; /* set command */
1321 buf[1] = start_addr & 0x7F; /* set start address */
1322 buf[2] = end_addr & 0x7F; /* set end address */
1323
1324 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 3, SSD1315_CMD); /* write command */
1325}
1326
1341uint8_t ssd1315_set_page_address_range(ssd1315_handle_t *handle, uint8_t start_addr, uint8_t end_addr)
1342{
1343 uint8_t buf[3];
1344
1345 if (handle == NULL) /* check handle */
1346 {
1347 return 2; /* return error */
1348 }
1349 if (handle->inited != 1) /* check handle initialization */
1350 {
1351 return 3; /* return error */
1352 }
1353 if (start_addr > 0x07) /* check start addr */
1354 {
1355 handle->debug_print("ssd1315: start addr is invalid.\n"); /* start addr is invalid */
1356
1357 return 4; /* return error */
1358 }
1359 if (end_addr > 0x07) /* check end addr */
1360 {
1361 handle->debug_print("ssd1315: end addr is invalid.\n"); /* end_addr is invalid */
1362
1363 return 5; /* return error */
1364 }
1365
1366 buf[0] = SSD1315_CMD_SET_PAGE_ADDRESS; /* set command */
1367 buf[1] = start_addr & 0x07; /* set start address */
1368 buf[2] = end_addr & 0x07; /* set end address */
1369
1370 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 3, SSD1315_CMD); /* write command */
1371}
1372
1387{
1388 uint8_t buf[2];
1389
1390 if (handle == NULL) /* check handle */
1391 {
1392 return 2; /* return error */
1393 }
1394 if (handle->inited != 1) /* check handle initialization */
1395 {
1396 return 3; /* return error */
1397 }
1398 if (frames> 0x0F) /* check frames */
1399 {
1400 handle->debug_print("ssd1315: frames is invalid.\n"); /* frames is invalid */
1401
1402 return 4; /* return error */
1403 }
1404
1405 buf[0] = SSD1315_CMD_SET_FADE_OUT_AND_BLINKING; /* set command */
1406 buf[1] = (uint8_t)((mode << 4) | (frames & 0x0F)); /* set mode */
1407
1408 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
1409}
1410
1426uint8_t ssd1315_set_right_horizontal_scroll(ssd1315_handle_t *handle, uint8_t start_page_addr, uint8_t end_page_addr,
1428{
1429 uint8_t buf[7];
1430
1431 if (handle == NULL) /* check handle */
1432 {
1433 return 2; /* return error */
1434 }
1435 if (handle->inited != 1) /* check handle initialization */
1436 {
1437 return 3; /* return error */
1438 }
1439 if (start_page_addr > 0x07) /* check start_page_addr */
1440 {
1441 handle->debug_print("ssd1315: start page addr is invalid.\n"); /* start page addr is invalid */
1442
1443 return 4; /* return error */
1444 }
1445 if (end_page_addr > 0x07) /* check end_page_addr */
1446 {
1447 handle->debug_print("ssd1315: end page addr is invalid.\n"); /* end page addr is invalid */
1448
1449 return 5; /* return error */
1450 }
1451
1452 buf[0] = SSD1315_CMD_RIGHT_HORIZONTAL_SCROLL; /* set command */
1453 buf[1] = 0x00; /* set null */
1454 buf[2] = start_page_addr & 0x07; /* set start page address */
1455 buf[3] = frames & 0x07; /* set frames */
1456 buf[4] = end_page_addr & 0x07; /* set end page address */
1457 buf[5] = 0x00; /* set null */
1458 buf[6] = 0x7F; /* set frame end */
1459
1460 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 7, SSD1315_CMD); /* write command */
1461}
1462
1478uint8_t ssd1315_set_left_horizontal_scroll(ssd1315_handle_t *handle, uint8_t start_page_addr, uint8_t end_page_addr,
1480{
1481 uint8_t buf[7];
1482
1483 if (handle == NULL) /* check handle */
1484 {
1485 return 2; /* return error */
1486 }
1487 if (handle->inited != 1) /* check handle initialization */
1488 {
1489 return 3; /* return error */
1490 }
1491 if (start_page_addr > 0x07) /* check start_page_addr */
1492 {
1493 handle->debug_print("ssd1315: start_page_addr is invalid.\n"); /* start_page_addr is invalid */
1494
1495 return 4; /* return error */
1496 }
1497 if (end_page_addr > 0x07) /* check end_page_addr */
1498 {
1499 handle->debug_print("ssd1315: end_page_addr is invalid.\n"); /* end_page_addr is invalid */
1500
1501 return 5; /* return error */
1502 }
1503
1504 buf[0] = SSD1315_CMD_LEFT_HORIZONTAL_SCROLL; /* set command */
1505 buf[1] = 0x00; /* set null */
1506 buf[2] = start_page_addr & 0x07; /* set end page addr */
1507 buf[3] = frames & 0x07; /* set frames */
1508 buf[4] = end_page_addr & 0x07; /* set end page addr */
1509 buf[5] = 0x00; /* set null */
1510 buf[6] = 0x7F; /* set frame end */
1511
1512 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 7, SSD1315_CMD); /* write command */
1513}
1514
1539 uint8_t start_page_addr, uint8_t end_page_addr,
1540 uint8_t vertical_scrolling_offset, ssd1315_scroll_frame_t frames,
1541 uint8_t start_column_addr, uint8_t end_column_addr)
1542{
1543 uint8_t buf[8];
1544
1545 if (handle == NULL) /* check handle */
1546 {
1547 return 2; /* return error */
1548 }
1549 if (handle->inited != 1) /* check handle initialization */
1550 {
1551 return 3; /* return error */
1552 }
1553 if (start_page_addr > 0x07) /* check start_page_addr */
1554 {
1555 handle->debug_print("ssd1315: start_page_addr is invalid.\n"); /* start_page_addr is invalid */
1556
1557 return 4; /* return error */
1558 }
1559 if (end_page_addr > 0x07) /* check end page addr */
1560 {
1561 handle->debug_print("ssd1315: end_page_addr is invalid.\n"); /* end_page_addr is invalid */
1562
1563 return 5; /* return error */
1564 }
1565 if (vertical_scrolling_offset > 0x3F) /* check vertical scrolling offset */
1566 {
1567 handle->debug_print("ssd1315: vertical scrolling offset is invalid.\n"); /* vertical scrolling offset is invalid */
1568
1569 return 6; /* return error */
1570 }
1571 if (start_column_addr > 0x7F) /* check start column addr */
1572 {
1573 handle->debug_print("ssd1315: start column addr is invalid.\n"); /* start column addr is invalid */
1574
1575 return 7; /* return error */
1576 }
1577 if (end_column_addr > 0x7F) /* check end column addr */
1578 {
1579 handle->debug_print("ssd1315: end column addr is invalid.\n"); /* end column addr is invalid */
1580
1581 return 8; /* return error */
1582 }
1583
1584 buf[0] = SSD1315_CMD_VERTICAL_RIGHT_HORIZONTAL_SCROLL; /* set command */
1585 buf[1] = enable; /* set horizontal scroll */
1586 buf[2] = start_page_addr & 0x07; /* set start page addr */
1587 buf[3] = frames & 0x07; /* set frames */
1588 buf[4] = end_page_addr & 0x07; /* set end page addr */
1589 buf[5] = vertical_scrolling_offset & 0x3F; /* set vertical scrolling offset */
1590 buf[6] = start_column_addr & 0x7F; /* set start_column address */
1591 buf[7] = end_column_addr & 0x7F; /* set end column address */
1592
1593 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 8, SSD1315_CMD); /* write command */
1594}
1595
1620 uint8_t start_page_addr, uint8_t end_page_addr,
1621 uint8_t vertical_scrolling_offset, ssd1315_scroll_frame_t frames,
1622 uint8_t start_column_addr, uint8_t end_column_addr)
1623{
1624 uint8_t buf[8];
1625
1626 if (handle == NULL) /* check handle */
1627 {
1628 return 2; /* return error */
1629 }
1630 if (handle->inited != 1) /* check handle initialization */
1631 {
1632 return 3; /* return error */
1633 }
1634 if (start_page_addr > 0x07) /* check start_page_addr */
1635 {
1636 handle->debug_print("ssd1315: start_page_addr is invalid.\n"); /* start_page_addr is invalid */
1637
1638 return 4; /* return error */
1639 }
1640 if (end_page_addr > 0x07) /* check end page addr */
1641 {
1642 handle->debug_print("ssd1315: end_page_addr is invalid.\n"); /* end_page_addr is invalid */
1643
1644 return 5; /* return error */
1645 }
1646 if (vertical_scrolling_offset > 0x3F) /* check vertical scrolling offset */
1647 {
1648 handle->debug_print("ssd1315: vertical scrolling offset is invalid.\n"); /* vertical scrolling offset is invalid */
1649
1650 return 6; /* return error */
1651 }
1652 if (start_column_addr > 0x7F) /* check start column addr */
1653 {
1654 handle->debug_print("ssd1315: start column addr is invalid.\n"); /* start column addr is invalid */
1655
1656 return 7; /* return error */
1657 }
1658 if (end_column_addr > 0x7F) /* check end column addr */
1659 {
1660 handle->debug_print("ssd1315: end column addr is invalid.\n"); /* end column addr is invalid */
1661
1662 return 8; /* return error */
1663 }
1664
1665 buf[0] = SSD1315_CMD_VERTICAL_LEFT_HORIZONTAL_SCROLL; /* set command */
1666 buf[1] = enable; /* set horizontal scroll */
1667 buf[2] = start_page_addr & 0x07; /* set start page addr */
1668 buf[3] = frames & 0x07; /* set frames */
1669 buf[4] = end_page_addr & 0x07; /* set end page addr */
1670 buf[5] = vertical_scrolling_offset & 0x3F; /* set vertical scrolling offset */
1671 buf[6] = start_column_addr & 0x7F; /* set start_column address */
1672 buf[7] = end_column_addr & 0x7F; /* set end column address */
1673
1674 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 8, SSD1315_CMD); /* write command */
1675}
1676
1688{
1689 if (handle == NULL) /* check handle */
1690 {
1691 return 2; /* return error */
1692 }
1693 if (handle->inited != 1) /* check handle initialization */
1694 {
1695 return 3; /* return error */
1696 }
1697
1698 return a_ssd1315_write_byte(handle, SSD1315_CMD_DEACTIVATE_SCROLL, SSD1315_CMD); /* write command */
1699}
1700
1712{
1713 if (handle == NULL) /* check handle */
1714 {
1715 return 2; /* return error */
1716 }
1717 if (handle->inited != 1) /* check handle initialization */
1718 {
1719 return 3; /* return error */
1720 }
1721
1722 return a_ssd1315_write_byte(handle, SSD1315_CMD_ACTIVATE_SCROLL, SSD1315_CMD); /* write command */
1723}
1724
1738{
1739 if (handle == NULL) /* check handle */
1740 {
1741 return 2; /* return error */
1742 }
1743 if (handle->inited != 1) /* check handle initialization */
1744 {
1745 return 3; /* return error */
1746 }
1747 if (l > 0x3F) /* check line */
1748 {
1749 handle->debug_print("ssd1315: line is invalid.\n"); /* line is invalid */
1750
1751 return 4; /* return error */
1752 }
1753
1754 return a_ssd1315_write_byte(handle, SSD1315_CMD_DISPLAY_START_LINE | (l & 0x3F), SSD1315_CMD); /* write command */
1755}
1756
1768uint8_t ssd1315_set_contrast(ssd1315_handle_t *handle, uint8_t contrast)
1769{
1770 uint8_t buf[2];
1771
1772 if (handle == NULL) /* check handle */
1773 {
1774 return 2; /* return error */
1775 }
1776 if (handle->inited != 1) /* check handle initialization */
1777 {
1778 return 3; /* return error */
1779 }
1780
1781 buf[0] = SSD1315_CMD_CONTRAST_CONTROL; /* set command */
1782 buf[1] = contrast; /* set contrast */
1783
1784 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
1785}
1786
1800{
1801 uint8_t buf[2];
1802
1803 if (handle == NULL) /* check handle */
1804 {
1805 return 2; /* return error */
1806 }
1807 if (handle->inited != 1) /* check handle initialization */
1808 {
1809 return 3; /* return error */
1810 }
1811
1812 buf[0] = SSD1315_CMD_CHARGE_PUMP_SETTING; /* set command */
1813 buf[1] = (uint8_t)(0x10 | (enable << 2) |
1814 (((mode >> 1) & 0x1) << 7) | (((mode >> 0) & 0x1) << 0)); /* set charge pump */
1815
1816 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
1817}
1818
1831{
1832 if (handle == NULL) /* check handle */
1833 {
1834 return 2; /* return error */
1835 }
1836 if (handle->inited != 1) /* check handle initialization */
1837 {
1838 return 3; /* return error */
1839 }
1840
1841 if (remap != 0) /* check remap */
1842 {
1843 return a_ssd1315_write_byte(handle, SSD1315_CMD_COLUMN_127_MAPPED_TO_SEG0, SSD1315_CMD); /* write remap */
1844 }
1845 else
1846 {
1847 return a_ssd1315_write_byte(handle, SSD1315_CMD_COLUMN_0_MAPPED_TO_SEG0, SSD1315_CMD); /* write remap */
1848 }
1849}
1850
1866uint8_t ssd1315_set_vertical_scroll_area(ssd1315_handle_t *handle, uint8_t start_row, uint8_t end_row)
1867{
1868 uint8_t buf[3];
1869
1870 if (handle == NULL) /* check handle */
1871 {
1872 return 2; /* return error */
1873 }
1874 if (handle->inited != 1) /* check handle initialization */
1875 {
1876 return 3; /* return error */
1877 }
1878 if (start_row > 0x3F) /* check start row */
1879 {
1880 handle->debug_print("ssd1315: start_row is invalid.\n"); /* start_row is invalid */
1881
1882 return 4; /* return error */
1883 }
1884 if (end_row > 0x7F) /* check end_row */
1885 {
1886 handle->debug_print("ssd1315: end_row is invalid.\n"); /* end_row is invalid */
1887
1888 return 5; /* return error */
1889 }
1890 if (end_row > start_row) /* check start_row and end_row */
1891 {
1892 handle->debug_print("ssd1315: end_row > start_row.\n"); /* end_row > start_row */
1893
1894 return 6; /* return error */
1895 }
1896
1897 buf[0] = SSD1315_CMD_VERTICAL_SCROLL_AREA; /* set command */
1898 buf[1] = start_row; /* set start row */
1899 buf[2] = end_row; /* set end row */
1900
1901 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 3, SSD1315_CMD); /* write command */
1902}
1903
1916{
1917 if (handle == NULL) /* check handle */
1918 {
1919 return 2; /* return error */
1920 }
1921 if (handle->inited != 1) /* check handle initialization */
1922 {
1923 return 3; /* return error */
1924 }
1925
1926 if (enable != 0) /* if enable */
1927 {
1928 return a_ssd1315_write_byte(handle, SSD1315_CMD_ENTIRE_DISPLAY_ON, SSD1315_CMD); /* write command */
1929 }
1930 else
1931 {
1932 return a_ssd1315_write_byte(handle, SSD1315_CMD_ENTIRE_DISPLAY_OFF, SSD1315_CMD); /* write command */
1933 }
1934}
1935
1948{
1949 if (handle == NULL) /* check handle */
1950 {
1951 return 2; /* return error */
1952 }
1953 if (handle->inited != 1) /* check handle initialization */
1954 {
1955 return 3; /* return error */
1956 }
1957
1958 if (mode != 0) /* check mode */
1959 {
1960 return a_ssd1315_write_byte(handle, SSD1315_CMD_INVERSE_DISPLAY, SSD1315_CMD); /* write command */
1961 }
1962 else
1963 {
1964 return a_ssd1315_write_byte(handle, SSD1315_CMD_NORMAL_DISPLAY, SSD1315_CMD); /* write command */
1965 }
1966}
1967
1981uint8_t ssd1315_set_multiplex_ratio(ssd1315_handle_t *handle, uint8_t multiplex)
1982{
1983 uint8_t buf[2];
1984
1985 if (handle == NULL) /* check handle */
1986 {
1987 return 2; /* return error */
1988 }
1989 if (handle->inited != 1) /* check handle initialization */
1990 {
1991 return 3; /* return error */
1992 }
1993 if (multiplex < 0x0F) /* check multiplex */
1994 {
1995 handle->debug_print("ssd1315: multiplex is too small.\n"); /* multiplex is too small */
1996
1997 return 4; /* return error */
1998 }
1999 if (multiplex > 0x3F) /* check multiplex */
2000 {
2001 handle->debug_print("ssd1315: multiplex is too large.\n"); /* multiplex is too large */
2002
2003 return 5; /* return error */
2004 }
2005
2006 buf[0] = SSD1315_CMD_MULTIPLEX_RATIO ; /* set command */
2007 buf[1] = multiplex; /* set multiplex */
2008
2009 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
2010}
2011
2024{
2025 if (handle == NULL) /* check handle */
2026 {
2027 return 2; /* return error */
2028 }
2029 if (handle->inited != 1) /* check handle initialization */
2030 {
2031 return 3; /* return error */
2032 }
2033
2034 if (on_off != 0) /* check on off */
2035 {
2036 return a_ssd1315_write_byte(handle, SSD1315_CMD_DISPLAY_ON, SSD1315_CMD); /* write command */
2037 }
2038 else
2039 {
2040 return a_ssd1315_write_byte(handle, SSD1315_CMD_DISPLAY_OFF, SSD1315_CMD); /* write command */
2041 }
2042}
2043
2056uint8_t ssd1315_set_page_address(ssd1315_handle_t *handle, uint8_t addr)
2057{
2058 if (handle == NULL) /* check handle */
2059 {
2060 return 2; /* return error */
2061 }
2062 if (handle->inited != 1) /* check handle initialization */
2063 {
2064 return 3; /* return error */
2065 }
2066 if (addr > 0x07) /* check addr */
2067 {
2068 handle->debug_print("ssd1315: addr is invalid.\n"); /* addr is invalid */
2069
2070 return 4; /* return error */
2071 }
2072
2073 return a_ssd1315_write_byte(handle, SSD1315_CMD_PAGE_ADDR | (addr & 0x07), SSD1315_CMD); /* write command */
2074}
2075
2088{
2089 if (handle == NULL) /* check handle */
2090 {
2091 return 2; /* return error */
2092 }
2093 if (handle->inited != 1) /* check handle initialization */
2094 {
2095 return 3; /* return error */
2096 }
2097
2098 if (dir != 0) /* choose dir */
2099 {
2100 return a_ssd1315_write_byte(handle, SSD1315_CMD_SCAN_DIRECTION_COMN_1_START, SSD1315_CMD); /* write command */
2101 }
2102 else
2103 {
2104 return a_ssd1315_write_byte(handle, SSD1315_CMD_SCAN_DIRECTION_COM0_START, SSD1315_CMD); /* write command */
2105 }
2106}
2107
2120uint8_t ssd1315_set_display_offset(ssd1315_handle_t *handle, uint8_t offset)
2121{
2122 uint8_t buf[2];
2123
2124 if (handle == NULL) /* check handle */
2125 {
2126 return 2; /* return error */
2127 }
2128 if (handle->inited != 1) /* check handle initialization */
2129 {
2130 return 3; /* return error */
2131 }
2132 if (offset > 0x3F) /* check offset */
2133 {
2134 handle->debug_print("ssd1315: offset is invalid.\n"); /* offset is invalid */
2135
2136 return 4; /* return error */
2137 }
2138
2139 buf[0] = SSD1315_CMD_DISPLAY_OFFSET ; /* set command */
2140 buf[1] = offset; /* set offset */
2141
2142 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
2143}
2144
2159uint8_t ssd1315_set_display_clock(ssd1315_handle_t *handle, uint8_t oscillator_frequency, uint8_t clock_divide)
2160{
2161 uint8_t buf[2];
2162
2163 if (handle == NULL) /* check handle */
2164 {
2165 return 2; /* return error */
2166 }
2167 if (handle->inited != 1) /* check handle initialization */
2168 {
2169 return 3; /* return error */
2170 }
2171 if (oscillator_frequency> 0x0F) /* check oscillator_frequency */
2172 {
2173 handle->debug_print("ssd1315: oscillator frequency is invalid.\n"); /* oscillator frequency is invalid */
2174
2175 return 4; /* return error */
2176 }
2177 if (clock_divide> 0x0F) /* check clock_divide */
2178 {
2179 handle->debug_print("ssd1315: clock divide is invalid.\n"); /* clock divide is invalid */
2180
2181 return 5; /* return error */
2182 }
2183
2184 buf[0] = SSD1315_CMD_DISPLAY_CLOCK_DIVIDE ; /* set command */
2185 buf[1] = (oscillator_frequency << 4) | clock_divide; /* set oscillator frequency and clock divide */
2186
2187 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
2188}
2189
2202{
2203 uint8_t buf[2];
2204
2205 if (handle == NULL) /* check handle */
2206 {
2207 return 2; /* return error */
2208 }
2209 if (handle->inited != 1) /* check handle initialization */
2210 {
2211 return 3; /* return error */
2212 }
2213
2214 buf[0] = SSD1315_CMD_SET_ZOOM_IN ; /* set command */
2215 buf[1] = zoom; /* set zoom */
2216
2217 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
2218}
2219
2234uint8_t ssd1315_set_precharge_period(ssd1315_handle_t *handle, uint8_t phase1_period, uint8_t phase2_period)
2235{
2236 uint8_t buf[2];
2237
2238 if (handle == NULL) /* check handle */
2239 {
2240 return 2; /* return error */
2241 }
2242 if (handle->inited != 1) /* check handle initialization */
2243 {
2244 return 3; /* return error */
2245 }
2246 if (phase1_period> 0x0F) /* check phase1 period */
2247 {
2248 handle->debug_print("ssd1315: phase1 period is invalid.\n"); /* phase1 period is invalid */
2249
2250 return 4; /* return error */
2251 }
2252 if (phase2_period> 0x0F) /* check phase2 period */
2253 {
2254 handle->debug_print("ssd1315: phase2 period is invalid.\n"); /* phase2 period is invalid */
2255
2256 return 5; /* return error */
2257 }
2258
2259 buf[0] = SSD1315_CMD_PRE_CHARGE_PERIOD; /* set command */
2260 buf[1] = (phase2_period << 4) | phase1_period; /* set period */
2261
2262 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
2263}
2264
2278{
2279 uint8_t buf[2];
2280
2281 if (handle == NULL) /* check handle */
2282 {
2283 return 2; /* return error */
2284 }
2285 if (handle->inited != 1) /* check handle initialization */
2286 {
2287 return 3; /* return error */
2288 }
2289
2290 buf[0] = SSD1315_CMD_COM_PINS_CONF; /* set command */
2291 buf[1] = (uint8_t)((conf << 4) | (remap << 5) | 0x02); /* set com pins */
2292
2293 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
2294}
2295
2308{
2309 uint8_t buf[2];
2310
2311 if (handle == NULL) /* check handle */
2312 {
2313 return 2; /* return error */
2314 }
2315 if (handle->inited != 1) /* check handle initialization */
2316 {
2317 return 3; /* return error */
2318 }
2319
2320 buf[0] = SSD1315_CMD_COMH_DESLECT_LEVEL; /* set command */
2321 buf[1] = (uint8_t)(level << 4); /* set level */
2322
2323 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
2324}
2325
2339{
2340 uint8_t buf[2];
2341
2342 if (handle == NULL) /* check handle */
2343 {
2344 return 2; /* return error */
2345 }
2346 if (handle->inited != 1) /* check handle initialization */
2347 {
2348 return 3; /* return error */
2349 }
2350
2351 buf[0] = SSD1315_CMD_INTERNAL_IREF_SETTING; /* set command */
2352 buf[1] = (uint8_t)((enable << 4) | (iref << 5)); /* set iref */
2353
2354 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 2, SSD1315_CMD); /* write command */
2355}
2356
2375uint8_t ssd1315_set_right_horizontal_scroll_one_column(ssd1315_handle_t *handle, uint8_t start_page, uint8_t end_page,
2376 uint8_t start_column_addr, uint8_t end_column_addr)
2377{
2378 uint8_t buf[7];
2379
2380 if (handle == NULL) /* check handle */
2381 {
2382 return 2; /* return error */
2383 }
2384 if (handle->inited != 1) /* check handle initialization */
2385 {
2386 return 3; /* return error */
2387 }
2388 if (start_page > 5) /* check start page */
2389 {
2390 handle->debug_print("ssd1315: start_page > 5.\n"); /* start_page > 5 */
2391
2392 return 4; /* return error */
2393 }
2394 if (end_page > 5) /* check end page */
2395 {
2396 handle->debug_print("ssd1315: end_page > 5.\n"); /* end_page > 5 */
2397
2398 return 5; /* return error */
2399 }
2400 if (start_column_addr > 0x7F) /* check start column addr */
2401 {
2402 handle->debug_print("ssd1315: start_column_addr > 0x7F.\n"); /* start_column_addr > 0x7F */
2403
2404 return 6; /* return error */
2405 }
2406 if (end_column_addr > 0x7F) /* check end column addr */
2407 {
2408 handle->debug_print("ssd1315: end_column_addr > 0x7F.\n"); /* end_column_addr > 0x7F */
2409
2410 return 7; /* return error */
2411 }
2412
2413 buf[0] = SSD1315_CMD_RIGHT_HORIZONTAL_SCROLL_SETUP; /* set command */
2414 buf[1] = 0x00; /* set dummy */
2415 buf[2] = start_page; /* set start page */
2416 buf[3] = 0x01; /* set dummy */
2417 buf[4] = end_page; /* set end page */
2418 buf[5] = start_column_addr; /* set start column addr */
2419 buf[6] = end_column_addr; /* set end column addr */
2420
2421 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 7, SSD1315_CMD); /* write command */
2422}
2423
2442uint8_t ssd1315_set_left_horizontal_scroll_one_column(ssd1315_handle_t *handle, uint8_t start_page, uint8_t end_page,
2443 uint8_t start_column_addr, uint8_t end_column_addr)
2444{
2445 uint8_t buf[7];
2446
2447 if (handle == NULL) /* check handle */
2448 {
2449 return 2; /* return error */
2450 }
2451 if (handle->inited != 1) /* check handle initialization */
2452 {
2453 return 3; /* return error */
2454 }
2455 if (start_page > 5) /* check start page */
2456 {
2457 handle->debug_print("ssd1315: start_page > 5.\n"); /* start_page > 5 */
2458
2459 return 4; /* return error */
2460 }
2461 if (end_page > 5) /* check end page */
2462 {
2463 handle->debug_print("ssd1315: end_page > 5.\n"); /* end_page > 5 */
2464
2465 return 5; /* return error */
2466 }
2467 if (start_column_addr > 0x7F) /* check start column addr */
2468 {
2469 handle->debug_print("ssd1315: start_column_addr > 0x7F.\n"); /* start_column_addr > 0x7F */
2470
2471 return 6; /* return error */
2472 }
2473 if (end_column_addr > 0x7F) /* check end column addr */
2474 {
2475 handle->debug_print("ssd1315: end_column_addr > 0x7F.\n"); /* end_column_addr > 0x7F */
2476
2477 return 7; /* return error */
2478 }
2479
2480 buf[0] = SSD1315_CMD_LEFT_HORIZONTAL_SCROLL_SETUP; /* set command */
2481 buf[1] = 0x00; /* set dummy */
2482 buf[2] = start_page; /* set start page */
2483 buf[3] = 0x01; /* set dummy */
2484 buf[4] = end_page; /* set end page */
2485 buf[5] = start_column_addr; /* set start column addr */
2486 buf[6] = end_column_addr; /* set end column addr */
2487
2488 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, 7, SSD1315_CMD); /* write command */
2489}
2490
2503uint8_t ssd1315_write_cmd(ssd1315_handle_t *handle, uint8_t *buf, uint8_t len)
2504{
2505 if (handle == NULL) /* check handle */
2506 {
2507 return 2; /* return error */
2508 }
2509 if (handle->inited != 1) /* check handle initialization */
2510 {
2511 return 3; /* return error */
2512 }
2513
2514 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, len, SSD1315_CMD); /* write command */
2515}
2516
2529uint8_t ssd1315_write_data(ssd1315_handle_t *handle, uint8_t *buf, uint8_t len)
2530{
2531 if (handle == NULL) /* check handle */
2532 {
2533 return 2; /* return error */
2534 }
2535 if (handle->inited != 1) /* check handle initialization */
2536 {
2537 return 3; /* return error */
2538 }
2539
2540 return a_ssd1315_multiple_write_byte(handle, (uint8_t *)buf, len, SSD1315_DATA); /* write data */
2541}
2542
2552{
2553 if (info == NULL) /* check handle */
2554 {
2555 return 2; /* return error */
2556 }
2557
2558 memset(info, 0, sizeof(ssd1315_info_t)); /* initialize ssd1315 info structure */
2559 strncpy(info->chip_name, CHIP_NAME, 32); /* copy chip name */
2560 strncpy(info->manufacturer_name, MANUFACTURER_NAME, 32); /* copy manufacturer name */
2561 strncpy(info->interface, "IIC SPI", 8); /* copy interface name */
2562 info->supply_voltage_min_v = SUPPLY_VOLTAGE_MIN; /* set minimal supply voltage */
2563 info->supply_voltage_max_v = SUPPLY_VOLTAGE_MAX; /* set maximum supply voltage */
2564 info->max_current_ma = MAX_CURRENT; /* set maximum current */
2565 info->temperature_max = TEMPERATURE_MAX; /* set minimal temperature */
2566 info->temperature_min = TEMPERATURE_MIN; /* set maximum temperature */
2567 info->driver_version = DRIVER_VERSION; /* set driver version */
2568
2569 return 0; /* success return 0 */
2570}
#define SSD1315_DATA
#define SSD1315_CMD_MULTIPLEX_RATIO
#define SSD1315_CMD_DEACTIVATE_SCROLL
#define SSD1315_CMD_COM_PINS_CONF
#define SSD1315_CMD_COLUMN_0_MAPPED_TO_SEG0
#define MAX_CURRENT
#define SSD1315_CMD_SET_PAGE_ADDRESS
#define SSD1315_CMD_PRE_CHARGE_PERIOD
#define SSD1315_CMD_COLUMN_127_MAPPED_TO_SEG0
#define SSD1315_CMD_DISPLAY_OFFSET
#define SSD1315_CMD_COMH_DESLECT_LEVEL
#define SSD1315_CMD_LEFT_HORIZONTAL_SCROLL
#define SSD1315_CMD_LOWER_COLUMN_START_ADDRESS
chip command definition
#define SSD1315_CMD_DISPLAY_START_LINE
#define SSD1315_CMD_ENTIRE_DISPLAY_ON
#define SUPPLY_VOLTAGE_MAX
#define SSD1315_CMD_ENTIRE_DISPLAY_OFF
#define SSD1315_CMD_VERTICAL_LEFT_HORIZONTAL_SCROLL
#define SSD1315_CMD_SET_FADE_OUT_AND_BLINKING
#define SSD1315_CMD_CONTRAST_CONTROL
#define SSD1315_CMD_MEMORY_ADDRESSING_MODE
#define SSD1315_CMD_PAGE_ADDR
#define SSD1315_CMD_SET_ZOOM_IN
#define SSD1315_CMD_ACTIVATE_SCROLL
#define TEMPERATURE_MAX
#define SSD1315_CMD
chip command data definition
#define SSD1315_CMD_DISPLAY_CLOCK_DIVIDE
#define SSD1315_CMD_RIGHT_HORIZONTAL_SCROLL
#define SSD1315_CMD_NORMAL_DISPLAY
#define SSD1315_CMD_DISPLAY_ON
#define MANUFACTURER_NAME
#define TEMPERATURE_MIN
#define SUPPLY_VOLTAGE_MIN
#define SSD1315_CMD_LEFT_HORIZONTAL_SCROLL_SETUP
#define SSD1315_CMD_VERTICAL_SCROLL_AREA
#define SSD1315_CMD_SCAN_DIRECTION_COMN_1_START
#define SSD1315_CMD_CHARGE_PUMP_SETTING
#define SSD1315_CMD_INVERSE_DISPLAY
#define SSD1315_CMD_INTERNAL_IREF_SETTING
#define SSD1315_CMD_SCAN_DIRECTION_COM0_START
#define SSD1315_CMD_VERTICAL_RIGHT_HORIZONTAL_SCROLL
#define SSD1315_CMD_DISPLAY_OFF
#define CHIP_NAME
chip information definition
#define DRIVER_VERSION
#define SSD1315_CMD_SET_COLUMN_ADDRESS
#define SSD1315_CMD_HIGHER_COLUMN_START_ADDRESS
#define SSD1315_CMD_RIGHT_HORIZONTAL_SCROLL_SETUP
driver ssd1315 header file
driver ssd1315 font header file
uint8_t ssd1315_gram_write_point(ssd1315_handle_t *handle, uint8_t x, uint8_t y, uint8_t data)
write a point in the gram
uint8_t ssd1315_clear(ssd1315_handle_t *handle)
clear the screen
uint8_t ssd1315_set_entire_display(ssd1315_handle_t *handle, ssd1315_entire_display_t enable)
enable or disable the entire display
ssd1315_fade_blinking_mode_t
ssd1315 fade blinking mode enumeration definition
ssd1315_iref_value_t
ssd1315 iref value enumeration definition
uint8_t ssd1315_set_vertical_scroll_area(ssd1315_handle_t *handle, uint8_t start_row, uint8_t end_row)
set the vertical scroll area
ssd1315_interface_t
ssd1315 interface enumeration definition
uint8_t ssd1315_gram_read_point(ssd1315_handle_t *handle, uint8_t x, uint8_t y, uint8_t *data)
read a point from the gram
uint8_t ssd1315_set_zoom_in(ssd1315_handle_t *handle, ssd1315_zoom_in_t zoom)
set the display zoom in
uint8_t ssd1315_set_memory_addressing_mode(ssd1315_handle_t *handle, ssd1315_memory_addressing_mode_t mode)
set the memory addressing mode
ssd1315_scan_direction_t
ssd1315 scan direction enumeration definition
uint8_t ssd1315_set_left_horizontal_scroll(ssd1315_handle_t *handle, uint8_t start_page_addr, uint8_t end_page_addr, ssd1315_scroll_frame_t frames)
set the left horizontal scroll
uint8_t ssd1315_set_left_horizontal_scroll_one_column(ssd1315_handle_t *handle, uint8_t start_page, uint8_t end_page, uint8_t start_column_addr, uint8_t end_column_addr)
set left horizontal scroll by one column
uint8_t ssd1315_set_display_mode(ssd1315_handle_t *handle, ssd1315_display_mode_t mode)
set the display mode
uint8_t ssd1315_read_point(ssd1315_handle_t *handle, uint8_t x, uint8_t y, uint8_t *data)
read a point
uint8_t ssd1315_init(ssd1315_handle_t *handle)
initialize the chip
uint8_t ssd1315_deactivate_scroll(ssd1315_handle_t *handle)
deactivate the scroll
ssd1315_display_mode_t
ssd1315 display mode enumeration definition
ssd1315_memory_addressing_mode_t
ssd1315 memory addressing mode enumeration definition
uint8_t ssd1315_set_multiplex_ratio(ssd1315_handle_t *handle, uint8_t multiplex)
set the multiplex ratio
uint8_t ssd1315_set_display_start_line(ssd1315_handle_t *handle, uint8_t l)
set the display start line
uint8_t ssd1315_set_segment_remap(ssd1315_handle_t *handle, ssd1315_segment_column_remap_t remap)
set the segment remap
uint8_t ssd1315_set_display(ssd1315_handle_t *handle, ssd1315_display_t on_off)
enable or disable the display
uint8_t ssd1315_set_interface(ssd1315_handle_t *handle, ssd1315_interface_t interface)
set the chip interface
uint8_t ssd1315_get_addr_pin(ssd1315_handle_t *handle, ssd1315_address_t *addr_pin)
get the chip iic address
uint8_t ssd1315_set_iref(ssd1315_handle_t *handle, ssd1315_iref_t enable, ssd1315_iref_value_t iref)
set iref
uint8_t ssd1315_set_charge_pump(ssd1315_handle_t *handle, ssd1315_charge_pump_t enable, ssd1315_charge_pump_mode_t mode)
enable or disable the charge pump
uint8_t ssd1315_gram_fill_rect(ssd1315_handle_t *handle, uint8_t left, uint8_t top, uint8_t right, uint8_t bottom, uint8_t color)
fill a rectangle in the gram
uint8_t ssd1315_set_vertical_right_horizontal_scroll(ssd1315_handle_t *handle, ssd1315_horizontal_scroll_t enable, uint8_t start_page_addr, uint8_t end_page_addr, uint8_t vertical_scrolling_offset, ssd1315_scroll_frame_t frames, uint8_t start_column_addr, uint8_t end_column_addr)
set the vertical right horizontal scroll
struct ssd1315_handle_s ssd1315_handle_t
ssd1315 handle structure definition
uint8_t ssd1315_set_precharge_period(ssd1315_handle_t *handle, uint8_t phase1_period, uint8_t phase2_period)
set the pre charge period
ssd1315_scroll_frame_t
ssd1315 scroll frame enumeration definition
uint8_t ssd1315_set_scan_direction(ssd1315_handle_t *handle, ssd1315_scan_direction_t dir)
set the scan direction
ssd1315_pin_conf_t
ssd1315 pin conf enumeration definition
uint8_t ssd1315_set_right_horizontal_scroll(ssd1315_handle_t *handle, uint8_t start_page_addr, uint8_t end_page_addr, ssd1315_scroll_frame_t frames)
set the right horizontal scroll
uint8_t ssd1315_set_display_clock(ssd1315_handle_t *handle, uint8_t oscillator_frequency, uint8_t clock_divide)
set the display clock
ssd1315_deselect_level_t
ssd1315 deselect level enumeration definition
uint8_t ssd1315_set_page_address_range(ssd1315_handle_t *handle, uint8_t start_addr, uint8_t end_addr)
set the page address range
uint8_t ssd1315_gram_write_string(ssd1315_handle_t *handle, uint8_t x, uint8_t y, char *str, uint16_t len, uint8_t color, ssd1315_font_t font)
draw a string in the gram
uint8_t ssd1315_set_fade_blinking_mode(ssd1315_handle_t *handle, ssd1315_fade_blinking_mode_t mode, uint8_t frames)
set the fade blinking mode
uint8_t ssd1315_set_high_column_start_address(ssd1315_handle_t *handle, uint8_t addr)
set the high column start address
uint8_t ssd1315_activate_scroll(ssd1315_handle_t *handle)
activate the scroll
uint8_t ssd1315_set_low_column_start_address(ssd1315_handle_t *handle, uint8_t addr)
set the low column start address
ssd1315_font_t
ssd1315 font enumeration definition
ssd1315_zoom_in_t
ssd1315 zoom in enumeration definition
uint8_t ssd1315_info(ssd1315_info_t *info)
get chip's information
uint8_t ssd1315_set_display_offset(ssd1315_handle_t *handle, uint8_t offset)
set the display offset
ssd1315_charge_pump_t
ssd1315 charge pump enumeration definition
uint8_t ssd1315_set_addr_pin(ssd1315_handle_t *handle, ssd1315_address_t addr_pin)
set the chip iic address
ssd1315_left_right_remap_t
ssd1315 left right remap enumeration definition
uint8_t ssd1315_set_right_horizontal_scroll_one_column(ssd1315_handle_t *handle, uint8_t start_page, uint8_t end_page, uint8_t start_column_addr, uint8_t end_column_addr)
set right horizontal scroll by one column
uint8_t ssd1315_write_point(ssd1315_handle_t *handle, uint8_t x, uint8_t y, uint8_t data)
write a point
uint8_t ssd1315_get_interface(ssd1315_handle_t *handle, ssd1315_interface_t *interface)
get the chip interface
uint8_t ssd1315_gram_update(ssd1315_handle_t *handle)
update the gram data
ssd1315_address_t
ssd1315 address pin enumeration definition
uint8_t ssd1315_set_contrast(ssd1315_handle_t *handle, uint8_t contrast)
set the display contrast
struct ssd1315_info_s ssd1315_info_t
ssd1315 information structure definition
ssd1315_segment_column_remap_t
ssd1315 segment column remap enumeration definition
uint8_t ssd1315_set_vertical_left_horizontal_scroll(ssd1315_handle_t *handle, ssd1315_horizontal_scroll_t enable, uint8_t start_page_addr, uint8_t end_page_addr, uint8_t vertical_scrolling_offset, ssd1315_scroll_frame_t frames, uint8_t start_column_addr, uint8_t end_column_addr)
set the vertical left horizontal scroll
uint8_t ssd1315_set_com_pins_hardware_conf(ssd1315_handle_t *handle, ssd1315_pin_conf_t conf, ssd1315_left_right_remap_t remap)
set the hardware com pins
ssd1315_display_t
ssd1315 display enumeration definition
uint8_t ssd1315_deinit(ssd1315_handle_t *handle)
close the chip
uint8_t ssd1315_set_page_address(ssd1315_handle_t *handle, uint8_t addr)
set the page address
uint8_t ssd1315_gram_draw_picture(ssd1315_handle_t *handle, uint8_t left, uint8_t top, uint8_t right, uint8_t bottom, uint8_t *img)
draw a picture in the gram
uint8_t ssd1315_set_deselect_level(ssd1315_handle_t *handle, ssd1315_deselect_level_t level)
set the deselect level
ssd1315_horizontal_scroll_t
ssd1315 horizontal scroll enumeration definition
ssd1315_entire_display_t
ssd1315 entire display enumeration definition
ssd1315_iref_t
ssd1315 iref enumeration definition
uint8_t ssd1315_set_column_address_range(ssd1315_handle_t *handle, uint8_t start_addr, uint8_t end_addr)
set the column address range
ssd1315_charge_pump_mode_t
ssd1315 charge pump mode enumeration definition
@ SSD1315_INTERFACE_IIC
@ SSD1315_INTERFACE_SPI
uint8_t ssd1315_write_data(ssd1315_handle_t *handle, uint8_t *buf, uint8_t len)
write the register data
uint8_t ssd1315_write_cmd(ssd1315_handle_t *handle, uint8_t *buf, uint8_t len)
write the register command
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* spi_cmd_data_gpio_deinit)(void)
uint8_t(* reset_gpio_deinit)(void)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* spi_deinit)(void)
uint8_t(* reset_gpio_init)(void)
uint8_t(* spi_cmd_data_gpio_init)(void)
uint8_t gram[128][8]
uint8_t(* spi_write_cmd)(uint8_t *buf, uint16_t len)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* spi_cmd_data_gpio_write)(uint8_t value)
uint8_t(* reset_gpio_write)(uint8_t value)
uint8_t(* iic_deinit)(void)
uint32_t driver_version
char manufacturer_name[32]