write out to mdwn file instead of stdout
[pinmux.git] / src / spec / minitest.py
index dc91d14a4151c6fc6ead305cbadea337c9173ea5..5820d54cdd983c0e2d3d1f0dcd67055e0b1e2805 100644 (file)
@@ -6,7 +6,7 @@ from spec.ifaceprint import display, display_fns, check_functions
 from spec.ifaceprint import display_fixed
 
 
-def pinspec():
+def pinspec(of):
     pinbanks = {
         'B': 28,
     }
@@ -41,14 +41,15 @@ def pinspec():
     pinouts.uart("1", ('B', 2), "B", 2)
     pinouts.uart("2", ('B', 14), "B", 2)
 
-    print ("""# Pinouts (PinMux)
+    of.write("""# Pinouts (PinMux)
 auto-generated by [[pinouts.py]]
 
 [[!toc  ]]
+
 """)
-    display(pinouts)
+    display(of, pinouts)
 
-    print ("\n# Pinouts (Fixed function)\n")
+    of.write("\n# Pinouts (Fixed function)\n\n")
 
     fixedpins = {
         'CTRL_SYS': [
@@ -71,11 +72,12 @@ auto-generated by [[pinouts.py]]
             'GND_GPIOB',
         ]}
 
-    fixedpins = display_fixed(fixedpins, len(pinouts))
+    fixedpins = display_fixed(of, fixedpins, len(pinouts))
 
-    print ("""# Functions (PinMux)
+    of.write("""# Functions (PinMux)
 
 auto-generated by [[pinouts.py]]
+
 """)
 
     function_names = {'EINT': 'External Interrupt',
@@ -106,8 +108,8 @@ auto-generated by [[pinouts.py]]
                       'ULPI2': 'ULPI (USB Low Pin-count) 2',
                       }
 
-    fns = display_fns(bankspec, pinouts, function_names)
-    print
+    fns = display_fns(of, bankspec, pinouts, function_names)
+    of.write("\n")
 
     # Scenarios below can be spec'd out as either "find first interface"
     # by name/number e.g. SPI1, or as "find in bank/mux" which must be
@@ -133,11 +135,11 @@ auto-generated by [[pinouts.py]]
         'ULPI1': 'dual USB2 Host ULPI PHY'
     }
 
-    unused_pins = check_functions("MiniTest", bankspec, fns, pinouts,
+    unused_pins = check_functions(of, "MiniTest", bankspec, fns, pinouts,
                                   minitest, minitest_eint, minitest_pwm,
                                   descriptions)
 
-    print ("""# Reference Datasheets
+    of.write("""# Reference Datasheets
 
 datasheets and pinout links
 * <http://datasheets.chipdb.org/AMD/8018x/80186/amd-80186.pdf>
@@ -149,6 +151,7 @@ datasheets and pinout links
 * <https://www.nxp.com/docs/en/data-sheet/MCF54418.pdf>
 * ULPI OTG PHY, ST <http://www.st.com/en/interfaces-and-transceivers/stulpi01a.html>
 * ULPI OTG PHY, TI TUSB1210 <http://ti.com/product/TUSB1210/>
+
 """)
 
     return pinouts, bankspec, pinbanks, fixedpins