epd-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. Larger fonts takes more than one line.
epd-emit ( Char -- ) Emits a character (writes a character to the EPD framebuffer) epd-emit? ( -- Flag ) EPD ready to get a character (SPI not busy) hook-emit ( -- a-addr ) Hooks for redirecting terminal IO on the fly hook-emit? ( -- a-addr ) epdpos! ( x y -- ) Set EPD cursor position, x horizontal position, for 6x8 font max. (250 / 6) -1, depends on the font's x size y vertical position (a line consists of 8 pixels), max. 14 for 255x122. 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) epdpartial ( x1 y1 x2 y2 -- ) Partial update the display epdcmd ( c-addr -- ) Send command to the EPD controller SSD1680. First byte contains the length of the command. epdpixel! ( Flag x y -- ) not implemented yet epdpixel@ ( x y -- Flag ) not implemented yet epdcolumn! ( u -- ) Write a column (8 pixels) to the current position. Increment position epdcolumn@ ( -- u ) Read a column (8 pixels) from the current position >epd ( -- addr1 addr2 ) redirect to EPD >term ( addr1 addr2 -- ) terminate redirection
: epd-hallo ( -- ) hook-emit @ \ save emit hook ['] epd-emit hook-emit ! \ redirect terminal to epd-emit ." Hallo Velo! " cr ." ciao" epdupdate hook-emit ! \ restore old hook ;or even simpler
: epd-hallo ( -- ) >epd \ redirect terminal to epd-emit ." Hallo Velo! " cr ." ciao" epdupdate >term \ terminate redirection ;or on a command line
>epd .( Hallo Velo!) epdupdate >termshow date and time on EPD (see CmsisRtos#How_to_use_Tasks for a background task).
: clock ( -- ) epdclr 3 epdfont -1 -1 -1 alarm! \ set an alarm every second begin wait-alarm \ wait a second 0 0 epdpos! >epd epdpos@ .time epdpos@ epdpart >term key? until key drop ;
Gate Y | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Source X | 0 1 2 3 4 5 6 7 | 8 9 10 11 12 13 14 15 | 112 113 114 115 116 117 118 119 | 120 121 | ||||||||||||||
Byte | 0 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | |
1 | .. | |||||||||||||||||
2 | .. | |||||||||||||||||
.. | ||||||||||||||||||
249 | .. |
Row | Gate Y++ | ||||||
---|---|---|---|---|---|---|---|
Column | 0 | 1 | 2 | ... | 121 | ||
Source X++ | 0 | 0 | 0 | ... | 121 | ||
Source Byte | 0.0 | 0.1 | 0.2 | ... | 15.1 | ||
0 | 0..7 | ||||||
1 | 8..15 | ||||||
2 | 16..23 | ||||||
.. | .. | ||||||
31 | 249..250 |
Row | Source X++ | ||||||
---|---|---|---|---|---|---|---|
Column | 0 | 1 | 2 | ... | 249 | ||
Gate Y-- | 249 | 248 | 247 | ... | 0 | ||
0 | 0..7 | ||||||
1 | 8..15 | ||||||
2 | 16..23 | ||||||
.. | .. | ||||||
15 | 120..121 |
I | Attachment | History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|
![]() |
epd_header.jpg | r1 | manage | 38.7 K | 2022-08-14 - 20:58 | PeterSchmid |