Browse Source

Merge branch 'master' of https://source.mntmn.com/MNT/reform

mntmn 3 years ago
parent
commit
37cb046251

+ 3 - 0
reform2-handbook/build.sh

@@ -4,6 +4,9 @@ function build {
   dot -Tsvg system-diagram.dot -o system-diagram.svg
   rsvg-convert -f pdf -o system-diagram.pdf system-diagram.svg
   kramdown system.md >system.html
+  
+  sed -i 's/width="[^"]*"/width="100%"/' system-diagram.svg
+  sed -i 's/height="[^"]*"//' system-diagram.svg
 }
 
 build

+ 46 - 46
reform2-handbook/system-diagram.dot

@@ -11,7 +11,7 @@ digraph G {
   labelloc="t";
 
   rtc  [label="Realtime\nClock" color=black href="system.html#rtc"];
-  rtcbat  [label="Coin Cell"];
+  rtcbat  [label="Coin Cell" href="system.html#rtc"];
    
   subgraph cluster_som {
     fontname="Inter";
@@ -51,7 +51,7 @@ digraph G {
       
       pwm [label="PWM" href="system.html#pwm"];
       
-      ethmac  [label="ETH MAC"];
+      ethmac  [label="ETH MAC" href="system.html#eth-mac"];
 
       cpu0 [label="Cortex-A53" href="system.html#cortex-a53"];
       cpu1 [label="Cortex-M4F" href="system.html#cortex-m4f"];
@@ -61,10 +61,10 @@ digraph G {
       spi1 [label="SPI" href="system.html#spi"];
     }
 
-    ram [label="LPDDR4\nRAM 4GB" color=black];
-    emmc [label="eMMC\n~8GB" color=black];
+    ram [label="LPDDR4\nRAM 4GB" color=black href="system.html#ddrc"];
+    emmc [label="eMMC\n~8GB" color=black href="system.html#mmc"];
     
-    ethphy  [label="ETH PHY" color=black];
+    ethphy  [label="ETH PHY" color=black href="system.html#eth-phy"];
     
     s5v  [label="5V Input"];
   }
@@ -82,14 +82,14 @@ digraph G {
     style=filled;
     label=<<b>Internal Ports</b><br/> >;
 
-    iuart0  [label="UART1"];
-    iuart1  [label="UART2\nConsole"];
+    iuart0  [label="UART1" href="system.html#uart"];
+    iuart1  [label="UART2\nConsole" href="system.html#uart"];
 
-    iusb0 [label="IUSB1"];
-    iusb1 [label="IUSB2"];
+    iusb0 [label="IUSB1" href="system.html#usb3"];
+    iusb1 [label="IUSB2" href="system.html#usb3"];
 
-    impcie [label="mPCIe Slot"];
-    im2 [label="M.2 Slot\nKey M"];
+    impcie [label="mPCIe Slot" href="system.html#pcie"];
+    im2 [label="M.2 Slot\nKey M" href="system.html#pcie"];
   }
   
   subgraph cluster_power {
@@ -108,18 +108,18 @@ digraph G {
       style=filled;
       margin="25.0";
       
-      lpc  [label="MCU LPC11U24" color=black width=4];
-      ina  [label="Current &\nVoltage Monitor" color=black];
+      lpc  [label="MCU LPC11U24" color=black width=4 href="system.html#lpc"];
+      ina  [label="Current &\nVoltage Monitor" color=black href="system.html#ina"];
       
-      ltc  [label="Buck/Boost\nDC-DC and Charger" color=black];
+      ltc  [label="Buck/Boost\nDC-DC and Charger" color=black href="system.html#ltc4020"];
 
-      mon  [label="Cell Monitor\nBalancer" color=black];
+      mon  [label="Cell Monitor\nBalancer" color=black href="system.html#balancer"];
       
-      lspi  [label="SPI" shape=diamond style=filled color=lightgrey];
-      li2c  [label="I2C" shape=diamond style=filled color=lightgrey];
+      lspi  [label="SPI" shape=diamond style=filled color=lightgrey href="system.html#spi"];
+      li2c  [label="I2C" shape=diamond style=filled color=lightgrey href="system.html#i2c"];
     
-      cells [label="8x LiFePO4 18650 Batteries" shape=rectangle];
-      supply [label="24V Power Supply\nfrom Barrel Jack" shape=rectangle];
+      cells [label="8x LiFePO4 18650 Batteries" shape=rectangle href="system.html#cells"];
+      supply [label="24V Power Supply\nfrom Barrel Jack" shape=rectangle href="system.html#barreljack"];
     
       enabchg [label="Charge On" shape=diamond style=filled color=lightgrey];
       enab5v [label="On" shape=diamond style=filled color=lightgrey];
@@ -134,13 +134,13 @@ digraph G {
       margin="25.0";
       
       r28v  [label="~28V" shape=diamond style=filled color=lightgrey];
-      stby [label="3V3 Standby" color=black];
-      r5v  [label="5V" width=1.1 color=black];
-      r3v3 [label="3V3" color=black];
+      stby [label="3V3 Standby" color=black href="system.html#standby"];
+      r5v  [label="5V" width=1.1 color=black href="system.html#r5v"];
+      r3v3 [label="3V3" color=black href="system.html#r3v3"];
       
-      r1v2 [label="1V2" width=0.5 color=black];
-      r1v5 [label="1V5" width=0.5 color=black];
-      r1v8 [label="1V8" width=0.5 color=black];
+      r1v2 [label="1V2" width=0.5 color=black href="system.html#r1v2"];
+      r1v5 [label="1V5" width=0.5 color=black href="system.html#r1v5"];
+      r1v8 [label="1V8" width=0.5 color=black href="system.html#r1v8"];
     }
   }
 
@@ -152,19 +152,19 @@ digraph G {
     color=lightgrey;
     style=filled;
     
-    pusb3  [label="USB3 Port 3"];
-    pusb2  [label="USB3 Port 2"];
-    pusb1  [label="USB3 Port 1"];
+    pusb3  [label="USB3 Port 3" href="system.html#usb3"];
+    pusb2  [label="USB3 Port 2" href="system.html#usb3"];
+    pusb1  [label="USB3 Port 1" href="system.html#usb3"];
 
-    pbarrel [label="Barrel Jack"];
+    pbarrel [label="Barrel Jack" href="system.html#barreljack"];
     
-    phdmi  [label="HDMI Port"];
-    psdcard  [label="SD Card Slot"];
-    peth [label="1G Ethernet Port"];
+    phdmi  [label="HDMI Port" href="system.html#hdmi"];
+    psdcard  [label="SD Card Slot" href="system.html#mmc"];
+    peth [label="1G Ethernet Port" href="system.html#eth-mac"];
 
-    paudio  [label="Headphone &\nMic Jack"];
+    paudio  [label="Headphone &\nMic Jack" href="system.html#audiojack"];
   }
-  lshift  [label="Level Shifter"];
+  lshift  [label="Level Shifter" href="system.html#mmc"];
   
   //refclk  [label="PCIe Clock Generator"];
   
@@ -184,9 +184,9 @@ digraph G {
       label="Screen Assembly\n ";
       margin="25.0";
 
-      panel  [label="12.5\" 1920x1080\nIPS Panel"];
-      backlight  [label="Backlight"];
-      speakers  [label="Stereo\nSpeakers"];
+      panel  [label="12.5\" 1920x1080\nIPS Panel" href="system.html#panel"];
+      backlight  [label="Backlight" href="system.html#panel"];
+      speakers  [label="Stereo\nSpeakers" href="system.html#speakers"];
     }
     
     subgraph cluster_trackball {
@@ -196,13 +196,13 @@ digraph G {
       label="Trackball\n ";
       margin="25.0";
       
-      tmcu  [label="MCU Atmega32U2" color=black width=3];
-      tsens  [label="Motion Sensor"];
+      tmcu  [label="MCU Atmega32U2" color=black width=3 href="system.html#tbctrl"];
+      tsens  [label="Motion Sensor" href="system.html#tbsensor"];
       
-      ti2c  [label="I2C" shape=diamond style=filled color=lightgrey];
+      ti2c  [label="I2C" shape=diamond style=filled color=lightgrey href="system.html#i2c"];
       tgpio  [label="GPIO" shape=diamond style=filled color=lightgrey];
       
-      tkeys  [label="5 Buttons"];
+      tkeys  [label="5 Buttons" href="system.html#kbkeys"];
     }
 
     subgraph cluster_keyboard {
@@ -212,14 +212,14 @@ digraph G {
       label="Keyboard\n ";
       margin="25.0";
       
-      kmcu  [label="MCU Atmega32U4" color=black width=3];
+      kmcu  [label="MCU Atmega32U4" color=black width=3 href="system.html#kbctrl"];
 
-      oled [label="OLED Display 128x32"];
+      oled [label="OLED Display 128x32" href="system.html#oled"];
       
-      ki2c  [label="I2C" shape=diamond style=filled color=lightgrey];
-      kuart  [label="UART" shape=diamond style=filled color=lightgrey];
+      ki2c  [label="I2C" shape=diamond style=filled color=lightgrey href="system.html#i2c"];
+      kuart  [label="UART" shape=diamond style=filled color=lightgrey  href="system.html#kbctrl"];
       kgpio  [label="GPIO" shape=diamond style=filled color=lightgrey];
-      kkeys  [label="Key Matrix"];
+      kkeys  [label="Key Matrix" href="system.html#kbkeys"];
     }
   }
 

BIN
reform2-handbook/system-diagram.pdf


+ 139 - 1
reform2-handbook/system-diagram.svg

@@ -4,7 +4,7 @@
 <!-- Generated by graphviz version 2.43.0 (0)
  -->
 <!-- Title: G Pages: 1 -->
-<svg width="2058pt" height="1520pt"
+<svg width="100%" 
  viewBox="0.00 0.00 2057.50 1519.80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
 <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 1515.8)">
 <title>G</title>
@@ -89,8 +89,11 @@
 <!-- rtcbat -->
 <g id="node2" class="node">
 <title>rtcbat</title>
+<g id="a_node2"><a xlink:href="system.html#rtc" xlink:title="Coin Cell" target="_top">
 <polygon fill="none" stroke="transparent" points="75,-1219 0,-1219 0,-1183 75,-1183 75,-1219"/>
 <text text-anchor="middle" x="37.5" y="-1197.3" font-family="Inter" font-size="14.00">Coin Cell</text>
+</a>
+</g>
 </g>
 <!-- rtcbat&#45;&gt;rtc -->
 <g id="edge23" class="edge">
@@ -134,8 +137,11 @@
 <!-- phdmi -->
 <g id="node58" class="node">
 <title>phdmi</title>
+<g id="a_node58"><a xlink:href="system.html#hdmi" xlink:title="HDMI Port" target="_top">
 <polygon fill="none" stroke="transparent" points="1522.5,-1145 1436.5,-1145 1436.5,-1109 1522.5,-1109 1522.5,-1145"/>
 <text text-anchor="middle" x="1479.5" y="-1123.3" font-family="Inter" font-size="14.00">HDMI Port</text>
+</a>
+</g>
 </g>
 <!-- hdmi&#45;&gt;phdmi -->
 <g id="edge30" class="edge">
@@ -191,8 +197,11 @@
 <!-- pusb3 -->
 <g id="node54" class="node">
 <title>pusb3</title>
+<g id="a_node54"><a xlink:href="system.html#usb3" xlink:title="USB3 Port 3" target="_top">
 <polygon fill="none" stroke="transparent" points="1536,-1072 1437,-1072 1437,-1036 1536,-1036 1536,-1072"/>
 <text text-anchor="middle" x="1486.5" y="-1050.3" font-family="Inter" font-size="14.00">USB3 Port 3</text>
+</a>
+</g>
 </g>
 <!-- usb0&#45;&gt;pusb3 -->
 <g id="edge29" class="edge">
@@ -234,9 +243,12 @@
 <!-- ram -->
 <g id="node23" class="node">
 <title>ram</title>
+<g id="a_node23"><a xlink:href="system.html#ddrc" xlink:title="LPDDR4\nRAM 4GB" target="_top">
 <polygon fill="none" stroke="black" points="1168.5,-1220 1088.5,-1220 1088.5,-1182 1168.5,-1182 1168.5,-1220"/>
 <text text-anchor="middle" x="1128.5" y="-1204.8" font-family="Inter" font-size="14.00">LPDDR4</text>
 <text text-anchor="middle" x="1128.5" y="-1189.8" font-family="Inter" font-size="14.00">RAM 4GB</text>
+</a>
+</g>
 </g>
 <!-- ddrc&#45;&gt;ram -->
 <g id="edge36" class="edge">
@@ -255,9 +267,12 @@
 <!-- emmc -->
 <g id="node24" class="node">
 <title>emmc</title>
+<g id="a_node24"><a xlink:href="system.html#mmc" xlink:title="eMMC\n~8GB" target="_top">
 <polygon fill="none" stroke="black" points="1258.5,-1220 1186.5,-1220 1186.5,-1182 1258.5,-1182 1258.5,-1220"/>
 <text text-anchor="middle" x="1222.5" y="-1204.8" font-family="Inter" font-size="14.00">eMMC</text>
 <text text-anchor="middle" x="1222.5" y="-1189.8" font-family="Inter" font-size="14.00">~8GB</text>
+</a>
+</g>
 </g>
 <!-- sd1&#45;&gt;emmc -->
 <g id="edge37" class="edge">
@@ -276,8 +291,11 @@
 <!-- lshift -->
 <g id="node62" class="node">
 <title>lshift</title>
+<g id="a_node62"><a xlink:href="system.html#mmc" xlink:title="Level Shifter" target="_top">
 <polygon fill="none" stroke="transparent" points="1524.5,-1219 1424.5,-1219 1424.5,-1183 1524.5,-1183 1524.5,-1219"/>
 <text text-anchor="middle" x="1474.5" y="-1197.3" font-family="Inter" font-size="14.00">Level Shifter</text>
+</a>
+</g>
 </g>
 <!-- sd2&#45;&gt;lshift -->
 <g id="edge31" class="edge">
@@ -296,9 +314,12 @@
 <!-- iuart1 -->
 <g id="node31" class="node">
 <title>iuart1</title>
+<g id="a_node31"><a xlink:href="system.html#uart" xlink:title="UART2\nConsole" target="_top">
 <polygon fill="none" stroke="transparent" points="957.5,-953 885.5,-953 885.5,-915 957.5,-915 957.5,-953"/>
 <text text-anchor="middle" x="921.5" y="-937.8" font-family="Inter" font-size="14.00">UART2</text>
 <text text-anchor="middle" x="921.5" y="-922.8" font-family="Inter" font-size="14.00">Console</text>
+</a>
+</g>
 </g>
 <!-- uart1&#45;&gt;iuart1 -->
 <g id="edge42" class="edge">
@@ -317,8 +338,11 @@
 <!-- impcie -->
 <g id="node34" class="node">
 <title>impcie</title>
+<g id="a_node34"><a xlink:href="system.html#pcie" xlink:title="mPCIe Slot" target="_top">
 <polygon fill="none" stroke="transparent" points="867,-952 778,-952 778,-916 867,-916 867,-952"/>
 <text text-anchor="middle" x="822.5" y="-930.3" font-family="Inter" font-size="14.00">mPCIe Slot</text>
+</a>
+</g>
 </g>
 <!-- pcie0&#45;&gt;impcie -->
 <g id="edge39" class="edge">
@@ -337,9 +361,12 @@
 <!-- im2 -->
 <g id="node35" class="node">
 <title>im2</title>
+<g id="a_node35"><a xlink:href="system.html#pcie" xlink:title="M.2 Slot\nKey M" target="_top">
 <polygon fill="none" stroke="transparent" points="759.5,-953 687.5,-953 687.5,-915 759.5,-915 759.5,-953"/>
 <text text-anchor="middle" x="723.5" y="-937.8" font-family="Inter" font-size="14.00">M.2 Slot</text>
 <text text-anchor="middle" x="723.5" y="-922.8" font-family="Inter" font-size="14.00">Key M</text>
+</a>
+</g>
 </g>
 <!-- pcie1&#45;&gt;im2 -->
 <g id="edge40" class="edge">
@@ -358,8 +385,11 @@
 <!-- iuart0 -->
 <g id="node30" class="node">
 <title>iuart0</title>
+<g id="a_node30"><a xlink:href="system.html#uart" xlink:title="UART1" target="_top">
 <polygon fill="none" stroke="transparent" points="1047.5,-952 975.5,-952 975.5,-916 1047.5,-916 1047.5,-952"/>
 <text text-anchor="middle" x="1011.5" y="-930.3" font-family="Inter" font-size="14.00">UART1</text>
+</a>
+</g>
 </g>
 <!-- uart0&#45;&gt;iuart0 -->
 <g id="edge41" class="edge">
@@ -378,8 +408,11 @@
 <!-- backlight -->
 <g id="node64" class="node">
 <title>backlight</title>
+<g id="a_node64"><a xlink:href="system.html#panel" xlink:title="Backlight" target="_top">
 <polygon fill="none" stroke="transparent" points="520,-722 443,-722 443,-686 520,-686 520,-722"/>
 <text text-anchor="middle" x="481.5" y="-700.3" font-family="Inter" font-size="14.00">Backlight</text>
+</a>
+</g>
 </g>
 <!-- pwm&#45;&gt;backlight -->
 <g id="edge63" class="edge">
@@ -390,14 +423,20 @@
 <!-- ethmac -->
 <g id="node17" class="node">
 <title>ethmac</title>
+<g id="a_node17"><a xlink:href="system.html#eth-mac" xlink:title="ETH MAC" target="_top">
 <polygon fill="none" stroke="transparent" points="948.5,-1219 868.5,-1219 868.5,-1183 948.5,-1183 948.5,-1219"/>
 <text text-anchor="middle" x="908.5" y="-1197.3" font-family="Inter" font-size="14.00">ETH MAC</text>
+</a>
+</g>
 </g>
 <!-- ethphy -->
 <g id="node25" class="node">
 <title>ethphy</title>
+<g id="a_node25"><a xlink:href="system.html#eth-phy" xlink:title="ETH PHY" target="_top">
 <polygon fill="none" stroke="black" points="1212,-1145 1135,-1145 1135,-1109 1212,-1109 1212,-1145"/>
 <text text-anchor="middle" x="1173.5" y="-1123.3" font-family="Inter" font-size="14.00">ETH PHY</text>
+</a>
+</g>
 </g>
 <!-- ethmac&#45;&gt;ethphy -->
 <g id="edge33" class="edge">
@@ -457,8 +496,11 @@
 <!-- lpc -->
 <g id="node36" class="node">
 <title>lpc</title>
+<g id="a_node36"><a xlink:href="system.html#lpc" xlink:title="MCU LPC11U24" target="_top">
 <polygon fill="none" stroke="black" points="1875.5,-795 1587.5,-795 1587.5,-759 1875.5,-759 1875.5,-795"/>
 <text text-anchor="middle" x="1731.5" y="-773.3" font-family="Inter" font-size="14.00">MCU LPC11U24</text>
+</a>
+</g>
 </g>
 <!-- spi1&#45;&gt;lpc -->
 <g id="edge59" class="edge">
@@ -468,8 +510,11 @@
 <!-- peth -->
 <g id="node60" class="node">
 <title>peth</title>
+<g id="a_node60"><a xlink:href="system.html#eth-mac" xlink:title="1G Ethernet Port" target="_top">
 <polygon fill="none" stroke="transparent" points="1680.5,-1072 1554.5,-1072 1554.5,-1036 1680.5,-1036 1680.5,-1072"/>
 <text text-anchor="middle" x="1617.5" y="-1050.3" font-family="Inter" font-size="14.00">1G Ethernet Port</text>
+</a>
+</g>
 </g>
 <!-- ethphy&#45;&gt;peth -->
 <g id="edge34" class="edge">
@@ -485,8 +530,11 @@
 <!-- iusb0 -->
 <g id="node32" class="node">
 <title>iusb0</title>
+<g id="a_node32"><a xlink:href="system.html#usb3" xlink:title="IUSB1" target="_top">
 <polygon fill="none" stroke="transparent" points="1227.5,-952 1155.5,-952 1155.5,-916 1227.5,-916 1227.5,-952"/>
 <text text-anchor="middle" x="1191.5" y="-930.3" font-family="Inter" font-size="14.00">IUSB1</text>
+</a>
+</g>
 </g>
 <!-- hub&#45;&gt;iusb0 -->
 <g id="edge44" class="edge">
@@ -496,8 +544,11 @@
 <!-- iusb1 -->
 <g id="node33" class="node">
 <title>iusb1</title>
+<g id="a_node33"><a xlink:href="system.html#usb3" xlink:title="IUSB2" target="_top">
 <polygon fill="none" stroke="transparent" points="1137.5,-952 1065.5,-952 1065.5,-916 1137.5,-916 1137.5,-952"/>
 <text text-anchor="middle" x="1101.5" y="-930.3" font-family="Inter" font-size="14.00">IUSB2</text>
+</a>
+</g>
 </g>
 <!-- hub&#45;&gt;iusb1 -->
 <g id="edge43" class="edge">
@@ -507,8 +558,11 @@
 <!-- pusb2 -->
 <g id="node55" class="node">
 <title>pusb2</title>
+<g id="a_node55"><a xlink:href="system.html#usb3" xlink:title="USB3 Port 2" target="_top">
 <polygon fill="none" stroke="transparent" points="1660.5,-952 1562.5,-952 1562.5,-916 1660.5,-916 1660.5,-952"/>
 <text text-anchor="middle" x="1611.5" y="-930.3" font-family="Inter" font-size="14.00">USB3 Port 2</text>
+</a>
+</g>
 </g>
 <!-- hub&#45;&gt;pusb2 -->
 <g id="edge28" class="edge">
@@ -518,8 +572,11 @@
 <!-- pusb1 -->
 <g id="node56" class="node">
 <title>pusb1</title>
+<g id="a_node56"><a xlink:href="system.html#usb3" xlink:title="USB3 Port 1" target="_top">
 <polygon fill="none" stroke="transparent" points="1774.5,-952 1678.5,-952 1678.5,-916 1774.5,-916 1774.5,-952"/>
 <text text-anchor="middle" x="1726.5" y="-930.3" font-family="Inter" font-size="14.00">USB3 Port 1</text>
+</a>
+</g>
 </g>
 <!-- hub&#45;&gt;pusb1 -->
 <g id="edge27" class="edge">
@@ -529,9 +586,12 @@
 <!-- paudio -->
 <g id="node61" class="node">
 <title>paudio</title>
+<g id="a_node61"><a xlink:href="system.html#audiojack" xlink:title="Headphone &amp;\nMic Jack" target="_top">
 <polygon fill="none" stroke="transparent" points="1544,-953 1437,-953 1437,-915 1544,-915 1544,-953"/>
 <text text-anchor="middle" x="1490.5" y="-937.8" font-family="Inter" font-size="14.00">Headphone &amp;</text>
 <text text-anchor="middle" x="1490.5" y="-922.8" font-family="Inter" font-size="14.00">Mic Jack</text>
+</a>
+</g>
 </g>
 <!-- adac&#45;&gt;paudio -->
 <g id="edge65" class="edge">
@@ -541,9 +601,12 @@
 <!-- speakers -->
 <g id="node65" class="node">
 <title>speakers</title>
+<g id="a_node65"><a xlink:href="system.html#speakers" xlink:title="Stereo\nSpeakers" target="_top">
 <polygon fill="none" stroke="transparent" points="641,-796 562,-796 562,-758 641,-758 641,-796"/>
 <text text-anchor="middle" x="601.5" y="-780.8" font-family="Inter" font-size="14.00">Stereo</text>
 <text text-anchor="middle" x="601.5" y="-765.8" font-family="Inter" font-size="14.00">Speakers</text>
+</a>
+</g>
 </g>
 <!-- adac&#45;&gt;speakers -->
 <g id="edge64" class="edge">
@@ -553,9 +616,12 @@
 <!-- panel -->
 <g id="node63" class="node">
 <title>panel</title>
+<g id="a_node63"><a xlink:href="system.html#panel" xlink:title="12.5&quot; 1920x1080\nIPS Panel" target="_top">
 <polygon fill="none" stroke="transparent" points="544,-796 419,-796 419,-758 544,-758 544,-796"/>
 <text text-anchor="middle" x="481.5" y="-780.8" font-family="Inter" font-size="14.00">12.5&quot; 1920x1080</text>
 <text text-anchor="middle" x="481.5" y="-765.8" font-family="Inter" font-size="14.00">IPS Panel</text>
+</a>
+</g>
 </g>
 <!-- dsi2edp&#45;&gt;panel -->
 <g id="edge61" class="edge">
@@ -566,8 +632,11 @@
 <!-- kmcu -->
 <g id="node71" class="node">
 <title>kmcu</title>
+<g id="a_node71"><a xlink:href="system.html#kbctrl" xlink:title="MCU Atmega32U4" target="_top">
 <polygon fill="none" stroke="black" points="1280.5,-795 1064.5,-795 1064.5,-759 1280.5,-759 1280.5,-795"/>
 <text text-anchor="middle" x="1172.5" y="-773.3" font-family="Inter" font-size="14.00">MCU Atmega32U4</text>
+</a>
+</g>
 </g>
 <!-- iusb0&#45;&gt;kmcu -->
 <g id="edge45" class="edge">
@@ -577,8 +646,11 @@
 <!-- tmcu -->
 <g id="node66" class="node">
 <title>tmcu</title>
+<g id="a_node66"><a xlink:href="system.html#tbctrl" xlink:title="MCU Atmega32U2" target="_top">
 <polygon fill="none" stroke="black" points="932.5,-795 716.5,-795 716.5,-759 932.5,-759 932.5,-795"/>
 <text text-anchor="middle" x="824.5" y="-773.3" font-family="Inter" font-size="14.00">MCU Atmega32U2</text>
+</a>
+</g>
 </g>
 <!-- iusb1&#45;&gt;tmcu -->
 <g id="edge46" class="edge">
@@ -588,8 +660,11 @@
 <!-- lspi -->
 <g id="node40" class="node">
 <title>lspi</title>
+<g id="a_node40"><a xlink:href="system.html#spi" xlink:title="SPI" target="_top">
 <polygon fill="lightgrey" stroke="lightgrey" points="1681.5,-722 1645.5,-704 1681.5,-686 1717.5,-704 1681.5,-722"/>
 <text text-anchor="middle" x="1681.5" y="-700.3" font-family="Inter" font-size="14.00">SPI</text>
+</a>
+</g>
 </g>
 <!-- lpc&#45;&gt;lspi -->
 <g id="edge1" class="edge">
@@ -599,8 +674,11 @@
 <!-- li2c -->
 <g id="node41" class="node">
 <title>li2c</title>
+<g id="a_node41"><a xlink:href="system.html#i2c" xlink:title="I2C" target="_top">
 <polygon fill="lightgrey" stroke="lightgrey" points="1781.5,-722 1745.5,-704 1781.5,-686 1817.5,-704 1781.5,-722"/>
 <text text-anchor="middle" x="1781.5" y="-700.3" font-family="Inter" font-size="14.00">I2C</text>
+</a>
+</g>
 </g>
 <!-- lpc&#45;&gt;li2c -->
 <g id="edge3" class="edge">
@@ -646,15 +724,21 @@
 <!-- ina -->
 <g id="node37" class="node">
 <title>ina</title>
+<g id="a_node37"><a xlink:href="system.html#ina" xlink:title="Current &amp;\nVoltage Monitor" target="_top">
 <polygon fill="none" stroke="black" points="1860.5,-615 1738.5,-615 1738.5,-577 1860.5,-577 1860.5,-615"/>
 <text text-anchor="middle" x="1799.5" y="-599.8" font-family="Inter" font-size="14.00">Current &amp;</text>
 <text text-anchor="middle" x="1799.5" y="-584.8" font-family="Inter" font-size="14.00">Voltage Monitor</text>
+</a>
+</g>
 </g>
 <!-- cells -->
 <g id="node42" class="node">
 <title>cells</title>
+<g id="a_node42"><a xlink:href="system.html#cells" xlink:title="8x LiFePO4 18650 Batteries" target="_top">
 <polygon fill="none" stroke="transparent" points="1811,-445 1610,-445 1610,-409 1811,-409 1811,-445"/>
 <text text-anchor="middle" x="1710.5" y="-423.3" font-family="Inter" font-size="14.00">8x LiFePO4 18650 Batteries</text>
+</a>
+</g>
 </g>
 <!-- ina&#45;&gt;cells -->
 <g id="edge8" class="edge">
@@ -664,9 +748,12 @@
 <!-- ltc -->
 <g id="node38" class="node">
 <title>ltc</title>
+<g id="a_node38"><a xlink:href="system.html#ltc4020" xlink:title="Buck/Boost\nDC&#45;DC and Charger" target="_top">
 <polygon fill="none" stroke="black" points="1606,-615 1455,-615 1455,-577 1606,-577 1606,-615"/>
 <text text-anchor="middle" x="1530.5" y="-599.8" font-family="Inter" font-size="14.00">Buck/Boost</text>
 <text text-anchor="middle" x="1530.5" y="-584.8" font-family="Inter" font-size="14.00">DC&#45;DC and Charger</text>
+</a>
+</g>
 </g>
 <!-- ltc&#45;&gt;cells -->
 <g id="edge9" class="edge">
@@ -688,9 +775,12 @@
 <!-- mon -->
 <g id="node39" class="node">
 <title>mon</title>
+<g id="a_node39"><a xlink:href="system.html#balancer" xlink:title="Cell Monitor\nBalancer" target="_top">
 <polygon fill="none" stroke="black" points="1720.5,-615 1624.5,-615 1624.5,-577 1720.5,-577 1720.5,-615"/>
 <text text-anchor="middle" x="1672.5" y="-599.8" font-family="Inter" font-size="14.00">Cell Monitor</text>
 <text text-anchor="middle" x="1672.5" y="-584.8" font-family="Inter" font-size="14.00">Balancer</text>
+</a>
+</g>
 </g>
 <!-- mon&#45;&gt;cells -->
 <g id="edge7" class="edge">
@@ -716,9 +806,12 @@
 <!-- supply -->
 <g id="node43" class="node">
 <title>supply</title>
+<g id="a_node43"><a xlink:href="system.html#barreljack" xlink:title="24V Power Supply\nfrom Barrel Jack" target="_top">
 <polygon fill="none" stroke="transparent" points="1592,-446 1455,-446 1455,-408 1592,-408 1592,-446"/>
 <text text-anchor="middle" x="1523.5" y="-430.8" font-family="Inter" font-size="14.00">24V Power Supply</text>
 <text text-anchor="middle" x="1523.5" y="-415.8" font-family="Inter" font-size="14.00">from Barrel Jack</text>
+</a>
+</g>
 </g>
 <!-- supply&#45;&gt;ltc -->
 <g id="edge10" class="edge">
@@ -734,8 +827,11 @@
 <!-- r5v -->
 <g id="node49" class="node">
 <title>r5v</title>
+<g id="a_node49"><a xlink:href="system.html#r5v" xlink:title="5V" target="_top">
 <polygon fill="none" stroke="black" points="1866,-240 1787,-240 1787,-204 1866,-204 1866,-240"/>
 <text text-anchor="middle" x="1826.5" y="-218.3" font-family="Inter" font-size="14.00">5V</text>
+</a>
+</g>
 </g>
 <!-- enab5v&#45;&gt;r5v -->
 <g id="edge12" class="edge">
@@ -746,8 +842,11 @@
 <!-- r3v3 -->
 <g id="node50" class="node">
 <title>r3v3</title>
+<g id="a_node50"><a xlink:href="system.html#r3v3" xlink:title="3V3" target="_top">
 <polygon fill="none" stroke="black" points="1956.5,-240 1884.5,-240 1884.5,-204 1956.5,-204 1956.5,-240"/>
 <text text-anchor="middle" x="1920.5" y="-218.3" font-family="Inter" font-size="14.00">3V3</text>
+</a>
+</g>
 </g>
 <!-- enab3v3&#45;&gt;r3v3 -->
 <g id="edge14" class="edge">
@@ -758,8 +857,11 @@
 <!-- stby -->
 <g id="node48" class="node">
 <title>stby</title>
+<g id="a_node48"><a xlink:href="system.html#standby" xlink:title="3V3 Standby" target="_top">
 <polygon fill="none" stroke="black" points="1768.5,-240 1664.5,-240 1664.5,-204 1768.5,-204 1768.5,-240"/>
 <text text-anchor="middle" x="1716.5" y="-218.3" font-family="Inter" font-size="14.00">3V3 Standby</text>
+</a>
+</g>
 </g>
 <!-- r28v&#45;&gt;stby -->
 <g id="edge17" class="edge">
@@ -800,8 +902,11 @@
 <!-- r1v2 -->
 <g id="node51" class="node">
 <title>r1v2</title>
+<g id="a_node51"><a xlink:href="system.html#r1v2" xlink:title="1V2" target="_top">
 <polygon fill="none" stroke="black" points="1805,-168 1764,-168 1764,-132 1805,-132 1805,-168"/>
 <text text-anchor="middle" x="1784.5" y="-146.3" font-family="Inter" font-size="14.00">1V2</text>
+</a>
+</g>
 </g>
 <!-- r5v&#45;&gt;r1v2 -->
 <g id="edge18" class="edge">
@@ -812,8 +917,11 @@
 <!-- r1v5 -->
 <g id="node52" class="node">
 <title>r1v5</title>
+<g id="a_node52"><a xlink:href="system.html#r1v5" xlink:title="1V5" target="_top">
 <polygon fill="none" stroke="black" points="1864,-168 1823,-168 1823,-132 1864,-132 1864,-168"/>
 <text text-anchor="middle" x="1843.5" y="-146.3" font-family="Inter" font-size="14.00">1V5</text>
+</a>
+</g>
 </g>
 <!-- r5v&#45;&gt;r1v5 -->
 <g id="edge19" class="edge">
@@ -824,8 +932,11 @@
 <!-- r1v8 -->
 <g id="node53" class="node">
 <title>r1v8</title>
+<g id="a_node53"><a xlink:href="system.html#r1v8" xlink:title="1V8" target="_top">
 <polygon fill="none" stroke="black" points="1941,-168 1900,-168 1900,-132 1941,-132 1941,-168"/>
 <text text-anchor="middle" x="1920.5" y="-146.3" font-family="Inter" font-size="14.00">1V8</text>
+</a>
+</g>
 </g>
 <!-- r3v3&#45;&gt;r1v8 -->
 <g id="edge20" class="edge">
@@ -836,14 +947,20 @@
 <!-- pbarrel -->
 <g id="node57" class="node">
 <title>pbarrel</title>
+<g id="a_node57"><a xlink:href="system.html#barreljack" xlink:title="Barrel Jack" target="_top">
 <polygon fill="none" stroke="transparent" points="1762.5,-1145 1672.5,-1145 1672.5,-1109 1762.5,-1109 1762.5,-1145"/>
 <text text-anchor="middle" x="1717.5" y="-1123.3" font-family="Inter" font-size="14.00">Barrel Jack</text>
+</a>
+</g>
 </g>
 <!-- psdcard -->
 <g id="node59" class="node">
 <title>psdcard</title>
+<g id="a_node59"><a xlink:href="system.html#mmc" xlink:title="SD Card Slot" target="_top">
 <polygon fill="none" stroke="transparent" points="1642,-1145 1541,-1145 1541,-1109 1642,-1109 1642,-1145"/>
 <text text-anchor="middle" x="1591.5" y="-1123.3" font-family="Inter" font-size="14.00">SD Card Slot</text>
+</a>
+</g>
 </g>
 <!-- lshift&#45;&gt;psdcard -->
 <g id="edge32" class="edge">
@@ -858,8 +975,11 @@
 <!-- ti2c -->
 <g id="node68" class="node">
 <title>ti2c</title>
+<g id="a_node68"><a xlink:href="system.html#i2c" xlink:title="I2C" target="_top">
 <polygon fill="lightgrey" stroke="lightgrey" points="777.5,-722 741.5,-704 777.5,-686 813.5,-704 777.5,-722"/>
 <text text-anchor="middle" x="777.5" y="-700.3" font-family="Inter" font-size="14.00">I2C</text>
+</a>
+</g>
 </g>
 <!-- tmcu&#45;&gt;ti2c -->
 <g id="edge47" class="edge">
@@ -880,8 +1000,11 @@
 <!-- tsens -->
 <g id="node67" class="node">
 <title>tsens</title>
+<g id="a_node67"><a xlink:href="system.html#tbsensor" xlink:title="Motion Sensor" target="_top">
 <polygon fill="none" stroke="transparent" points="832,-614 719,-614 719,-578 832,-578 832,-614"/>
 <text text-anchor="middle" x="775.5" y="-592.3" font-family="Inter" font-size="14.00">Motion Sensor</text>
+</a>
+</g>
 </g>
 <!-- ti2c&#45;&gt;tsens -->
 <g id="edge48" class="edge">
@@ -891,8 +1014,11 @@
 <!-- tkeys -->
 <g id="node70" class="node">
 <title>tkeys</title>
+<g id="a_node70"><a xlink:href="system.html#kbkeys" xlink:title="5 Buttons" target="_top">
 <polygon fill="none" stroke="transparent" points="930.5,-614 850.5,-614 850.5,-578 930.5,-578 930.5,-614"/>
 <text text-anchor="middle" x="890.5" y="-592.3" font-family="Inter" font-size="14.00">5 Buttons</text>
+</a>
+</g>
 </g>
 <!-- tgpio&#45;&gt;tkeys -->
 <g id="edge50" class="edge">
@@ -902,8 +1028,11 @@
 <!-- ki2c -->
 <g id="node73" class="node">
 <title>ki2c</title>
+<g id="a_node73"><a xlink:href="system.html#i2c" xlink:title="I2C" target="_top">
 <polygon fill="lightgrey" stroke="lightgrey" points="1043.5,-722 1007.5,-704 1043.5,-686 1079.5,-704 1043.5,-722"/>
 <text text-anchor="middle" x="1043.5" y="-700.3" font-family="Inter" font-size="14.00">I2C</text>
+</a>
+</g>
 </g>
 <!-- kmcu&#45;&gt;ki2c -->
 <g id="edge51" class="edge">
@@ -913,8 +1042,11 @@
 <!-- kuart -->
 <g id="node74" class="node">
 <title>kuart</title>
+<g id="a_node74"><a xlink:href="system.html#kbctrl" xlink:title="UART" target="_top">
 <polygon fill="lightgrey" stroke="lightgrey" points="1258.5,-722 1207.89,-704 1258.5,-686 1309.11,-704 1258.5,-722"/>
 <text text-anchor="middle" x="1258.5" y="-700.3" font-family="Inter" font-size="14.00">UART</text>
+</a>
+</g>
 </g>
 <!-- kmcu&#45;&gt;kuart -->
 <g id="edge55" class="edge">
@@ -935,8 +1067,11 @@
 <!-- oled -->
 <g id="node72" class="node">
 <title>oled</title>
+<g id="a_node72"><a xlink:href="system.html#oled" xlink:title="OLED Display 128x32" target="_top">
 <polygon fill="none" stroke="transparent" points="1163,-614 1008,-614 1008,-578 1163,-578 1163,-614"/>
 <text text-anchor="middle" x="1085.5" y="-592.3" font-family="Inter" font-size="14.00">OLED Display 128x32</text>
+</a>
+</g>
 </g>
 <!-- ki2c&#45;&gt;oled -->
 <g id="edge52" class="edge">
@@ -951,8 +1086,11 @@
 <!-- kkeys -->
 <g id="node76" class="node">
 <title>kkeys</title>
+<g id="a_node76"><a xlink:href="system.html#kbkeys" xlink:title="Key Matrix" target="_top">
 <polygon fill="none" stroke="transparent" points="1267.5,-614 1181.5,-614 1181.5,-578 1267.5,-578 1267.5,-614"/>
 <text text-anchor="middle" x="1224.5" y="-592.3" font-family="Inter" font-size="14.00">Key Matrix</text>
+</a>
+</g>
 </g>
 <!-- kgpio&#45;&gt;kkeys -->
 <g id="edge54" class="edge">

+ 280 - 6
reform2-handbook/system.html

@@ -1,4 +1,4 @@
-<h1 id="reform-20d-4-electronic-system-components">Reform 2.0D-4 Electronic System Components</h1>
+<h1 id="mnt-reform-20d-4-electronic-system-components">MNT Reform 2.0D-4 Electronic System Components</h1>
 
 <iframe src="system-diagram.svg" width="75%" height="100%"></iframe>
 <style>
@@ -18,6 +18,10 @@ iframe {
 }
 </style>
 
+<p>This is an interactive block diagram of the MNT Reform open hardware laptop. Click on a  label in the diagram to jump to the corresponding bit of information.</p>
+
+<p>For general information, visit the <a href="https://mntre.com/reform">MNT Reform Website</a>.</p>
+
 <h2 id="system-on-module-boundary-devices-nitrogen8msom">System-on-Module: Boundary Devices Nitrogen8M_SOM</h2>
 
 <p>The default SOM of Reform.</p>
@@ -37,10 +41,6 @@ iframe {
   <li><a href="https://www.nxp.com/webapp/Download?colCode=IMX8MDQLQRM">Reference Manual</a></li>
 </ul>
 
-<p>Some interesting core drivers:
-- drivers/clk/imx/clk-imx8mq.c
--</p>
-
 <h4 id="cortex-a53">Cortex-A53</h4>
 
 <p>The four main 64-bit ARM cores of the default SOC of Reform. The bootloader and operating system usually run on these processors.</p>
@@ -161,7 +161,7 @@ iframe {
 <ul>
   <li>The first controller connects to an eMMC flash disk on the SOM (usually 8GB in size).</li>
   <li>
-    <p>The second controller connects to the SD card slot on the motherboard via a level shifter.</p>
+    <p>The second controller connects to the SD card slot on the motherboard via a level shifter. The level shifter converts between the SoC’s 1.8V and the SD card’s 3.3V signal levels.</p>
   </li>
   <li><a href="https://github.com/torvalds/linux/tree/master/drivers/mmc/host/sdhci-esdhc-imx.c">Driver</a></li>
 </ul>
@@ -186,6 +186,10 @@ iframe {
 
 <p>The PHY part of the Ethernet interface is a chip on the SOM. The default SOM has an Atheros AR8035 PHY, which is driven in Linux by a generic PHY driver.</p>
 
+<ul>
+  <li><a href="https://media.digikey.com/pdf/data%20sheets/csr%20pdfs/ar8035_ds_(atheros)_mar2011.pdf">Datasheet</a></li>
+</ul>
+
 <h2 id="usb-hub">USB Hub</h2>
 
 <p>Reform has a TI TUSB8041 USB Hub chip with four downstream ports, two of which lead to external USB3.0 connectors.</p>
@@ -195,3 +199,273 @@ iframe {
   <li><a href="https://www.ti.com/lit/ds/symlink/tusb8041.pdf?&amp;ts=1590007407171">Datasheet</a></li>
 </ul>
 
+<h2 id="rtc">Battery-Backed Realtime Clock</h2>
+
+<p>The Reform motherboard has a NXP PCF8523T realtime clock chip that is backed by a 3.3V lithium coin cell when the system is unpowered. It is accessed by the SoC via <a href="#i2c">I²C</a>.</p>
+
+<ul>
+  <li><a href="https://www.nxp.com/docs/en/data-sheet/PCF8523.pdf">RTC Datasheet</a></li>
+  <li>Coin cell standard: CR1220</li>
+</ul>
+
+<h2 id="dsi2edp">DSI to eDP Converter</h2>
+
+<p>The Reform motherboard has a TI SN65DSI86 (variant SN65DSI86IPAPQ1) chip that converts <a href="#dsi">MIPI-DSI</a> signals to eDP signals that the built-in <a href="#panel">display panel</a> can understand. The DSI output on the default SOM is available on a flat cable connector. A short, 30 pin FPC cable goes from the SOM into the motherboard’s MIPI-DSI input connector directly below the SOM. The DSI signals are routed from there to the SN65DSI86 chip.</p>
+
+<p>The eDP signals are available on the 2x15 pin, 2mm DuPont header J24. Normally, a cable is plugged into this header, routed through the right-hand screen hinge and it’s IPEX connector side plugged into the display panel.</p>
+
+<ul>
+  <li>Input DSI lanes: 4 + Clock</li>
+  <li>Output eDP lanes: 2 + AUX</li>
+  <li>Color depth: 8 bit per color channel (24 bit per pixel)</li>
+  <li>Standard Resolution: 1920x1080 @ 60 FPS</li>
+  <li><a href="https://www.ti.com/lit/ds/symlink/sn65dsi86-q1.pdf?&amp;ts=1590150753809">SN65DSI86 Datasheet</a></li>
+</ul>
+
+<h2 id="dac">Audio DAC/ADC</h2>
+
+<p>The Audio DAC/ADC converts between the <a href="#sai">digital SAI audio signals</a> and the signals on the <a href="#audiojack">audio jack</a> and the <a href="#speakers">speakers</a>. It can drive both speakers and headphones with independent volumes.</p>
+
+<ul>
+  <li>Model: Cirrus/Wolfson WM8960</li>
+  <li><a href="https://statics.cirrus.com/pubs/proDatasheet/WM8960_v4.4.pdf">Datasheet</a></li>
+</ul>
+
+<h2 id="audiojack">TRRS 3.5mm Audio Jack</h2>
+
+<p>The 3.5mm audio jack, also called a TRRS jack (Tip/Ring/Ring/Sleeve) can be used to connect headphones, an external power amplifier or a headset with integrated microphone.</p>
+
+<p>The audio jack uses the CTIA standard to define which signals are located on which contacts on the plug:</p>
+
+<ul>
+  <li>Tip: Left Speaker</li>
+  <li>First Ring: Right Speaker</li>
+  <li>Second Ring: Microphone</li>
+  <li>Sleeve: Ground</li>
+</ul>
+
+<h2 id="lpc">System Controller</h2>
+
+<p>Except for extreme undervoltage conditions (battery cells below 2.5V), the LPC is always running a C program that implements a state machine which watches over the battery cells and controls their charging and discharging/balancing.</p>
+
+<p>In addition, the LPC can toggle the main power rails in the system on and off via GPIOs going to the relevant voltage converters and load switches.</p>
+
+<p>The LPC can be directly controlled by <a href="#kbctrl">Circle commands given via the keyboard</a>.</p>
+
+<p>Model: NXP LPC11U24</p>
+
+<ul>
+  <li><a href="https://www.nxp.com/docs/en/data-sheet/LPC11U2X.pdf">Datasheet</a></li>
+  <li><a href="https://source.mntmn.com/MNT/reform/src/branch/master/reform2-lpc-fw/src/boards/reform2">Firmware</a></li>
+</ul>
+
+<h2 id="balancer">Cell Monitor/Balancer</h2>
+
+<ul>
+  <li>Model: Analog/Linear LTC6803-4</li>
+  <li><a href="https://www.analog.com/media/en/technical-documentation/data-sheets/680324fa.pdf">Datasheet</a></li>
+</ul>
+
+<h2 id="ina">Battery Voltage/Current Monitor</h2>
+
+<ul>
+  <li>Model: Texas Instruments INA260</li>
+  <li><a href="http://www.ti.com/lit/ds/symlink/ina260.pdf?&amp;ts=1590151953117">Datasheet</a></li>
+</ul>
+
+<h2 id="ltc4020">Buck-Boost DC-DC/Charger</h2>
+
+<ul>
+  <li>Model: Analog/Linear LTC4020</li>
+  <li><a href="https://www.analog.com/media/en/technical-documentation/data-sheets/4020fd.pdf">Datasheet</a></li>
+</ul>
+
+<h2 id="barreljack">Barrel Jack (Wall Power)</h2>
+
+<p>The barrel jack accepts DC voltage in the range of 7V to 32V. The default power supply shipped with MNT Reform is specified at 24V / 2A.</p>
+
+<ul>
+  <li>Receptacle: Switchcraft RAPC712X</li>
+  <li>Inner diameter: 2.5mm</li>
+  <li>Outer diameter: 5.5mm</li>
+  <li>Poles: Positive on inner pole, negative on outer barrel.</li>
+</ul>
+
+<h2 id="r5v">5V Power Rail</h2>
+
+<ul>
+  <li>Type: Buck</li>
+  <li>Model: Texas Instruments LM2677SX-5</li>
+  <li><a href="http://www.ti.com/lit/ds/symlink/lm2677.pdf?&amp;ts=1590152214783">Datasheet</a></li>
+  <li>Max Current: 5A</li>
+</ul>
+
+<h2 id="r3v3">3V3 Power Rail</h2>
+
+<ul>
+  <li>Model: Texas Instruments LM2677SX-3.3</li>
+  <li><a href="http://www.ti.com/lit/ds/symlink/lm2677.pdf?&amp;ts=1590152214783">Datasheet</a></li>
+  <li>Max Current: 5A</li>
+</ul>
+
+<h2 id="standby">3V3 Standby Power Rail</h2>
+
+<ul>
+  <li>Type: Buck</li>
+  <li>Model: Texas Instruments LMR16006YQ3</li>
+  <li><a href="http://www.ti.com/lit/gpn/lmr16006y-q1">Datasheet</a></li>
+</ul>
+
+<h2 id="r1v8">1V8 Power Rail</h2>
+
+<ul>
+  <li>Type: LDO</li>
+  <li>Model: Texas Instruments TLV1117-18</li>
+  <li><a href="http://www.ti.com/lit/ds/symlink/tlv1117.pdf?&amp;ts=1590152118151">Datasheet</a></li>
+</ul>
+
+<h2 id="r1v5">1V5 Power Rail</h2>
+
+<ul>
+  <li>Type: Buck</li>
+  <li>Model: Texas Instruments TLV62568DBV</li>
+  <li><a href="http://www.ti.com/lit/ds/symlink/tlv62568.pdf?&amp;ts=1590152066123">Datasheet</a></li>
+</ul>
+
+<h2 id="r1v2">1V2 Power Rail</h2>
+
+<ul>
+  <li>Type: Buck</li>
+  <li>Model: Texas Instruments TLV62568DBV</li>
+  <li><a href="http://www.ti.com/lit/ds/symlink/tlv62568.pdf?&amp;ts=1590152066123">Datasheet</a></li>
+</ul>
+
+<h2 id="kbctrl">Keyboard Controller</h2>
+
+<ul>
+  <li>Model: Microchip/Atmel Atmega32U4</li>
+  <li><a href="http://ww1.microchip.com/downloads/en/devicedoc/atmel-7766-8-bit-avr-atmega16u4-32u4_datasheet.pdf">Datasheet</a></li>
+  <li><a href="https://source.mntmn.com/MNT/reform/src/branch/master/reform2-keyboard-fw">Firmware</a></li>
+</ul>
+
+<p>The following shortcuts are available indepdently of the main processor in Reform, even when the system is powered off. Acting like a primitive terminal, most shortcuts trigger a command string to be sent over the keyboard’s UART to the <a href="#lpc">LPC</a>. The LPC then responds with characters to display on the <a href="#oled">OLED</a>.</p>
+
+<p>In the 2.0D-3/D-4 development version:</p>
+
+<ul>
+  <li><em>Circle + 1:</em> Turn on the main system (powers up 5V, 3V3 and PCIe rails)</li>
+  <li><em>Circle + 0:</em> Turn off the main system (powers down 5V, 3V3 and PCIe rails)</li>
+  <li><em>Circle + 2:</em> Turn off the OLED display (turned back on by any other command)</li>
+  <li><em>Circle + F1:</em> Decrease keyboard backlight brightness</li>
+  <li><em>Circle + F2:</em> Increase keyboard backlight brightness</li>
+  <li><em>Circle + V:</em> Show voltages of all cells, total voltage and Amps going in or out of batteries plus charge percentage estimation.</li>
+  <li><em>Circle + Y:</em> Show voltage and amps as measured by the <a href="#ina">INA260</a> voltage/current monitor.</li>
+  <li><em>Circle + S:</em> Display LPC status (idle/charging, overvoltage/balancing, undervoltage)</li>
+</ul>
+
+<p>Keep in mind that <em>Circle + 0</em> powers off the system immediately, so save your work and make sure it is synced to disk before powering off. For example, use the <code>sync</code> or <code>shutdown</code> commands.</p>
+
+<h2 id="kbkeys">Keyboard and Trackball Keys</h2>
+
+<p>The keyboard and trackball modules both use the same type of switch.</p>
+
+<ul>
+  <li>Standard Keyswitch Model: Kailh PG1350 Low Profile Choc Brown.</li>
+  <li><a href="https://www.kailhswitch.com/uploads/201915927/CPG135001D02-1_Choc_Burnt_Orange.pdf">PG1350 Datasheet</a></li>
+  <li>Keyboard Keycaps: Kailh Black Low Profile / Choc Keycap 1.5U and 1U.</li>
+</ul>
+
+<p>The trackball has custom keycaps designed by MNT Research and 3D printed in an SLA process.</p>
+
+<ul>
+  <li><a href="https://source.mntmn.com/MNT/reform/src/branch/master/reform2-3d-printed-parts/reform2-stl">Trackball 3D Printed Parts</a></li>
+</ul>
+
+<h2 id="oled">Keyboard OLED</h2>
+
+<p>The OLED display sits on its own little PCB on top of the keyboard, and is powered and controlled by the <a href="#kbctrl">keyboard’s MCU</a> independently from the computer’s main processor.</p>
+
+<p>The display is currently used to show the results of <a href="#kbctrl">Circle commands given via the keyboard</a>.</p>
+
+<ul>
+  <li>Model: Generic SSD1306 128x32 Pixel OLED, Monochrome, I²C Interface</li>
+</ul>
+
+<h2 id="tbctrl">Trackball Controller</h2>
+
+<ul>
+  <li>Model: Microchip/Atmel Atmega32U2</li>
+  <li><a href="http://ww1.microchip.com/downloads/en/DeviceDoc/doc7799.pdf">Datasheet</a></li>
+  <li><a href="https://source.mntmn.com/MNT/reform/src/branch/master/reform2-trackball-fw">Firmware</a></li>
+  <li><a href="https://source.mntmn.com/MNT/reform/src/branch/master/reform2-3d-printed-parts/reform2-stl">Trackball 3D Printed Parts</a></li>
+</ul>
+
+<h2 id="tbsensor">Trackball Sensor</h2>
+
+<ul>
+  <li>Model: Pixart PAT9125EL</li>
+  <li><a href="https://www.codico.com/shop/media/datasheets/PixArt_PAT9125EL_InfoBrief.pdf">Datasheet</a></li>
+</ul>
+
+<h2 id="tpcrtl">Trackpad Controller</h2>
+
+<ul>
+  <li>Model: Microchip/Atmel Atmega32U2</li>
+  <li><a href="https://source.mntmn.com/MNT/reform/src/branch/master/reform2-trackpad-fw">Firmware</a></li>
+</ul>
+
+<h2 id="tpsensor">Trackpad Sensor</h2>
+
+<ul>
+  <li>Model: Azoteq TPS65-201A-S</li>
+  <li><a href="https://www.mouser.de/datasheet/2/42/proxsense_i2c_trackpad_datasheet-1626845.pdf">Datasheet</a></li>
+</ul>
+
+<h2 id="panel">Display Panel</h2>
+
+<p>The display panel is connected to two main types of signals via a single IPEX connector:</p>
+
+<ul>
+  <li>eDP (embedded DisplayPort), via the <a href="#dsi2edp">MIPI-DSI to eDP converter</a></li>
+  <li>
+    <p><a href="#pwm">PWM</a> to set the LED backlight’s brightness. The brightness is set via the duty cycle of the PWM signal, while the frequency is set at a fixed value (default: 10KHz).</p>
+  </li>
+  <li>Model: Innolux N125HCE-GN1</li>
+  <li><a href="http://www.panelook.com/N125HCE-GN1_Innolux_12.5_LCM_overview_28140.html">Panelook Information</a></li>
+</ul>
+
+<h2 id="speakers">Speakers</h2>
+
+<p>Reform uses 2x 8 Ohm, 1 Watt mobile speakers mounted below the <a href="#panel">display panel</a>. They are powered by the <a href="#dac">Audio DAC</a>.</p>
+
+<ul>
+  <li>Model: PUI AS01808AO-3-R</li>
+  <li><a href="http://www.puiaudio.com/pdf/AS01808AO-3-R.pdf">Datasheet</a></li>
+</ul>
+
+<h2 id="cells">Battery Cells</h2>
+
+<p>Reform uses 8 battery cells with LiFePO4 (Lithium Iron Phosphate) chemistry.</p>
+
+<h3 id="important-warnings-of-potential-fire-and-injury-hazards">Important Warnings of Potential Fire and Injury Hazards</h3>
+
+<ul>
+  <li><em>Do not use batteries of any other chemistry in MNT Reform!</em></li>
+  <li><em>Double check polarity of battery cells and make sure they are the right way around!</em></li>
+  <li>
+    <p><em>The cells are connected in series, resulting in a 28.8V total voltage with high current capability. If shorted, traces can easily be burned and sparks could ignite nearby material.</em> - <em>Do not use metal tools or open wires inside of MNT Reform!</em></p>
+  </li>
+  <li>Chemistry: LiFePO4</li>
+  <li>Form Factor: 18650</li>
+  <li>Voltage: 3.2V</li>
+  <li>Cell Charge Voltage: 3.6V</li>
+  <li>Configuration: Series (28.8V)</li>
+</ul>
+
+<h3 id="examples-of-compatible-cells">Examples of compatible cells</h3>
+
+<ul>
+  <li><a href="https://www.batteryspace.com/lifepo4-18650-rechargeable-cell-3-2v-1500-mah-8-4a-rate-4-32wh-ul-listed-un38-3-passed-ndgr.aspx">Battery Space</a></li>
+  <li><a href="https://enerprof.de/akkus/akkus-lifepo4/akkuzellen-lifepo4/akkuzellen-lifepo4-18650/32/enerpower-18650-lifepo4-3-2v-1800-mah?c=26">ENERpower</a></li>
+  <li><a href="https://www.18650batterystore.com/Lithium-Werks-p/lithiumwerks-apr18650m1b.htm">Lithium Werks</a></li>
+</ul>

+ 220 - 6
reform2-handbook/system.md

@@ -1,4 +1,4 @@
-# Reform 2.0D-4 Electronic System Components
+# MNT Reform 2.0D-4 Electronic System Components
 
 <iframe src="system-diagram.svg" width="75%" height="100%"></iframe>
 <style>
@@ -18,6 +18,10 @@ iframe {
 }
 </style>
 
+This is an interactive block diagram of the MNT Reform open hardware laptop. Click on a  label in the diagram to jump to the corresponding bit of information.
+
+For general information, visit the [MNT Reform Website](https://mntre.com/reform).
+
 ## System-on-Module: Boundary Devices Nitrogen8M_SOM
 
 The default SOM of Reform.
@@ -33,10 +37,6 @@ The default SOC of Reform.
 - [Data Sheet](https://www.nxp.com/docs/en/data-sheet/IMX8MDQLQCEC.pdf)
 - [Reference Manual](https://www.nxp.com/webapp/Download?colCode=IMX8MDQLQRM)
 
-Some interesting core drivers:
-- drivers/clk/imx/clk-imx8mq.c
-- 
-
 #### Cortex-A53 {#cortex-a53}
 
 The four main 64-bit ARM cores of the default SOC of Reform. The bootloader and operating system usually run on these processors.
@@ -130,7 +130,7 @@ Reform has 3 external USB 3.0 ports and two internal USB 2.0 ports. All of these
 Reform uses both USDHC MMC/SD controllers of i.MX8M:
 
 - The first controller connects to an eMMC flash disk on the SOM (usually 8GB in size).
-- The second controller connects to the SD card slot on the motherboard via a level shifter.
+- The second controller connects to the SD card slot on the motherboard via a level shifter. The level shifter converts between the SoC's 1.8V and the SD card's 3.3V signal levels.
 
 - [Driver](https://github.com/torvalds/linux/tree/master/drivers/mmc/host/sdhci-esdhc-imx.c)
 
@@ -150,6 +150,8 @@ Ethernet in Reform is made from 3 parts (MAC, PHY and the connector with built-i
 
 The PHY part of the Ethernet interface is a chip on the SOM. The default SOM has an Atheros AR8035 PHY, which is driven in Linux by a generic PHY driver.
 
+- [Datasheet](https://media.digikey.com/pdf/data%20sheets/csr%20pdfs/ar8035_ds_(atheros)_mar2011.pdf)
+
 ## USB Hub {#usb-hub}
 
 Reform has a TI TUSB8041 USB Hub chip with four downstream ports, two of which lead to external USB3.0 connectors.
@@ -157,3 +159,215 @@ Reform has a TI TUSB8041 USB Hub chip with four downstream ports, two of which l
 - [Website](https://www.ti.com/product/TUSB8041)
 - [Datasheet](https://www.ti.com/lit/ds/symlink/tusb8041.pdf?&ts=1590007407171)
 
+## Battery-Backed Realtime Clock {#rtc}
+
+The Reform motherboard has a NXP PCF8523T realtime clock chip that is backed by a 3.3V lithium coin cell when the system is unpowered. It is accessed by the SoC via [I²C](#i2c).
+
+- [RTC Datasheet](https://www.nxp.com/docs/en/data-sheet/PCF8523.pdf)
+- Coin cell standard: CR1220
+
+## DSI to eDP Converter {#dsi2edp}
+
+The Reform motherboard has a TI SN65DSI86 (variant SN65DSI86IPAPQ1) chip that converts [MIPI-DSI](#dsi) signals to eDP signals that the built-in [display panel](#panel) can understand. The DSI output on the default SOM is available on a flat cable connector. A short, 30 pin FPC cable goes from the SOM into the motherboard's MIPI-DSI input connector directly below the SOM. The DSI signals are routed from there to the SN65DSI86 chip.
+
+The eDP signals are available on the 2x15 pin, 2mm DuPont header J24. Normally, a cable is plugged into this header, routed through the right-hand screen hinge and it's IPEX connector side plugged into the display panel.
+
+- Input DSI lanes: 4 + Clock
+- Output eDP lanes: 2 + AUX
+- Color depth: 8 bit per color channel (24 bit per pixel)
+- Standard Resolution: 1920x1080 @ 60 FPS
+- [SN65DSI86 Datasheet](https://www.ti.com/lit/ds/symlink/sn65dsi86-q1.pdf?&ts=1590150753809)
+
+## Audio DAC/ADC {#dac}
+
+The Audio DAC/ADC converts between the [digital SAI audio signals](#sai) and the signals on the [audio jack](#audiojack) and the [speakers](#speakers). It can drive both speakers and headphones with independent volumes.
+
+- Model: Cirrus/Wolfson WM8960
+- [Datasheet](https://statics.cirrus.com/pubs/proDatasheet/WM8960_v4.4.pdf)
+
+## TRRS 3.5mm Audio Jack {#audiojack}
+
+The 3.5mm audio jack, also called a TRRS jack (Tip/Ring/Ring/Sleeve) can be used to connect headphones, an external power amplifier or a headset with integrated microphone. 
+
+The audio jack uses the CTIA standard to define which signals are located on which contacts on the plug:
+
+- Tip: Left Speaker
+- First Ring: Right Speaker
+- Second Ring: Microphone
+- Sleeve: Ground
+
+## System Controller {#lpc}
+
+Except for extreme undervoltage conditions (battery cells below 2.5V), the LPC is always running a C program that implements a state machine which watches over the battery cells and controls their charging and discharging/balancing.
+
+In addition, the LPC can toggle the main power rails in the system on and off via GPIOs going to the relevant voltage converters and load switches.
+
+The LPC can be directly controlled by [Circle commands given via the keyboard](#kbctrl).
+
+Model: NXP LPC11U24
+
+- [Datasheet](https://www.nxp.com/docs/en/data-sheet/LPC11U2X.pdf)
+- [Firmware](https://source.mntmn.com/MNT/reform/src/branch/master/reform2-lpc-fw/src/boards/reform2)
+
+## Cell Monitor/Balancer {#balancer}
+
+- Model: Analog/Linear LTC6803-4
+- [Datasheet](https://www.analog.com/media/en/technical-documentation/data-sheets/680324fa.pdf)
+
+## Battery Voltage/Current Monitor {#ina}
+
+- Model: Texas Instruments INA260
+- [Datasheet](http://www.ti.com/lit/ds/symlink/ina260.pdf?&ts=1590151953117)
+
+## Buck-Boost DC-DC/Charger {#ltc4020}
+
+- Model: Analog/Linear LTC4020
+- [Datasheet](https://www.analog.com/media/en/technical-documentation/data-sheets/4020fd.pdf)
+
+## Barrel Jack (Wall Power) {#barreljack}
+
+The barrel jack accepts DC voltage in the range of 7V to 32V. The default power supply shipped with MNT Reform is specified at 24V / 2A.
+
+- Receptacle: Switchcraft RAPC712X
+- Inner diameter: 2.5mm
+- Outer diameter: 5.5mm
+- Poles: Positive on inner pole, negative on outer barrel.
+
+## 5V Power Rail {#r5v}
+
+- Type: Buck
+- Model: Texas Instruments LM2677SX-5
+- [Datasheet](http://www.ti.com/lit/ds/symlink/lm2677.pdf?&ts=1590152214783)
+- Max Current: 5A
+
+## 3V3 Power Rail {#r3v3}
+
+- Model: Texas Instruments LM2677SX-3.3
+- [Datasheet](http://www.ti.com/lit/ds/symlink/lm2677.pdf?&ts=1590152214783)
+- Max Current: 5A
+
+## 3V3 Standby Power Rail {#standby}
+
+- Type: Buck
+- Model: Texas Instruments LMR16006YQ3
+- [Datasheet](http://www.ti.com/lit/gpn/lmr16006y-q1)
+
+## 1V8 Power Rail {#r1v8}
+
+- Type: LDO
+- Model: Texas Instruments TLV1117-18
+- [Datasheet](http://www.ti.com/lit/ds/symlink/tlv1117.pdf?&ts=1590152118151)
+
+## 1V5 Power Rail {#r1v5}
+
+- Type: Buck
+- Model: Texas Instruments TLV62568DBV
+- [Datasheet](http://www.ti.com/lit/ds/symlink/tlv62568.pdf?&ts=1590152066123)
+
+## 1V2 Power Rail {#r1v2}
+
+- Type: Buck
+- Model: Texas Instruments TLV62568DBV
+- [Datasheet](http://www.ti.com/lit/ds/symlink/tlv62568.pdf?&ts=1590152066123)
+
+## Keyboard Controller {#kbctrl}
+
+- Model: Microchip/Atmel Atmega32U4
+- [Datasheet](http://ww1.microchip.com/downloads/en/devicedoc/atmel-7766-8-bit-avr-atmega16u4-32u4_datasheet.pdf)
+- [Firmware](https://source.mntmn.com/MNT/reform/src/branch/master/reform2-keyboard-fw)
+
+The following shortcuts are available indepdently of the main processor in Reform, even when the system is powered off. Acting like a primitive terminal, most shortcuts trigger a command string to be sent over the keyboard's UART to the [LPC](#lpc). The LPC then responds with characters to display on the [OLED](#oled).
+
+In the 2.0D-3/D-4 development version:
+
+- *Circle + 1:* Turn on the main system (powers up 5V, 3V3 and PCIe rails)
+- *Circle + 0:* Turn off the main system (powers down 5V, 3V3 and PCIe rails)
+- *Circle + 2:* Turn off the OLED display (turned back on by any other command)
+- *Circle + F1:* Decrease keyboard backlight brightness
+- *Circle + F2:* Increase keyboard backlight brightness
+- *Circle + V:* Show voltages of all cells, total voltage and Amps going in or out of batteries plus charge percentage estimation.
+- *Circle + Y:* Show voltage and amps as measured by the [INA260](#ina) voltage/current monitor.
+- *Circle + S:* Display LPC status (idle/charging, overvoltage/balancing, undervoltage)
+
+Keep in mind that *Circle + 0* powers off the system immediately, so save your work and make sure it is synced to disk before powering off. For example, use the `sync` or `shutdown` commands.
+
+## Keyboard and Trackball Keys {#kbkeys}
+
+The keyboard and trackball modules both use the same type of switch.
+
+- Standard Keyswitch Model: Kailh PG1350 Low Profile Choc Brown.
+- [PG1350 Datasheet](https://www.kailhswitch.com/uploads/201915927/CPG135001D02-1_Choc_Burnt_Orange.pdf)
+- Keyboard Keycaps: Kailh Black Low Profile / Choc Keycap 1.5U and 1U.
+
+The trackball has custom keycaps designed by MNT Research and 3D printed in an SLA process.
+
+- [Trackball 3D Printed Parts](https://source.mntmn.com/MNT/reform/src/branch/master/reform2-3d-printed-parts/reform2-stl)
+
+## Keyboard OLED {#oled}
+
+The OLED display sits on its own little PCB on top of the keyboard, and is powered and controlled by the [keyboard's MCU](#kbctrl) independently from the computer's main processor.
+
+The display is currently used to show the results of [Circle commands given via the keyboard](#kbctrl).
+
+- Model: Generic SSD1306 128x32 Pixel OLED, Monochrome, I²C Interface
+
+## Trackball Controller {#tbctrl}
+
+- Model: Microchip/Atmel Atmega32U2
+- [Datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/doc7799.pdf)
+- [Firmware](https://source.mntmn.com/MNT/reform/src/branch/master/reform2-trackball-fw)
+- [Trackball 3D Printed Parts](https://source.mntmn.com/MNT/reform/src/branch/master/reform2-3d-printed-parts/reform2-stl)
+
+## Trackball Sensor {#tbsensor}
+
+- Model: Pixart PAT9125EL
+- [Datasheet](https://www.codico.com/shop/media/datasheets/PixArt_PAT9125EL_InfoBrief.pdf)
+
+## Trackpad Controller {#tpcrtl}
+
+- Model: Microchip/Atmel Atmega32U2
+- [Firmware](https://source.mntmn.com/MNT/reform/src/branch/master/reform2-trackpad-fw)
+
+## Trackpad Sensor {#tpsensor}
+
+- Model: Azoteq TPS65-201A-S
+- [Datasheet](https://www.mouser.de/datasheet/2/42/proxsense_i2c_trackpad_datasheet-1626845.pdf)
+
+## Display Panel {#panel}
+
+The display panel is connected to two main types of signals via a single IPEX connector:
+
+- eDP (embedded DisplayPort), via the [MIPI-DSI to eDP converter](#dsi2edp)
+- [PWM](#pwm) to set the LED backlight's brightness. The brightness is set via the duty cycle of the PWM signal, while the frequency is set at a fixed value (default: 10KHz).
+
+- Model: Innolux N125HCE-GN1
+- [Panelook Information](http://www.panelook.com/N125HCE-GN1_Innolux_12.5_LCM_overview_28140.html)
+
+## Speakers {#speakers}
+
+Reform uses 2x 8 Ohm, 1 Watt mobile speakers mounted below the [display panel](#panel). They are powered by the [Audio DAC](#dac).
+
+- Model: PUI AS01808AO-3-R
+- [Datasheet](http://www.puiaudio.com/pdf/AS01808AO-3-R.pdf)
+
+## Battery Cells {#cells}
+
+Reform uses 8 battery cells with LiFePO4 (Lithium Iron Phosphate) chemistry.
+
+### Important Warnings of Potential Fire and Injury Hazards
+
+- *Do not use batteries of any other chemistry in MNT Reform!*
+- *Double check polarity of battery cells and make sure they are the right way around!*
+- *The cells are connected in series, resulting in a 28.8V total voltage with high current capability. If shorted, traces can easily be burned and sparks could ignite nearby material.* - *Do not use metal tools or open wires inside of MNT Reform!*
+
+- Chemistry: LiFePO4
+- Form Factor: 18650
+- Voltage: 3.2V
+- Cell Charge Voltage: 3.6V
+- Configuration: Series (28.8V)
+
+### Examples of compatible cells
+
+- [Battery Space](https://www.batteryspace.com/lifepo4-18650-rechargeable-cell-3-2v-1500-mah-8-4a-rate-4-32wh-ul-listed-un38-3-passed-ndgr.aspx)
+- [ENERpower](https://enerprof.de/akkus/akkus-lifepo4/akkuzellen-lifepo4/akkuzellen-lifepo4-18650/32/enerpower-18650-lifepo4-3-2v-1800-mah?c=26)
+- [Lithium Werks](https://www.18650batterystore.com/Lithium-Werks-p/lithiumwerks-apr18650m1b.htm)

+ 5 - 5
reform2-keyboard-fw/Keyboard.c

@@ -122,7 +122,7 @@ int remote_receive_string(int print) {
     while (chr==-1 || chr==0) {
       chr=Serial_ReceiveByte();
       clock++;
-      if (clock>100000) goto timeout;
+      if (clock>500000) goto timeout;
     }
     int poke_chr = chr;
     if (chr=='\n') poke_chr=' ';
@@ -229,7 +229,7 @@ void remote_get_voltages(void) {
   Serial_SendByte('\r');
   Delay_MS(1);
   remote_receive_string(0);
-  bat_amps = -((float)atoi(response))/1000.0;
+  bat_amps = ((float)atoi(response))/1000.0;
 
   float sum_volts = 0;
 
@@ -256,17 +256,17 @@ void remote_get_voltages(void) {
   if (percentage<0) percentage = 0;
   char str[32];
   
-  sprintf(str,"[] %.1f  [] %.1f",voltages[0],voltages[4]);
+  sprintf(str,"[] %.1f  [] %.1f  %d%%",voltages[0],voltages[4],(int)percentage);
   insert_bat_icon(str,0,voltages[0]);
   insert_bat_icon(str,8,voltages[4]);
   gfx_poke_str(0,0,str);
   
-  sprintf(str,"[] %.1f  [] %.1f  %d%%",voltages[1],voltages[5],(int)percentage);
+  sprintf(str,"[] %.1f  [] %.1f  ",voltages[1],voltages[5]);
   insert_bat_icon(str,0,voltages[1]);
   insert_bat_icon(str,8,voltages[5]);
   gfx_poke_str(0,1,str);
   
-  sprintf(str,"[] %.1f  [] %.1f  %.2fA",voltages[2],voltages[6],bat_amps);
+  sprintf(str,"[] %.1f  [] %.1f  %.2fA",voltages[2],voltages[6],-bat_amps);
   insert_bat_icon(str,0,voltages[2]);
   insert_bat_icon(str,8,voltages[6]);
   gfx_poke_str(0,2,str);