I added a means to manually override the I/Os of the LED matrix
controller:

- setting the prescaler to 0 makes the controller stop scanning

- the registers 0xe00094004/8/c, set row pins, and registers
  0xe00094014/8/c set column pins. These register are bitmasks
  that set the respective pins if 1 and don't affect them if 0.
  This is similar to how things work on the Ingenic in the Ben.

   *4 sets pins to Z, *8 sets them to 0, and *c sets them to 1.

Let's put this to good use:

medit 0xe0009400 0

  Stops the LED matrix. It will freeze in whatever state it was
  in, so to make sure the matrix is dark, we need to tri-state
  everything first:

medit 0xe0009404 0xf
medit 0xe0009414 0xf

  Now, to light the first LED, we can drive the first row high
  and the first column low:

medit 0xe000940c 1
medit 0xe0009418 1

  The fourth LED would have the first row low and the the second
  column high:

medit 0xe0009408 1
medit 0xe000941c 2

  And so on. Resume scanning with:

medit 0xe0009400 51

Fun fact: here's the total M1 system current when at the desktop,
with Ethernet connected, all USB devices disconnected:

LED matrix                      Average (mA)    Standard dev (uA)
------------------------------- ------------    -----------------
Dark (0), scanning              920.26           506
All LEDs lit (255), scanning    938.08           630
Stopped, all I/Os Z             920.08           713
Stopped, all I/Os 0             919.97           756
Stopped, first LED lit          927.21          1041
Stopped, all I/Os Z (again)     921.15          1149

Not sure why the current increases and gets noisier as uptime
increases. Each measurement was calculated from 100 samples,
each averaged over 10 PLC.

- Werner
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to