Line: 1 to 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
E-Ink FeatherWing, E-Paper Display EPD
Intro
The Adafruit 2.13" EPD display #4195 has a 250x122 resolution (there are others e.g. 1.54" 200x200, 2.9" 296x128), that's enough for about 15 lines and 40 characters.
Driver epd.c, fonts from https://www.mikrocontroller.net/topic/54860.
Code page 850
EPD and SPI Wordsepd-emit works like the standard word emit . It blocks the calling thread, as long as the character is not written to the EPD display. Horizontal (x) position is in pixel (0 to 249), vertical position (y) is in lines, a line consists of 8 pixels. 0, 0 is upper left corner. Larger fonts takes more than one line.
epd-emit ( c -- ) Emits a character (writes a character to the EPD framebuffer) epd-emit? ( -- ? ) EPD ready to get a character (SPI not busy) hook-emit ( -- a ) Hooks for redirecting terminal IO on the fly hook-emit? ( -- a ) epdpos! ( x y -- ) Set EPD cursor position, x horizontal position, pixel resolution, e.g. 0 to 249 for 250x122 displays. y vertical position (line), max. 15 for 250x122 displays. epdpos@ ( -- x y ) Get the current EPD cursor position epdclr ( -- ) Clears the EPD display, sets the cursor to 0, 0 epdfont ( u -- ) Select the font, u: 0 6x8, 1 8x8, 2 8X16 , 3 12X16 epdupdate ( -- ) Update the display (copy the framebuffer to the display) epdstartpart ( -- ) Start the partial update for the EPD display epdupdatepart ( -- ) Update part of the EPD display epdcmd ( a -- ) Send command to the EPD controller SSD1680. First byte contains the length of the command. epdsleep ( -- ) enter deep sleep mode epdwakeup ( -- ) wake up EPD epdpixel! ( ? x y -- ) not implemented yet epdpixel@ ( x y -- ? ) not implemented yet epdcolumn! ( u -- ) Write a column (8 pixels) to the current position. Increment position. Bit 0 on top epdcolumn@ ( -- u ) Read a column (8 pixels) from the current position >epd ( -- a1 a2 ) redirect to EPD *) >term ( a1 a2 -- ) terminate redirection *) *) part of redirection.fs UsageIt is easy to redirect the terminal output to the EPD display, to use the string formatting words.: epd-hallo ( -- ) hook-emit @ \ save emit hook ['] epd-emit hook-emit ! \ redirect terminal to epd-emit ." Hallo Velo! " cr ." ciao" hook-emit ! \ restore old hook epdupdate ;or even simpler : epd-hallo ( -- ) >epd \ redirect terminal to epd-emit ." Hallo Velo! " cr ." ciao" >term \ terminate redirection epdupdate ;or on a command line >epd .( Hallo Velo!) >term epdupdateshow date and time on EPD (see CmsisRtos#How_to_use_Tasks for a background task). : clock ( -- ) epdclr 3 epdfont >epd .time >term epdupdate \ 2000 osdelay drop -1 -1 -1 alarm! \ set an alarm every second begin wait-alarm \ wait a second 0 0 epdpos! epdstartpart >epd .time >term epdupdatepart key? until key drop ; Adafruit EInk Feather Board
Driver, LinksSSD1680 DriverOne byte display memory contains 8 pixels. Logical 0 is black, logical 1 is white. Most significant bit is first pixel. 250 x 122
Portrait
Landscape
Driver SW
Other EPDs with SSD1680
Graphics File Formats
Portable BitMap, binary P4.pbm
P1 # This is an example bitmap of the letter "J" 6 10 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 P4 # This is an example bitmap of the letter "J" 6 10 08080808080888700000 ImageMagickImageMagick$ convert image.png -rotate -90 -flip image.pbm $ convert image.png -rotate 90 -flop image.xbm $ convert image -colorspace gray -threshold 10% -type bilevel result $ convert image -separate -monochrome result $ convert image.png -separate -monochrome -rotate 90 -flop -negate image.xbm | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > | convert image36 -shave 2x2 image32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-- Peter Schmid - 2022-08-02
This work by Peter Schmid is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
|