CharlieWing Plex LED Display
Intro
Adafruit 15x7 CharliePlex LED Matrix Display.

Driver is IS31FL3731 datasheet

Plex and I2C Words

plex-emit works like the standard word emit. It blocks the calling thread, as long as the character is not written to the Plex display (less than 300 us for a 6x8 character and 400 kHz I2C). Horizontal (x) position is in pixel (0 to 15). The plex display is default shutdown, to switch on 1 plexshutdown.

plex-emit    ( Char -- )        Emits a character (writes a character to the Plex display)
plex-emit?   ( -- Flag )        Plex ready to get a character (I2C not busy)

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

plexpos!     ( x -- )           Set Plex cursor position, 
                                x horizontal position, for 6x8 font max. (15 / 6) -1, depends on the font's x size 
plexpos@     (  -- x )          Get the current Plex cursor position
plexclr      (  --  )           Clears the Plex display, sets the cursor to 0
plexfont     ( u -- )           Select the font, u: 0 6x8, 1 8x8
plexpwm      ( n -- )           default PWM 1 .. 255 (brightness)
plexshutdown ( n -- )           1 activate Plex dispaly, 0 shutdown display

plexcolumn!  ( col leds pwm -- )
plexcolumn@  ( col -- leds )
plexpixel!   ( col row pwm -- )
plexpixel@   ( col row -- u )

plexframe!   ( n -- )
plexframe@   (  -- n )
plexdisplay! ( n -- )
plexdisplay@ (  -- n )


I2Cdev       ( u -- )           Sets the 7-bit I2C address
I2Cput       ( c-addr u -- )    c-addr buffer address for the message with lengh u to send
I2Cget       ( c-addr u -- )    c-addr buffer address for the message to receive
I2Cputget    ( a1 u1 a2 u2 -- ) a1 buffer address for the message to send, a2 buffer address for the message to receive

Usage

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

: count-down ( -- )
  plexclr
 -1 -1 -1 alarm!  \ an alarm every second
  wait-alarm  
  10 0 do
    1 plexpos!
    i 1 + 25 * plexpwm  \ set brightness
    i 0 = if 
      [char] 1 plex-emit
      [char] 0 plex-emit
    else
      [char] 0 plex-emit
      10 i - [char] 0 + plex-emit
    then
    wait-alarm  
  loop
   0 $ff -1 plexcolumn!
  14 $ff -1 plexcolumn!
  1 plexpos!
  [char] 0 dup plex-emit plex-emit 
  cr ." Launch!" cr
;

Marquee

-- Peter Schmid - 2020-12-29

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

Topic attachments
I Attachment History Action Size Date Who Comment
JPEGjpg feather_3138_iso_demo.jpg r1 manage 758.0 K 2021-04-23 - 20:09 PeterSchmid  
JPEGjpg plex-header.jpg r1 manage 77.4 K 2021-05-06 - 09:43 PeterSchmid  
JPEGjpg plex.jpg r1 manage 483.7 K 2021-05-06 - 09:48 PeterSchmid  
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2022-11-22 - PeterSchmid
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback