Krolyxon
Commit 3120783

Branches

Tags

Refs →

orion-rf.piolibdepsesp32-s3-n16r8U8g2srcU8g2lib.cpp

76 lines · 2.2 KB · C++

1/*
2
3 U8g2lib.cpp
4
5 Arduino specific functions
6
7
8 Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
9
10 Copyright (c) 2016, olikraus@gmail.com
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without modification,
14 are permitted provided that the following conditions are met:
15
16 * Redistributions of source code must retain the above copyright notice, this list
17 of conditions and the following disclaimer.
18
19 * Redistributions in binary form must reproduce the above copyright notice, this
20 list of conditions and the following disclaimer in the documentation and/or other
21 materials provided with the distribution.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
24 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
28 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
37*/
38
39
40#include "U8g2lib.h"
41
42#ifdef ARDUINO
43static Print *u8g2_print_for_screenshot;
44
45void u8g2_print_callback(const char *s)
46{
47 yield();
48 u8g2_print_for_screenshot->print(s);
49}
50
51void U8G2::writeBufferPBM(Print &p)
52{
53 u8g2_print_for_screenshot = &p;
54 u8g2_WriteBufferPBM(getU8g2(), u8g2_print_callback);
55}
56
57void U8G2::writeBufferXBM(Print &p)
58{
59 u8g2_print_for_screenshot = &p;
60 u8g2_WriteBufferXBM(getU8g2(), u8g2_print_callback);
61}
62
63void U8G2::writeBufferPBM2(Print &p)
64{
65 u8g2_print_for_screenshot = &p;
66 u8g2_WriteBufferPBM2(getU8g2(), u8g2_print_callback);
67}
68
69void U8G2::writeBufferXBM2(Print &p)
70{
71 u8g2_print_for_screenshot = &p;
72 u8g2_WriteBufferXBM2(getU8g2(), u8g2_print_callback);
73}
74#endif
75
76