示例#1
0
#!/usr/bin/python3

import sys
import cgi
import cgitb
cgitb.enable()  # for troubleshooting

sys.path.insert(0, '/home/root/brain-fs/www/common')
import brain

from subprocess import call
call("cat /home/root/brain-fs/camera/syzygy_hub_camera.bit > /dev/xdevcfg",
     shell=True)
call("/home/root/brain-fs/camera/software/camera_regs.sh", shell=True)

brain.www_print_head("Camera Example", "")
brain.www_print_title("Camera Example",
                      "Image capture example for the POD-CAMERA")

brain.www_start_section()
print("""
  <p>FPGA has been configured with the camera example configuration.</p>
  <p><a href="/camera/">&larr; Go back to the camera example index</a></p>
""")
brain.www_end_section()

brain.www_print_foot()
示例#2
0
#!/usr/bin/python3

import sys
import cgi
import cgitb
cgitb.enable()  # for troubleshooting

sys.path.insert(0, '/home/root/brain-fs/www/common')
import brain

brain.www_print_head("Simple Scope", "")
brain.www_print_title("Simple Scope",
                      "A simple data acquisition app for the POD-ADC-LT226x")

brain.www_start_section()
print("""
  <ol>
    <li>Make sure the ADC peripheral is on <strong>SYZYGY Port D</strong></li>
    <li><a href="/simple-scope/setup.py">Configure the simple scope bitfile</a></li>
    <li><a href="/simple-scope/acquire.py">Acquire an input waveform</a></li>
  </ol>
""")
brain.www_end_section()

brain.www_print_foot()
示例#3
0
#!/usr/bin/python3

import sys
import cgi
import cgitb
cgitb.enable()  # for troubleshooting

sys.path.insert(0, '/home/root/brain-fs/www/common')
import brain

brain.www_print_head("Waveform Generator", "")
brain.www_print_title("Waveform Generator",
                      "A simple waveform generator for the POD-DAC-AD9116")

brain.www_start_section()
print("""
  <ol>
    <li>Make sure the DAC peripheral is on <strong>SYZYGY Port A</strong></li>
    <li><a href="/waveform-generator/setup.py">Configure the waveform generator bitfile</a></li>
    <li><a href="/waveform-generator/set-waveform.py">Set the output waveform</a></li>
  </ol>
""")
brain.www_end_section()

brain.www_print_foot()
示例#4
0
sys.path.insert(0, '/home/root/brain-fs/www/common')
import brain

# Query SmartVIO peripherals
from subprocess import call
try:
    svio = subprocess.check_output("/usr/bin/smartvio -j /dev/i2c-1",
                                   shell=True)
except subprocess.CalledProcessError as e:
    print(e.output)
print(svio.decode('utf-8'))
svioj = json.loads(svio.decode('utf-8'))
svio_ports = svioj["port"]
svio_vio = svioj["vio"]

brain.www_print_head("SYZYGY Status", "")
brain.www_print_title("SYZYGY Status",
                      "Shows system SYZYGY peripheral information.")

brain.www_start_section()

print("""
        <div class="container text-content">
          <div class="row">
            <div class="col-sm-12 mb-md">
              <div class="col-sm-12 table-responsive">
              <table class="table table-datatable">
                <thead>
                  <tr>
                    <th>Parameter</th>
                    <th>Port A</th>
示例#5
0
#!/usr/bin/python3

import sys
import cgi
import cgitb; cgitb.enable();

sys.path.insert(0, '/home/root/brain-fs/www/common')
import brain


# Configure the FPGA
from subprocess import call
call("cat /home/root/brain-fs/helloworld/syzygy-helloworld.bit >/dev/xdevcfg", shell=True)


brain.www_print_head("Hello World", "")
brain.www_print_title("Hello World", "A simple starter application to motivate you.")

brain.www_start_section()
print("""
Each time you reload this page, the FPGA will be reconfigured with the hello world bitfile.
""")
brain.www_end_section()

brain.www_print_foot()

示例#6
0
call("/home/root/brain-fs/camera/software/capture_single >/dev/null",
     shell=True)
call(
    "/usr/bin/bayer2rgb -i capture.bin -o output.tiff -w 2304 -v 1296 -b 8 -f GRBG -m NEAREST -t",
    shell=True)
call("/usr/bin/convert -quality 85% output.tiff output.jpg 2>/dev/null",
     shell=True)

try:
    os.stat(cwd + "/output.jpg")
except:
    os.symlink("/tmp/camera/output.jpg", cwd + "/output.jpg")

args = cgi.FieldStorage()
if ("auto" in args):
    brain.www_print_head("Camera Example",
                         '<meta http-equiv="refresh" content="0">')
else:
    brain.www_print_head("Camera Example", "")

brain.www_print_title("Camera Example",
                      "Image capture example for the POD-CAMERA")

brain.www_start_section()
print("""
  <p><a href="/camera/capture.py" class="button button-sm button-secondary">Single Capture</a>
  <a href="/camera/capture.py?auto=1" class="button button-sm button-secondary">Auto Capture (~4 second interval)</a><br />
  <a href="/camera/">&larr; Go back to the camera example index</a></p>
""")
brain.www_end_section()

print('<img src="output.jpg" width="1152" height="648">')