LCDGFX LCD display driver
1.2.0
Lightweight graphics library for SSD1306, SSD1325, SSD1327, SSD1331, SSD1351, SH1106, SH1107, IL9163, ST7735, ST7789, ILI9341, PCD8544 displays over I2C/SPI
Print_internal.h
Go to the documentation of this file.
1
/*
2
MIT License
3
4
Copyright (c) 2018-2019, Alexey Dynda
5
6
Permission is hereby granted, free of charge, to any person obtaining a copy
7
of this software and associated documentation files (the "Software"), to deal
8
in the Software without restriction, including without limitation the rights
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
copies of the Software, and to permit persons to whom the Software is
11
furnished to do so, subject to the following conditions:
12
13
The above copyright notice and this permission notice shall be included in all
14
copies or substantial portions of the Software.
15
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
SOFTWARE.
23
*/
24
29
#ifndef _LCD_HAL_PRINT_INTERNAL_H_
30
#define _LCD_HAL_PRINT_INTERNAL_H_
31
32
#if defined(ARDUINO) && !defined(ARDUINO_FAKE)
33
34
/* Include standard print class for Arduino environment */
35
#include "Print.h"
36
37
#else
38
39
#include "io.h"
40
#include <stdio.h>
41
43
class
Print
44
{
45
public
:
47
Print
()
48
{
49
}
50
56
virtual
size_t
write
(uint8_t ch) = 0;
57
63
size_t
print
(
const
char
*str)
64
{
65
size_t
n = 0;
66
while
( *str )
67
{
68
n +=
write
(*str);
69
str++;
70
}
71
return
n;
72
}
73
79
size_t
print
(
int
n)
80
{
81
char
a[10];
82
snprintf(a,
sizeof
(a),
"%i"
, n);
83
return
print
(a);
84
}
85
91
size_t
println
(
const
char
*str)
92
{
93
size_t
n =
print
(str);
94
n +=
write
(
'\n'
);
95
return
n;
96
};
97
103
size_t
println
(
int
data)
104
{
105
size_t
n =
print
(data);
106
n +=
write
(
'\n'
);
107
return
n;
108
}
109
};
110
111
#endif
112
113
#endif
Print::Print
Print()
Constructor to create Print class object.
Definition:
Print_internal.h:47
Print::println
size_t println(const char *str)
Prints string via write() and goes to next line.
Definition:
Print_internal.h:91
Print::println
size_t println(int data)
Prints number via write() and goes to next line.
Definition:
Print_internal.h:103
Print::print
size_t print(const char *str)
Prints string via write()
Definition:
Print_internal.h:63
Print
Implements own Print class for plain AVR and Linux environment.
Definition:
Print_internal.h:43
Print::write
virtual size_t write(uint8_t ch)=0
abstract function to be defined in inherited classes
Print::print
size_t print(int n)
Prints number via write()
Definition:
Print_internal.h:79
src
lcd_hal
Print_internal.h
Generated by
1.8.13