Memory-in-Pixel Display
Intro
This new type of LCD has the ultra-low power usage of eInk and the fast-refresh rates of an LCD. Viewable in any light, from edge-of-vision to bright sunlight. Wide, symmetrical viewing angles, typically 120° ×120°.

Driver mip.c, fonts from https://www.mikrocontroller.net/topic/54860.

Code page 850

Code page 850, 9x14

MIP Words

mip-emit works like the standard word emit. It blocks the calling thread, as long as the character is not written to the MIP display. Horizontal (x) position is in pixel (0 to 167/399), vertical position (y) is in lines (0 to 17/29), a line consists of 8 pixels. Larger fonts takes more than one line.

mip-emit     ( Char -- )        Emits a character (writes a character to the MIP display)
mip-emit?    ( -- Flag )        MIP ready to get a character (SPI not busy)

hook-emit    ( -- a-addr )      Hooks for redirecting terminal IO on the fly
hook-emit?   ( -- a-addr )    

mippos!      ( x y -- )         Set MIP cursor position, 
                                x horizontal position, for 6x8 font max. (168 / 6) -1, depends on the font's x size 
                                y vertical position (a line consists of 8 pixels), max. 17 for 168x144 or 29 for 400x240 displays.
mippos@      (  -- x y )        Get the current MIP cursor position
mipclr       (  --  )           Clears the OLED display, sets the cursor to 0, 0
mipfont      ( u --  )          Select the font, u: 0 6x8, 1 8x8, 2 8X16 , 3 12X16

>mip         ( -- addr1 addr2 ) redirect to MIP
>term        ( addr1 addr2 -- ) terminate redirection

Usage

It is easy to redirect the terminal output to the MIP display, to use the string formatting words.

: mip-hallo (  -- )
  hook-emit @              \ save emit hook
  ['] mip-emit hook-emit !  \  redirect terminal to mip-emit
  ." Hallo Velo! " cr
  ." ciao"
  hook-emit !         \ restore old hook
;

or even simpler

: mip-hallo (  -- )
  >mip         \ redirect terminal to mip-emit
  ." Hallo Velo! " cr
  ." ciao"
  >term         \ terminate redirection
;

or on a command line

>mip .( Hallo Velo!) >term

show date and time on MIP (see CmsisRtos#How_to_use_Tasks for a background task).

: clock (  -- )
  mipclr
  3 mipfont
  -1 -1 -1 alarm!  \ set an alarm every second
  begin
    wait-alarm     \ wait a second
    0 0 mippos!
    >mip .time >term
  key? until
  key drop
;

-- Peter Schmid - 2022-05-13

Creative Commons License
This work by Peter Schmid is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2022-05-15 - PeterSchmid
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback