-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEliuslab_SSD1307_OLED_Driver.cpp
692 lines (599 loc) · 18.4 KB
/
Eliuslab_SSD1307_OLED_Driver.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
/*
Eliuslab_SSD1307_OLED_Driver.h - Eliuslab_SSD1307_OLED_Driver library for ATMEGA328P - implementation
Copyright (c) 2020 Elia Lazzari. All right reserved.
*/
// include this library's description file
#include "Eliuslab_SSD1307_OLED_Driver.h"
/* Display output buffer */
byte DisplayBuffer[BUFFERCOLSIZE][BUFFERROWSIZE];
/* Variables and pointer used by shared static member functions */
byte Eliuslab_OLED::_XPos;
byte Eliuslab_OLED::_YPos;
byte Eliuslab_OLED::_DrawMode;
const byte *Eliuslab_OLED::_FontType;
const uint16_t *Eliuslab_OLED::_FontDescriptor;
byte Eliuslab_OLED::_FontHight;
// Constructor /////////////////////////////////////////////////////////////////
// Function that handles the creation and setup of instances
Eliuslab_OLED::Eliuslab_OLED(uint8_t _width, uint8_t _height, uint8_t _ssPin, uint8_t _dcPin, uint8_t _rstPin)
{
width = _width;
height = _height;
ssPin = _ssPin;
dcPin = _dcPin;
rstPin = _rstPin;
BufferStartOffset = 0;
pinMode(ssPin, OUTPUT);
pinMode(dcPin, OUTPUT);
pinMode(rstPin, OUTPUT);
/* Set vertical and horizontal orientation of the display */
_V_Ori = 0;
_H_Ori = 0;
_Res_Max_X = SSD1307_128_32_RES_X;
_GRAM_Col_Start = SSD1307_128_32_GRAM_COL_START;
_GRAM_Col_End = SSD1307_128_32_GRAM_COL_END;
_GRAM_Page_Start = SSD1307_128_32_GRAM_PAGE_START;
_GRAM_Page_End = SSD1307_128_32_GRAM_PAGE_END;
_RAM_Pages = SSD1307_128_32_GRAM_PAGE_END - SSD1307_128_32_GRAM_PAGE_START + 1;
/* Set text cursor to top corner */
Cursor(0, 0);
/* Set default font */
SetFont(_Terminal_8pt);
/* Set default draw mode */
DrawMode(NORMAL);
}
// Public Methods //////////////////////////////////////////////////////////////
// Functions available in Wiring sketches, this library, and other libraries
void Eliuslab_OLED::begin(void) {
Serial.begin(115200);
SPI.begin();
reset();
}
void Eliuslab_OLED::Initial_SSD1307ZD(void) {
//Start OLED configuration via SPI
Write_command(SSD1307_DISPLAY_OFF); // Display Off
Write_command(SSD1307_DISPLAY_CLOCK); //SET DISPLAY CLOCK
Write_command(0x80); //
Write_command(SSD1307_SELECT_MULTIPLEX_RATIO); // Select Multiplex Ratio
Write_command(height-1); // Default => 0x3F (1/64 Duty) 0x1F(1/32 Duty)
Write_command(SSD1307_DISPLAY_OFFSET); //Setting Display Offset
Write_command(0x00); //00H Reset
Write_command(SSD1307_DISPLAY_START_LINE); //Set Display Start Line
Write_command(SSD1307_SEGMENT_REMAP_DEFAULT); //Set Segment Re-Map Default
//0xA0 (0x00) => column Address 0 mapped to 127
//0xA1 (0x01) => Column Address 127 mapped to 0
Write_command(SSD1307_SET_COM_OUTPUT_SCAN_DIRECTION); //Set COM Output Scan Direction
Write_command(SSD1307_SET_COM_HW_CONFIGURATION); //Set COM Hardware Configuration
Write_command(SSD1307_DEFAULT_COM_PIN); //Alternative COM Pin---See IC Spec page 34
Write_command(SSD1307_SET_CONTRAST_CONTROL); //Set Contrast Control
Write_command(SSD1307_DFAULT_CONTRAST);
Write_command(SSD1307_SET_PRE_CHARGE_PERIOD); //Set Pre-Charge period
Write_command(SSD1307_DEFAULT_PRE_CHARGE_PERIOD);
Write_command(SSD1307_SET_DESELECT_VCOMH_LEVEL); //Set Deselect Vcomh level
Write_command(0x00);
Write_command(SSD1307_ENTIRE_DISPLAY_ON); //Entire Display ON
Write_command(SSD1307_SET_NORMAL_DISPLAY); //Set Normal Display
Write_command(SSD1307_DISPLAY_ON); // Display ON
}
void Eliuslab_OLED::reset(void) {
digitalWrite(dcPin, LOW); // Set display data mode pin
digitalWrite(rstPin, HIGH);
delay(10);
digitalWrite(rstPin, LOW);
delay(100);
digitalWrite(rstPin, HIGH);
delay(50);
Initial_SSD1307ZD();
delay(100);
/* Clear the display buffer */
ClearBuffer();
/* Output the display buffer to clear the display RAM */
Refresh();
/* Flip the display */
/*Flip_H();
Flip_V(); */
}
void Eliuslab_OLED::Write_command(byte command) {
//unsigned char bMask;
// take the SS pin low to select the chip:
digitalWrite(ssPin, LOW);
digitalWrite(dcPin, LOW);
SPI.beginTransaction(SPI_SETTINGS);
SPI.transfer(command);
SPI.endTransaction();
// take the SS pin high to de-select the chip:
digitalWrite(ssPin, HIGH);
digitalWrite(dcPin, HIGH);
}
void Eliuslab_OLED::Write_data(byte data) {
//unsigned char bMask;
// take the SS pin low to select the chip:
digitalWrite(ssPin, LOW);
digitalWrite(dcPin, HIGH);
SPI.beginTransaction(SPI_SETTINGS);
SPI.transfer(data);
SPI.endTransaction();
// take the SS pin high to de-select the chip:
digitalWrite(ssPin, HIGH);
digitalWrite(dcPin, LOW);
}
// SCROLLING FUNCTIONS -----------------------------------------------------
// To scroll the whole display, run: display.startscrollright(0x00, 0x0F)
void Eliuslab_OLED::startScrollRight(uint8_t start, uint8_t _stop) {
Write_command(SSD1307_RIGHT_HORIZONTAL_SCROLL);
Write_command(0x00);
Write_command(start);
Write_command(0X00);
Write_command(_stop);
Write_command(0x00);
Write_command(0xff);
Write_command(SSD1307_ACTIVATE_SCROLL);
}
// To scroll the whole display, run: display.startscrollleft(0x00, 0x0F)
void Eliuslab_OLED::startScrollLeft(uint8_t start, uint8_t _stop) {
Write_command(SSD1307_LEFT_HORIZONTAL_SCROLL);
Write_command(0x00);
Write_command(start);
Write_command(0X00);
Write_command(_stop);
Write_command(0x00);
Write_command(0xff);
Write_command(SSD1307_ACTIVATE_SCROLL);
}
// display.startscrolldiagright(0x00, 0x0F)
void Eliuslab_OLED::startScrollDiagRight(uint8_t start, uint8_t _stop) {
Write_command(SSD1307_SET_VERTICAL_SCROLL_AREA);
Write_command(0x00);
Write_command(32);
Write_command(SSD1307_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL);
Write_command(0x00);
Write_command(start);
Write_command(0x00);
Write_command(_stop);
Write_command(0x01);
Write_command(SSD1307_ACTIVATE_SCROLL);
}
void Eliuslab_OLED::stopScroll(void) {
Write_command(SSD1307_DEACTIVATE_SCROLL);
}
void Eliuslab_OLED::full_on() {
unsigned char x, y, Z = 0xb0;
for (x = 0; x <= SSD1307_128_32_GRAM_PAGE_END; x++)
{
Write_command(Z);
Z++;
Write_command(0x10);
Write_command(0x00);
for (y = 0; y < SSD1307_128_32_RES_X; y++)
{
Write_data(0xff);
}
}
}
void Eliuslab_OLED::full_off() {
unsigned char x, y, Z = 0xb0;
for (x = 0; x <= SSD1307_128_32_GRAM_PAGE_END; x++)
{
Write_command(Z);
Z++;
Write_command(0x10);
Write_command(0x00);
for (y = 0; y < SSD1307_128_32_RES_X; y++)
{
Write_data(0x00);
}
}
}
void Eliuslab_OLED::test(void) {
unsigned char x, y, Z = 0xB0;
for (x = 0; x < 4; x++)
{
Write_command(Z);
Z++;
Write_command(0x10);
Write_command(0x00);
for (y = 0; y < 128; y++)
{
Write_data(testBitmap[x][y]);
}
}
}
#ifdef USE_EEPROM
void Eliuslab_OLED::PrintBitmapFromEEPROM(uint16_t startAddress) {
unsigned char x, y, Z = 0xB0;
for (x = 0; x < 4; x++)
{
Write_command(Z);
Z++;
Write_command(0x10);
Write_command(0x00);
for (y = 0; y < 128; y++)
{
uint16_t addr = startAddress + (y + (128 * x));
Write_data(EEPROM[ addr ]);
}
}
}
void Eliuslab_OLED::BurnTestBitmapToEEPROM(uint16_t startAddress) {
unsigned char x, y;
for (x = 0; x < 4; x++)
{
for (y = 0; y < 128; y++)
{
uint16_t addr = startAddress + (y + (128 * x));
EEPROM.update(addr, testBitmap[x][y]);
}
}
}
#endif
/* Writes the contents of the display buffer to the display */
void Eliuslab_OLED::Refresh(void) {
byte ColIndex;
byte RowIndex;
byte Temp1, Temp2;
/* set graphics ram start and end columns */
Write_command(SETCOLADDRESS);
Write_command(_GRAM_Col_Start);
Write_command(_GRAM_Col_End);
/* set graphics ram start and end pages */
Write_command(SETPAGEADDRESS);
Write_command(_GRAM_Page_Start);
Write_command(_GRAM_Page_End);
byte Z = PAGEADD;
for (RowIndex = 0; RowIndex < _RAM_Pages; RowIndex++)
{
Write_command(Z);
Z++;
Write_command(0x10);
Write_command(0x00);
/* Write to display RAM */
for (ColIndex = 0; ColIndex < _Res_Max_X; ColIndex++)
{
Write_data(DisplayBuffer[ColIndex][RowIndex]);
}
}
//Serial.print("Display refreshed!");
}
/* Clears the contents of the output buffer */
void Eliuslab_OLED::ClearBuffer(void) {
byte ColIndex;
byte RowIndex;
for (RowIndex = 0; RowIndex < BUFFERROWSIZE; RowIndex++)
{
for (ColIndex = 0; ColIndex < BUFFERCOLSIZE; ColIndex++)
{
DisplayBuffer[ColIndex][RowIndex] = 0x00;
}
}
}
// DRAWING FUNCTIONS
/* Flip the horizontal orientation of the screen */
void Eliuslab_OLED::Flip_H(void) {
_H_Ori = ~_H_Ori;
if(_H_Ori)
{
Write_command(SCANDIRECTIONADD | SCANDIRREVERSE);
}else
{
Write_command(SCANDIRECTIONADD | SCANDIRNORMAL);
}
}
/* Flip the vertical orientation of the screen */
void Eliuslab_OLED::Flip_V(void) {
_V_Ori = ~_V_Ori;
if(_V_Ori)
{
Write_command(SEGMENTMAPADD | SEGMENTMAPREVERSE);
}else
{
Write_command(SEGMENTMAPADD | SEGMENTMAPNORMAL);
}
}
/* Write bitmap data to the LCD starting at the cursor location where:
Cols is the number byte columns to write to.
ByteRows is the number of rows to write to in 8 pixel chunks
BitmapData is an array containing the bitmap data to be written */
void Eliuslab_OLED::Bitmap(uint8_t Cols, uint8_t ByteRows, const uint8_t BitmapData[]) {
byte XIndex;
byte YIndex;
byte BufRow;
byte BufX;
unsigned int BitmapIndex;
/* Step through each 8 pixel row */
for (YIndex = 0; YIndex < ByteRows; YIndex++)
{
/* Step through each column */
for (XIndex = 0; XIndex < Cols; XIndex++)
{
BufX = XIndex + _XPos;
/* If column is beyond display area then don't bother writing to it*/
if(BufX < BUFFERCOLSIZE)
{
BufRow = YIndex + (_YPos / 8);
BitmapIndex = (YIndex * Cols)+ XIndex;
/* If row is beyond the display area then don't bother writing to it */
if(BufRow < BUFFERROWSIZE)
if (_DrawMode == NORMAL)
{
DisplayBuffer[BufX][BufRow] |= pgm_read_byte_near(&BitmapData[BitmapIndex]) << (_YPos%8);
}else
{
DisplayBuffer[BufX][BufRow] ^= pgm_read_byte_near(&BitmapData[BitmapIndex]) << (_YPos%8);
}
/* If column data overlaps to 8 bit rows then write to the second row */
if(_YPos%8 && (BufRow +1) < BUFFERROWSIZE)
if (_DrawMode == NORMAL)
{
DisplayBuffer[BufX][BufRow+1] |= pgm_read_byte_near(&BitmapData[BitmapIndex]) >> (8 - (_YPos%8));
}else
{
DisplayBuffer[BufX][BufRow+1] ^= pgm_read_byte_near(&BitmapData[BitmapIndex]) >> (8 - (_YPos%8));
}
}
}
}
}
/* Write to a single pixel on the display where:
X is the x axis coordinate of the pixel
Y is the Y axis coordinate of the pixel */
void Eliuslab_OLED::Plot(uint8_t X, uint8_t Y) {
byte row = Y / BUFFERROWSIZE;
if(X < BUFFERCOLSIZE && row < BUFFERROWSIZE)
if (_DrawMode == NORMAL)
{
DisplayBuffer[X][row] |= (0x01 << (Y % 8));
}else if(_DrawMode == INVERT)
{
DisplayBuffer[X][row] ^= (0x01 << (Y % 8));
}else if(_DrawMode == CLEAR)
{
DisplayBuffer[X][row] &= ~(0x01 << (Y % 8));
}
}
/* Draw a line where:
X1 is the starting X axis coordinate of the line
Y1 is the starting Y axis coordinate of the line
X2 is the starting X axis coordinate of the line
Y2 is the starting Y axis coordinate of the line */
void Eliuslab_OLED::Line(uint8_t X1, uint8_t Y1, uint8_t X2, uint8_t Y2) {
double step;
int x, y;
/* If start coordinates are below and to the right of the end coordinate then flip them */
if((X2 <= X1 && Y2 <= Y1) || (X2 >= X1 && Y1 >= Y2) || (X2 >= X1 && Y1 >= Y2))
{
X2^=X1;
X1^=X2;
X2^=X1;
Y2^=Y1;
Y1^=Y2;
Y2^=Y1;
}
/* If X axis is wider than Y axis then step though X axis */
if(((X2-X1) >= (Y2-Y1)) || ((X1 - X2) >= (Y2-Y1)))
{
step = (double)(Y2-Y1) / (X2-X1);
if(X2 >= X1 && Y2 >= Y1)
{
for(x = X1; x <= X2; x++)
Plot(x, ((x-X1) * step) + Y1);
}else
{
for(x = X1; x >= X2; x--)
Plot(x, Y2 + ((x-X2) * step));
}
}else /* If Y axis is wider than X axis then step though Y axis */
{
step = (double)(X2-X1) / (Y2-Y1);
if(Y2 >= Y1 && X2 >= X1)
{
for(y = Y1; y <= Y2; y++)
Plot(((y-Y1) * step) + X1, y);
}else
{
for(y = Y2; y >= Y1; y--)
Plot(X2 + ((y-Y2) * step),y);
}
}
}
/* Draw a rectangle where:
X1 is the X axis coordinate of the first corner
Y1 is the Y axis coordinate of the first corner
X2 is the X axis coordinate of the opposite corner
Y2 is the Y axis coordinate of the opposite corner
FillMode is sets the drawing mode for the rectangle. Options are:
OUTLINE (Draws an outlined rectangle with no fill
SOLID (Draws a filled filled rectangle) */
void Eliuslab_OLED::Rect(uint8_t X1, uint8_t Y1, uint8_t X2, uint8_t Y2, uint8_t FillMode) {
byte y;
/* Draw the top and bottom borders */
Line(X1, Y1, X2, Y1);
Line(X1, Y2, X2, Y2);
/* If first corner is below second corner then flip the coordinates */
if(Y1 > Y2)
{
Y2^=Y1;
Y1^=Y2;
Y2^=Y1;
}
/* If rectangle is wider than two pixels set Y for drawing vertical borders */
if(Y2-Y1 > 1)
{
Y1++;
Y2--;
}
/* If box is solid then fill area between top and bottom border */
if(FillMode == SOLID)
{
for(y = Y1; y <= Y2; y++)
Line(X1, y, X2, y);
}else /* if not solid then just draw vertical borders */
{
Line(X1, Y1, X1, Y2);
Line(X2, Y1, X2, Y2);
}
}
/* Clears an area of the display buffer where:
X1 is the X axis coordinate of the first corner
Y1 is the Y axis coordinate of the first corner
X2 is the X axis coordinate of the opposite corner
Y2 is the Y axis coordinate of the opposite corner
Thanks to vladyslav-savchenko for improved version */
void Eliuslab_OLED::Erase(uint8_t X1, uint8_t Y1, uint8_t X2, uint8_t Y2) {
byte temp = _DrawMode;
_DrawMode = CLEAR;
for (int column = X1; column <= X2; column ++)
for (int row = Y1; row <= Y2; row ++)
Plot(column, row);
_DrawMode = temp;
}
/* Sets the drawing mode for text and graphics where:
DrawMode sets the drawing mode. Options are:
NORMAL (Pixels are set to foreground colour)
INVERT (Pixels are set to the opposite of their current state)
CLEAR (Pixels are set to background colour) */
void Eliuslab_OLED::DrawMode(byte DrawMode) {
_DrawMode = DrawMode;
}
/* Sets the location of the cursor for text and bitmap graphics where:
X and Y are the starting top left X & Y axis coordinates */
void Eliuslab_OLED::Cursor(uint8_t X, uint8_t Y) {
_XPos = X;
_YPos = Y;
}
/* Print a text string to the LCD starting at the cursor coordinates where:
TextString[] is a string array containing the text to be displayed */
void Eliuslab_OLED::Print(char TextString[]) {
byte StringLength;
byte Index;
/* Finds length of string */
StringLength = strlen(TextString) - 1;
for (Index = 0; Index <= StringLength; Index++)
{
_WriteChar(TextString[Index] - 32);
}
}
/* Print a floating point number to the LCD starting at the cursor coordinates where:
value is the floating point value to display (max 10 digits including decimal places)
digits is the number of digits to crop the number to (including decimal places)
DecimalPlaces is the number of decimal places to display */
void Eliuslab_OLED::Print(float value, byte digits, byte DecimalPlaces) {
char Buffer[10];
/* Clip the number of digits to 10 */
if (digits > 10)
digits = 10;
/* Convert the value to an character array */
dtostrf(value, digits, DecimalPlaces, Buffer);
/* Output the array to the display buffer */
Print(Buffer);
}
/* Print a signed integer number to the LCD at the current cursor
coordinates where:
Value is signed integer number of type long */
void Eliuslab_OLED::Print(long Value) {
byte Digits[10];
int long Temp;
byte NumDigits = 0;
/* Is the number negative ? */
if (Value < 0)
{
_WriteChar(13);
Temp = Value * -1;
}else
{
Temp = Value;
}
/* Store each digit in a byte array so that they
can be printed in reverse order */
while (Temp)
{
Digits[NumDigits] = Temp % 10;
Temp /= 10;
NumDigits++;
}
/* Print each digit */
while(NumDigits)
{
NumDigits--;
_WriteChar(Digits[NumDigits] + 16);
}
}
/* Print a signed integer number with decimal point to the LCD at
the current cursor coordinates where:
Value is signed integer number of type long
DecimalPlaces is the position of the decimal point */
void Eliuslab_OLED::Print(int long Value, byte DecimalPlaces) {
byte Digits[10];
int long Temp;
byte NumDigits = 0;
/* Is the number negative ? */
if (Value < 0)
{
_WriteChar(13);
Temp = Value * -1;
}else
{
Temp = Value;
}
/* Store each digit in a byte array so that they
can be printed in reverse order */
while (Temp)
{
Digits[NumDigits] = Temp % 10;
Temp /= 10;
NumDigits++;
}
/* If the decimal point is at the beginning of the
number then pad it with a zero */
if(DecimalPlaces == NumDigits)
{
_WriteChar(16);
}
/* Print each digit */
while(NumDigits)
{
NumDigits--;
if (NumDigits + 1 == DecimalPlaces)
_WriteChar(14);
_WriteChar(Digits[NumDigits] + 16);
}
}
/* Write a single character or digit at the current cursor coordinate */
void Eliuslab_OLED::_WriteChar(char character) {
const byte *FontByteAddress;
int FontWidth;
FontByteAddress = _FontType + pgm_read_word_near(_FontDescriptor + (character * 2) + 1);
FontWidth = pgm_read_word_near(_FontDescriptor + (character * 2));
Bitmap(FontWidth, _FontHight, FontByteAddress);
_XPos = _XPos + FontWidth + 2;
}
/* Sets the font to be used when writing text or numbers where:
*Font is the font type to be used. Options are:
Terminal_8pt (A small 8x8 fixed width font)
MedProp_11pt (A medium two row proportional font)
LCDLarge_24pt (A large 4 row LCD style font) */
void Eliuslab_OLED::SetFont(uint8_t font_name) {
if(font_name == _Terminal_8pt)
{
_FontType = Terminal_8pt;
_FontHight = Terminal_8ptFontInfo.CharacterHeight;
_FontDescriptor = Terminal_8ptFontInfo.Descriptors;
}else if(font_name == _MedProp_11pt)
{
_FontType = MedProp_11pt;
_FontHight = MedProp_11ptFontInfo.CharacterHeight;
_FontDescriptor = MedProp_11ptFontInfo.Descriptors;
//Serial.print("Selected Font: MedProp_11pt");
}else if(font_name == _LCDLarge_24pt )
{
_FontType = LCDLarge_24pt;
_FontHight = LCDLarge_24ptFontInfo.CharacterHeight;
_FontDescriptor = LCDLarge_24ptFontInfo.Descriptors;
//Serial.print("Selected Font: LCDLarge_24pt");
}else if(font_name == _LargeProp_25pt )
{
_FontType = LargeProp_25pt;
_FontHight = LargeProp_25ptFontInfo.CharacterHeight;
_FontDescriptor = LargeProp_25ptFontInfo.Descriptors;
//Serial.print("Selected Font: LCDLarge_24pt");
}
}