PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Display
liboledc
oledc_setText.c
1
/*
2
* @file oledc_setText.c
3
*
4
* @author Matthew Matz
5
*
6
* @version 0.9
7
*
8
* @copyright Copyright (C) Parallax, Inc. 2016. See end of file for
9
* terms of use (MIT License).
10
*
11
* @brief 0.96-inch RGB OLED display bitmap driver, see oledc_h. for documentation.
12
*
13
* @detail Please submit bug reports, suggestions, and improvements to
14
* this code to editor@parallax.com.
15
*/
16
17
18
#include "oledc.h"
19
20
char
wrap;
21
unsigned
int
textsize, textcolor, textbgcolor;
22
int
_font[5];
23
24
void
oledc_setTextSize(
char
s) {
25
if
(_font[0] == 0)
26
{
27
textsize = 1;
28
}
else
{
29
textsize = s;
30
if
(s < 1) textsize = 1;
31
if
(s > 3) textsize = 3;
32
}
33
}
34
35
void
oledc_setTextColor(
unsigned
int
c,
unsigned
int
b) {
36
textcolor = c;
37
textbgcolor = b;
38
}
39
40
void
oledc_setTextWrap(
char
w) {
41
wrap = w;
42
}
43
44
void
oledc_setTextFont(
char
f) {
45
46
if
( f == 3 )
// Bubble
47
{
48
_font[1] = 44544;
49
_font[2] = 44416;
50
_font[3] = 43648;
51
_font[4] = 40576;
52
}
53
else
if
( f == 2 )
// Serif
54
{
55
_font[1] = 50048;
56
_font[2] = 49920;
57
_font[3] = 49152;
58
_font[4] = 46720;
59
}
60
else
if
( f == 1 )
// Script
61
{
62
_font[1] = 55552;
63
_font[2] = 55424;
64
_font[3] = 54656;
65
_font[4] = 52224;
66
}
67
else
// Sans
68
{
69
_font[1] = 61184;
70
_font[2] = 61056;
71
_font[3] = 60288;
72
_font[4] = 57728;
73
}
74
}
75
76
// Parts of this file are from the Adafruit GFX arduino library
77
78
/***************************************************
79
This is a library for the 0.96" 16-bit Color OLED with SSD1331 driver chip
80
Pick one up today in the adafruit shop!
81
------> http://www.adafruit.com/products/684
82
These displays use SPI to communicate, 4 or 5 pins are required to
83
interface
84
Adafruit invests time and resources providing this open source code,
85
please support Adafruit and open-source hardware by purchasing
86
products from Adafruit!
87
Written by Limor Fried/Ladyada for Adafruit Industries.
88
BSD license, all text above must be included in any redistribution
89
****************************************************/
90
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17