A lib to handle a E-Paper display from Pervasive Displays. There is a interface board from Embedded Artists. The lib can handle graphic and text drawing and is using external fonts.
Dependents: epaper_mbed_130411_KL25Z epaper_mbed_test epaper_KL25Z_2 test_he10 ... more
The E-Paper display from Pervasive Displays with a interface board is available from Embedded Artists : http://www.embeddedartists.com/products/displays/lcd_27_epaper.php The 2.7 inch display have 264*176 pixel, monochrome.
Technology
You can look at the webside from Pervasive to see how the display works. http://www.pervasivedisplays.com/technology/home
This type of display have ultra low power consumption - due to its bi-stable nature. It requires only very little power to update the display and needs no power to maintain an image. You can disconnect the display - the image is still there. The viewing angle is like real paper - near 180°.
There are also some disadvantages of this technology. To change the image, we have to rewrite the full display in 4 steps. Invert, clear, invert new, new image. This process is visible and take a while -2s at room temperature. If it gets colder the display reacts slower and the interface timing has to be slow down. To compensate this, there is a LM75 temp sensor on the interface board. We also need ram to double buffer the display. 264 * 176 / 8 = 5808 Byte. To double buffer we need 11616 byte of ram. This is no problem for most mbed devices, but it will not run on the LPC11U24 or LPC800-MAX.
Interface
The graphic data is transferred to the display via spi. The maximum speed is 12Mhz. There are also some control signal and the I2C for the temperature sensor. Together we need 12 signals.
Display | mbed LPC1768 | mbed KL25Z | signal type |
---|---|---|---|
1 GND | GND | GND | GND |
2 3V3 | VOUT | P3V3 | 3.3 V power |
3 SCK | p7 | PTD1 | SCK |
4 MOSI | p5 | PTD2 | MOSI |
5 MISO | p6 | PTD3 | MISO |
6 SSEL | p8 | PTC17 | GPIO |
7 Busy | p13 | PTA16 | GPIO |
8 Border | p10 | PTD6 | GPIO |
9 SCL | p27 | PTE1 | SCL |
10 SDA | p28 | PTE0 | SDA |
11 PWM | p26 | PTD4 | PWM |
12 Reset | p12 | PTA17 | GPIO |
13 Power control | p9 | PTD7 | GPIO |
14 Discharge | p11 | PTE31 | GPIO |
Software
Fonts
How to get nice looking fonts ?
To print characters to a graphic screen we need a font. To code a font by paper is ok for a small lcd, but for a 264*176 pixel display we need bigger fonts. A 12*12 pixel font is readable, but it a lot of work to construct it by hand.
Fonts can be made with the GLCD Font Creator also from http://www.mikroe.com .
With this program you can load a window font and convert it into a c-array. To use this Font with my lib you have to add 4 parameter at the beginning of the font array. - the number of byte / char - the vertial size in pixel - the horizontal size in pixel - the number of byte per vertical line (it is vertical size / 8 ) You also have to change the type of array to char[]. After that you can switch between different fonts with set_font(unsigned char* font); The horizontal size of each character is also stored in the font. It look better if you use bigger fonts or italic. The letter M is wider than a l.
Here are some Fonts from me : http://mbed.org/users/dreschpe/code/TFT_fonts/
The small made for the mbed lab board can also be used : http://mbed.org/users/dreschpe/code/LCD_fonts/
And from Peter Holzleitner : http://mbed.org/users/pholzleitner/code/SourceCodePro31-SB/
Text commands :
You can use the claim() function to redirect the output to stdout or stderr to the display. After claim(stdout) you can simply use the printf function without the classname to print to the display. All other printf from other libs are also redirected to the display if you use this.
- printf(...); print text and variables to the buffer with format options.
- locate(x,y); function is used to setup the cursor position. x,y are the pixel position.
Graphics
Graphic commands :
- cls(); Fill the screen with background color
- pixel(x,y,color); set a single pixel at x,y with 1 : black or 0 : white
- line(x0,y0,x1,y1,color); draw a line from x0,y0 to x1,y1 with color
- rect(x0,y0,x1,y1,color); draw a rectangle x0,y0 to x1,y1 with color
- fillrect(x0,y0,x1,y1,color); draw a filled rectangle
- circle( x0,y0,radius ,color); draw a circle around x0,y0 with radius
- fillcircle(x0,y0,radius ,color); draw a filled circle around x0,y0 with radius
- setmode(mode); Set the drawing mode for all functions. mode can be NORMAL -> 0 is white and 1 is black or XOR -> the new pixel is a xor between the old display and the new. This mode will invert if a black pixel is draw over a black pixel.
- print_bm(Bitmap ,x0,x0); Print a monochrome bitmap array. This graphic is defined by a Bitmap struct :
The pixel date array :
static char arm_logo[]={ 0x00,0x00... };
and a Bitmap struct:
Bitmap bitmARM = { 48, // XSize 48, // YSize 6, // Bytes in Line arm_logo // Pointer to picture data };
To convert a graphic into a byte array we can use the tool Picture Converter 1bpp from http://www.embedded-tools.de.vu/ With this tool we load a image, press the convert button and save it as C-Header file. We have to save with horizontal orientation, so we have to press "No". Inside this file we find the data array which we can copy into a header file.
All this commands are writing to the frame buffer only ! To change the active display we have to call
- write_disp(); This will refresh the display.
Sample code
test code for the LPC1768: http://mbed.org/users/dreschpe/code/epaper_mbed_test/
test code for KL25Z: http://mbed.org/users/dreschpe/code/epaper_mbed_130411_KL25Z/
#include "mbed.h" #include "EaEpaper.h" #include "Arial28x28.h" #include "Arial12x12.h" #include "font_big.h" #include "graphics.h" EaEpaper epaper( PTD7, // PWR_CTRL PTD6, // BORDER PTE31, // DISCHARGE PTA17, // RESET_DISP PTA16, // BUSY PTC17, // SSEL PTD4, // PWM PTD2,PTD3,PTD1, // MOSI,MISO,SCLK PTE0,PTE1); // SDA,SDL int main() { epaper.cls(); // clear screen epaper.set_font((unsigned char*) Arial28x28); // select the font epaper.locate(5,20); // set cursor epaper.printf("Hello Mbed"); // print text epaper.rect(3,15,150,50,1); // print a frame epaper.set_font((unsigned char*) Arial12x12); // change font epaper.locate(5,60); // set cursor epaper.printf("small Font"); // print text epaper.set_font((unsigned char*) Neu42x35); // change font epaper.locate(5,70); //set cursor epaper.printf("big Font"); // change font epaper.write_disp(); // update screen // update display wait(5); // wait 5 s epaper.fillcircle(180,30,22,1); // paint filled circle epaper.circle(160,150,20,1); // paint circle epaper.write_disp(); // update screen // update display }
EaEpaper.h@0:fedcef5319f5, 2013-11-09 (annotated)
- Committer:
- dreschpe
- Date:
- Sat Nov 09 23:37:43 2013 +0000
- Revision:
- 0:fedcef5319f5
- Child:
- 1:90d18805a8a4
Lib for using a E-Paper display from Pervasive Displays.; There is a interface board from Embedded Artists.; It can handle graphic and text drawing and is using external fonts.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreschpe | 0:fedcef5319f5 | 1 | /* mbed library for 264*176 pixel 2.7 INCH E-PAPER DISPLAY from Pervasive Displays |
dreschpe | 0:fedcef5319f5 | 2 | * Copyright (c) 2013 Peter Drescher - DC2PD |
dreschpe | 0:fedcef5319f5 | 3 | * |
dreschpe | 0:fedcef5319f5 | 4 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
dreschpe | 0:fedcef5319f5 | 5 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
dreschpe | 0:fedcef5319f5 | 6 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
dreschpe | 0:fedcef5319f5 | 7 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
dreschpe | 0:fedcef5319f5 | 8 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
dreschpe | 0:fedcef5319f5 | 9 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
dreschpe | 0:fedcef5319f5 | 10 | * THE SOFTWARE. |
dreschpe | 0:fedcef5319f5 | 11 | */ |
dreschpe | 0:fedcef5319f5 | 12 | |
dreschpe | 0:fedcef5319f5 | 13 | |
dreschpe | 0:fedcef5319f5 | 14 | // 09.11.2013 initial Version |
dreschpe | 0:fedcef5319f5 | 15 | |
dreschpe | 0:fedcef5319f5 | 16 | #ifndef EAEPAPER_H |
dreschpe | 0:fedcef5319f5 | 17 | #define EAEPAPER_H |
dreschpe | 0:fedcef5319f5 | 18 | |
dreschpe | 0:fedcef5319f5 | 19 | /** |
dreschpe | 0:fedcef5319f5 | 20 | * Includes |
dreschpe | 0:fedcef5319f5 | 21 | */ |
dreschpe | 0:fedcef5319f5 | 22 | #include "mbed.h" |
dreschpe | 0:fedcef5319f5 | 23 | #include "EPD.h" |
dreschpe | 0:fedcef5319f5 | 24 | #include "GraphicsDisplay.h" |
dreschpe | 0:fedcef5319f5 | 25 | |
dreschpe | 0:fedcef5319f5 | 26 | // we have to double buffer the display |
dreschpe | 0:fedcef5319f5 | 27 | #define EA_IMG_BUF_SZ (5808) // 264 x 176 / 8 = 5808 |
dreschpe | 0:fedcef5319f5 | 28 | |
dreschpe | 0:fedcef5319f5 | 29 | /** Draw mode |
dreschpe | 0:fedcef5319f5 | 30 | * NORMAl |
dreschpe | 0:fedcef5319f5 | 31 | * XOR set pixel by xor of the screen |
dreschpe | 0:fedcef5319f5 | 32 | */ |
dreschpe | 0:fedcef5319f5 | 33 | enum {NORMAL,XOR}; |
dreschpe | 0:fedcef5319f5 | 34 | |
dreschpe | 0:fedcef5319f5 | 35 | /** Bitmap |
dreschpe | 0:fedcef5319f5 | 36 | */ |
dreschpe | 0:fedcef5319f5 | 37 | struct Bitmap{ |
dreschpe | 0:fedcef5319f5 | 38 | int xSize; |
dreschpe | 0:fedcef5319f5 | 39 | int ySize; |
dreschpe | 0:fedcef5319f5 | 40 | int Byte_in_Line; |
dreschpe | 0:fedcef5319f5 | 41 | char* data; |
dreschpe | 0:fedcef5319f5 | 42 | }; |
dreschpe | 0:fedcef5319f5 | 43 | |
dreschpe | 0:fedcef5319f5 | 44 | /* color definitions */ |
dreschpe | 0:fedcef5319f5 | 45 | #define Black 0x0 |
dreschpe | 0:fedcef5319f5 | 46 | #define White 0x1 |
dreschpe | 0:fedcef5319f5 | 47 | |
dreschpe | 0:fedcef5319f5 | 48 | /** Display control class, based on GraphicsDisplay and TextDisplay |
dreschpe | 0:fedcef5319f5 | 49 | * |
dreschpe | 0:fedcef5319f5 | 50 | * Example: |
dreschpe | 0:fedcef5319f5 | 51 | * @code |
dreschpe | 0:fedcef5319f5 | 52 | * #include "mbed.h" |
dreschpe | 0:fedcef5319f5 | 53 | * #include "EaEpaper.h" |
dreschpe | 0:fedcef5319f5 | 54 | * #include "Arial28x28.h" |
dreschpe | 0:fedcef5319f5 | 55 | * #include "Arial12x12.h" |
dreschpe | 0:fedcef5319f5 | 56 | * #include "font_big.h" |
dreschpe | 0:fedcef5319f5 | 57 | * #include "graphics.h" |
dreschpe | 0:fedcef5319f5 | 58 | |
dreschpe | 0:fedcef5319f5 | 59 | * // the E-Paper board from embedded artists has a LM75 temp sensor to compensate the temperature effect. If it is cold the display reacts slower. |
dreschpe | 0:fedcef5319f5 | 60 | * // The LM75 need a I2C -> 2 pins : sda and scl |
dreschpe | 0:fedcef5319f5 | 61 | * // The display data is written via SPI -> 3 pins : mosi,miso,sck |
dreschpe | 0:fedcef5319f5 | 62 | * // There are also some control signals |
dreschpe | 0:fedcef5319f5 | 63 | * // The pwm pin has to be connected to a PWM enabled pin : pwm |
dreschpe | 0:fedcef5319f5 | 64 | * // The other signals are connected to normal IO`s |
dreschpe | 0:fedcef5319f5 | 65 | * // |
dreschpe | 0:fedcef5319f5 | 66 | * EaEpaper epaper(PTD7, // PWR_CTRL |
dreschpe | 0:fedcef5319f5 | 67 | * PTD6, // BORDER |
dreschpe | 0:fedcef5319f5 | 68 | * PTE31, // DISCHARGE |
dreschpe | 0:fedcef5319f5 | 69 | * PTA17, // RESET_DISP |
dreschpe | 0:fedcef5319f5 | 70 | * PTA16, // BUSY |
dreschpe | 0:fedcef5319f5 | 71 | * PTC17, // SSEL |
dreschpe | 0:fedcef5319f5 | 72 | * PTD4, // PWM |
dreschpe | 0:fedcef5319f5 | 73 | * PTD2,PTD3,PTD1, // MOSI,MISO,SCLK |
dreschpe | 0:fedcef5319f5 | 74 | * PTE0,PTE1); // SDA,SDL |
dreschpe | 0:fedcef5319f5 | 75 | * |
dreschpe | 0:fedcef5319f5 | 76 | * int main() { |
dreschpe | 0:fedcef5319f5 | 77 | * |
dreschpe | 0:fedcef5319f5 | 78 | * epaper.cls(); // clear screen |
dreschpe | 0:fedcef5319f5 | 79 | * epaper.set_font((unsigned char*) Arial28x28); // select the font |
dreschpe | 0:fedcef5319f5 | 80 | * epaper.locate(5,20); // set cursor |
dreschpe | 0:fedcef5319f5 | 81 | * epaper.printf("Hello Mbed"); // print text |
dreschpe | 0:fedcef5319f5 | 82 | * epaper.rect(3,15,150,50,1); // draw frame |
dreschpe | 0:fedcef5319f5 | 83 | * epaper.write_disp(); // update screen |
dreschpe | 0:fedcef5319f5 | 84 | * |
dreschpe | 0:fedcef5319f5 | 85 | * @endcode |
dreschpe | 0:fedcef5319f5 | 86 | */ |
dreschpe | 0:fedcef5319f5 | 87 | |
dreschpe | 0:fedcef5319f5 | 88 | |
dreschpe | 0:fedcef5319f5 | 89 | class EaEpaper : public GraphicsDisplay { |
dreschpe | 0:fedcef5319f5 | 90 | |
dreschpe | 0:fedcef5319f5 | 91 | public: |
dreschpe | 0:fedcef5319f5 | 92 | |
dreschpe | 0:fedcef5319f5 | 93 | /** |
dreschpe | 0:fedcef5319f5 | 94 | * Constructor. |
dreschpe | 0:fedcef5319f5 | 95 | */ |
dreschpe | 0:fedcef5319f5 | 96 | EaEpaper(PinName p_on, PinName border, PinName discharge, PinName reset, PinName busy, PinName cs, // IO-Pins |
dreschpe | 0:fedcef5319f5 | 97 | PinName pwm, // PWM Pin |
dreschpe | 0:fedcef5319f5 | 98 | PinName mosi, PinName miso, PinName sck, // SPI |
dreschpe | 0:fedcef5319f5 | 99 | PinName sda, PinName scl, // I2C |
dreschpe | 0:fedcef5319f5 | 100 | const char* name ="E_Paper"); |
dreschpe | 0:fedcef5319f5 | 101 | |
dreschpe | 0:fedcef5319f5 | 102 | /** Get the width of the screen in pixel |
dreschpe | 0:fedcef5319f5 | 103 | * |
dreschpe | 0:fedcef5319f5 | 104 | * @param |
dreschpe | 0:fedcef5319f5 | 105 | * @returns width of screen in pixel |
dreschpe | 0:fedcef5319f5 | 106 | * |
dreschpe | 0:fedcef5319f5 | 107 | */ |
dreschpe | 0:fedcef5319f5 | 108 | virtual int width(); |
dreschpe | 0:fedcef5319f5 | 109 | |
dreschpe | 0:fedcef5319f5 | 110 | /** Get the height of the screen in pixel |
dreschpe | 0:fedcef5319f5 | 111 | * |
dreschpe | 0:fedcef5319f5 | 112 | * @returns height of screen in pixel |
dreschpe | 0:fedcef5319f5 | 113 | * |
dreschpe | 0:fedcef5319f5 | 114 | */ |
dreschpe | 0:fedcef5319f5 | 115 | virtual int height(); |
dreschpe | 0:fedcef5319f5 | 116 | |
dreschpe | 0:fedcef5319f5 | 117 | |
dreschpe | 0:fedcef5319f5 | 118 | /** |
dreschpe | 0:fedcef5319f5 | 119 | * Clear the display |
dreschpe | 0:fedcef5319f5 | 120 | */ |
dreschpe | 0:fedcef5319f5 | 121 | void clear(); |
dreschpe | 0:fedcef5319f5 | 122 | |
dreschpe | 0:fedcef5319f5 | 123 | /** |
dreschpe | 0:fedcef5319f5 | 124 | * Write image buffer to display |
dreschpe | 0:fedcef5319f5 | 125 | */ |
dreschpe | 0:fedcef5319f5 | 126 | void write_disp(void); |
dreschpe | 0:fedcef5319f5 | 127 | |
dreschpe | 0:fedcef5319f5 | 128 | /** |
dreschpe | 0:fedcef5319f5 | 129 | * set or reset a single pixel |
dreschpe | 0:fedcef5319f5 | 130 | * |
dreschpe | 0:fedcef5319f5 | 131 | * @param x horizontal position |
dreschpe | 0:fedcef5319f5 | 132 | * @param y vertical position |
dreschpe | 0:fedcef5319f5 | 133 | * @param color : 0 white, 1 black |
dreschpe | 0:fedcef5319f5 | 134 | */ |
dreschpe | 0:fedcef5319f5 | 135 | virtual void pixel(int x, int y, int color); |
dreschpe | 0:fedcef5319f5 | 136 | |
dreschpe | 0:fedcef5319f5 | 137 | /** Fill the screen with white |
dreschpe | 0:fedcef5319f5 | 138 | * |
dreschpe | 0:fedcef5319f5 | 139 | */ |
dreschpe | 0:fedcef5319f5 | 140 | virtual void cls(void); |
dreschpe | 0:fedcef5319f5 | 141 | |
dreschpe | 0:fedcef5319f5 | 142 | /** draw a 1 pixel line |
dreschpe | 0:fedcef5319f5 | 143 | * |
dreschpe | 0:fedcef5319f5 | 144 | * @param x0,y0 start point |
dreschpe | 0:fedcef5319f5 | 145 | * @param x1,y1 stop point |
dreschpe | 0:fedcef5319f5 | 146 | * @param color : 0 white, 1 black |
dreschpe | 0:fedcef5319f5 | 147 | */ |
dreschpe | 0:fedcef5319f5 | 148 | void line(int x0, int y0, int x1, int y1, int color); |
dreschpe | 0:fedcef5319f5 | 149 | |
dreschpe | 0:fedcef5319f5 | 150 | /** draw a rect |
dreschpe | 0:fedcef5319f5 | 151 | * |
dreschpe | 0:fedcef5319f5 | 152 | * @param x0,y0 top left corner |
dreschpe | 0:fedcef5319f5 | 153 | * @param x1,y1 down right corner |
dreschpe | 0:fedcef5319f5 | 154 | * @param color : 0 white, 1 black |
dreschpe | 0:fedcef5319f5 | 155 | */ |
dreschpe | 0:fedcef5319f5 | 156 | void rect(int x0, int y0, int x1, int y1, int color); |
dreschpe | 0:fedcef5319f5 | 157 | |
dreschpe | 0:fedcef5319f5 | 158 | /** draw a filled rect |
dreschpe | 0:fedcef5319f5 | 159 | * |
dreschpe | 0:fedcef5319f5 | 160 | * @param x0,y0 top left corner |
dreschpe | 0:fedcef5319f5 | 161 | * @param x1,y1 down right corner |
dreschpe | 0:fedcef5319f5 | 162 | * @param color : 0 white, 1 black |
dreschpe | 0:fedcef5319f5 | 163 | */ |
dreschpe | 0:fedcef5319f5 | 164 | void fillrect(int x0, int y0, int x1, int y1, int color); |
dreschpe | 0:fedcef5319f5 | 165 | |
dreschpe | 0:fedcef5319f5 | 166 | /** draw a circle |
dreschpe | 0:fedcef5319f5 | 167 | * |
dreschpe | 0:fedcef5319f5 | 168 | * @param x0,y0 center |
dreschpe | 0:fedcef5319f5 | 169 | * @param r radius |
dreschpe | 0:fedcef5319f5 | 170 | * @param color : 0 white, 1 black * |
dreschpe | 0:fedcef5319f5 | 171 | */ |
dreschpe | 0:fedcef5319f5 | 172 | void circle(int x0, int y0, int r, int color); |
dreschpe | 0:fedcef5319f5 | 173 | |
dreschpe | 0:fedcef5319f5 | 174 | /** draw a filled circle |
dreschpe | 0:fedcef5319f5 | 175 | * |
dreschpe | 0:fedcef5319f5 | 176 | * @param x0,y0 center |
dreschpe | 0:fedcef5319f5 | 177 | * @param r radius |
dreschpe | 0:fedcef5319f5 | 178 | * @param color : 0 white, 1 black * |
dreschpe | 0:fedcef5319f5 | 179 | */ |
dreschpe | 0:fedcef5319f5 | 180 | void fillcircle(int x0, int y0, int r, int color); |
dreschpe | 0:fedcef5319f5 | 181 | |
dreschpe | 0:fedcef5319f5 | 182 | /** set drawing mode |
dreschpe | 0:fedcef5319f5 | 183 | * @param NORMAL : paint normal color, XOR : paint XOR of current pixels |
dreschpe | 0:fedcef5319f5 | 184 | */ |
dreschpe | 0:fedcef5319f5 | 185 | void setmode(int mode); |
dreschpe | 0:fedcef5319f5 | 186 | |
dreschpe | 0:fedcef5319f5 | 187 | /** setup cursor position |
dreschpe | 0:fedcef5319f5 | 188 | * |
dreschpe | 0:fedcef5319f5 | 189 | * @param x x-position (top left) |
dreschpe | 0:fedcef5319f5 | 190 | * @param y y-position |
dreschpe | 0:fedcef5319f5 | 191 | */ |
dreschpe | 0:fedcef5319f5 | 192 | virtual void locate(int x, int y); |
dreschpe | 0:fedcef5319f5 | 193 | |
dreschpe | 0:fedcef5319f5 | 194 | /** calculate the max number of char in a line |
dreschpe | 0:fedcef5319f5 | 195 | * |
dreschpe | 0:fedcef5319f5 | 196 | * @returns max columns |
dreschpe | 0:fedcef5319f5 | 197 | * depends on actual font size |
dreschpe | 0:fedcef5319f5 | 198 | */ |
dreschpe | 0:fedcef5319f5 | 199 | virtual int columns(); |
dreschpe | 0:fedcef5319f5 | 200 | |
dreschpe | 0:fedcef5319f5 | 201 | /** calculate the max number of columns |
dreschpe | 0:fedcef5319f5 | 202 | * |
dreschpe | 0:fedcef5319f5 | 203 | * @returns max column |
dreschpe | 0:fedcef5319f5 | 204 | * depends on actual font size |
dreschpe | 0:fedcef5319f5 | 205 | */ |
dreschpe | 0:fedcef5319f5 | 206 | virtual int rows(); |
dreschpe | 0:fedcef5319f5 | 207 | |
dreschpe | 0:fedcef5319f5 | 208 | /** put a char on the screen |
dreschpe | 0:fedcef5319f5 | 209 | * |
dreschpe | 0:fedcef5319f5 | 210 | * @param value char to print |
dreschpe | 0:fedcef5319f5 | 211 | * @returns printed char |
dreschpe | 0:fedcef5319f5 | 212 | */ |
dreschpe | 0:fedcef5319f5 | 213 | virtual int _putc(int value); |
dreschpe | 0:fedcef5319f5 | 214 | |
dreschpe | 0:fedcef5319f5 | 215 | /** paint a character on given position out of the active font to the screen buffer |
dreschpe | 0:fedcef5319f5 | 216 | * |
dreschpe | 0:fedcef5319f5 | 217 | * @param x x-position (top left) |
dreschpe | 0:fedcef5319f5 | 218 | * @param y y-position |
dreschpe | 0:fedcef5319f5 | 219 | * @param c char code |
dreschpe | 0:fedcef5319f5 | 220 | */ |
dreschpe | 0:fedcef5319f5 | 221 | virtual void character(int x, int y, int c); |
dreschpe | 0:fedcef5319f5 | 222 | |
dreschpe | 0:fedcef5319f5 | 223 | /** select the font to use |
dreschpe | 0:fedcef5319f5 | 224 | * |
dreschpe | 0:fedcef5319f5 | 225 | * @param f pointer to font array |
dreschpe | 0:fedcef5319f5 | 226 | * |
dreschpe | 0:fedcef5319f5 | 227 | * font array can created with GLCD Font Creator from http://www.mikroe.com |
dreschpe | 0:fedcef5319f5 | 228 | * you have to add 4 parameter at the beginning of the font array to use: |
dreschpe | 0:fedcef5319f5 | 229 | * - the number of byte / char |
dreschpe | 0:fedcef5319f5 | 230 | * - the vertial size in pixel |
dreschpe | 0:fedcef5319f5 | 231 | * - the horizontal size in pixel |
dreschpe | 0:fedcef5319f5 | 232 | * - the number of byte per vertical line |
dreschpe | 0:fedcef5319f5 | 233 | * you also have to change the array to char[] |
dreschpe | 0:fedcef5319f5 | 234 | */ |
dreschpe | 0:fedcef5319f5 | 235 | void set_font(unsigned char* f); |
dreschpe | 0:fedcef5319f5 | 236 | |
dreschpe | 0:fedcef5319f5 | 237 | /** print bitmap to buffer |
dreschpe | 0:fedcef5319f5 | 238 | * |
dreschpe | 0:fedcef5319f5 | 239 | * @param bm struct Bitmap in flash |
dreschpe | 0:fedcef5319f5 | 240 | * @param x x start |
dreschpe | 0:fedcef5319f5 | 241 | * @param y y start |
dreschpe | 0:fedcef5319f5 | 242 | * |
dreschpe | 0:fedcef5319f5 | 243 | */ |
dreschpe | 0:fedcef5319f5 | 244 | void print_bm(Bitmap bm, int x, int y); |
dreschpe | 0:fedcef5319f5 | 245 | |
dreschpe | 0:fedcef5319f5 | 246 | |
dreschpe | 0:fedcef5319f5 | 247 | unsigned char* font; |
dreschpe | 0:fedcef5319f5 | 248 | unsigned int draw_mode; |
dreschpe | 0:fedcef5319f5 | 249 | |
dreschpe | 0:fedcef5319f5 | 250 | private: |
dreschpe | 0:fedcef5319f5 | 251 | |
dreschpe | 0:fedcef5319f5 | 252 | EPD_Class epd_; |
dreschpe | 0:fedcef5319f5 | 253 | I2C i2c_; |
dreschpe | 0:fedcef5319f5 | 254 | unsigned int char_x; |
dreschpe | 0:fedcef5319f5 | 255 | unsigned int char_y; |
dreschpe | 0:fedcef5319f5 | 256 | int32_t readTemperature(); |
dreschpe | 0:fedcef5319f5 | 257 | |
dreschpe | 0:fedcef5319f5 | 258 | }; |
dreschpe | 0:fedcef5319f5 | 259 | |
dreschpe | 0:fedcef5319f5 | 260 | #endif /* EAEPAPER_H */ |