コード例 #1
0
 def join(self):
     logging.debug("joining")
     self.running = False
     self.t.join()        
     self.ddr_mem.close()                                    # Close the memory        
     pypruss.pru_disable(0)                                  # Disable PRU 0, this is already done by the firmware
     pypruss.exit()                                          # Exit, don't know what this does. 
コード例 #2
0
ファイル: servos.py プロジェクト: Miaou/BBB
 def __del__(self):
     # Hope we get there
     print('Closing the PRU interface')
     pypruss.pru_disable(0) # Does not wait for program to complete, I don't care here
     pypruss.exit()
     self.pruicss.close()
     self.mem_fd.close()
コード例 #3
0
ファイル: servos.py プロジェクト: Miaou/BBB
 def __del__(self):
     # Hope we get there
     print('Closing the PRU interface')
     pypruss.pru_disable(
         0)  # Does not wait for program to complete, I don't care here
     pypruss.exit()
     self.pruicss.close()
     self.mem_fd.close()
コード例 #4
0
 def __del__(self):
     global OneWire  # Hack: sometimes OneWire is deleted before self
     if not OneWire:
         OneWire = self._keepalive
     OneWire.nInstances -= 1
     if not OneWire.nInstances:
         print('Exiting PRU program')
         pypruss.pru_disable(0)
         pypruss.exit()
コード例 #5
0
ファイル: dallas.py プロジェクト: Miaou/BBB
 def __del__(self):
     global OneWire # Hack: sometimes OneWire is deleted before self
     if not OneWire:
         OneWire = self._keepalive
     OneWire.nInstances -= 1
     if not OneWire.nInstances:
         print('Exiting PRU program')
         pypruss.pru_disable(0)
         pypruss.exit()
コード例 #6
0
ファイル: pru_stick.py プロジェクト: pbrook/beagle-football
 def __init__(self, prog):
     self.val = {}
     pypruss.modprobe()
     pypruss.init()
     pypruss.open(event_nr)
     pypruss.pruintc_init()
     pypruss.pru_disable(1)
     self.data = pypruss.map_prumem(pypruss.PRUSS0_PRU1_DATARAM)
     self.write32(COM_RANGE, 0)
     pypruss.exec_program(1, prog)
コード例 #7
0
ファイル: backlight.py プロジェクト: nycresistor/TotU
    def stop(self):
        print("Ending")
        # Set our command byte to FF and write it out
        self.data[0] = 0x000000FF
        pypruss.pru_write_memory(0, 0, self.data)

        # Wait for event 0 which is connected to PRU0_ARM_INTERRUPT
        pypruss.wait_for_event(0)
        # Clear the event
        pypruss.clear_event(0)
        # Disable PRU 0, this is already done by the firmware
        pypruss.pru_disable(0)
        # Exit, don't know what this does.
        pypruss.exit()
コード例 #8
0
ファイル: backlight.py プロジェクト: nycresistor/TotU
	def stop(self):
		print("Ending")
		# Set our command byte to FF and write it out
		self.data[0] = 0x000000FF
		pypruss.pru_write_memory(0, 0, self.data)

		# Wait for event 0 which is connected to PRU0_ARM_INTERRUPT
		pypruss.wait_for_event(0)
		# Clear the event
		pypruss.clear_event(0)
		# Disable PRU 0, this is already done by the firmware
		pypruss.pru_disable(0)
		# Exit, don't know what this does.
		pypruss.exit()
コード例 #9
0
def moveStepper_p9_15(steps):
    pypruss.modprobe()
    pypruss.init()
    pypruss.open(0)  # Open PRU event 0 which is PRU0_ARM_INTERRUPT
    pypruss.pruintc_init()  # Init the interrupt controller

    setSteps(steps)

    pypruss.exec_program(
        0, "./pru/p9_15.bin")  # Load firmware "blinkled.bin" on PRU 0
    pypruss.wait_for_event(
        0)  # Wait for event 0 which is connected to PRU0_ARM_INTERRUPT
    pypruss.clear_event(0)  # Clear the event
    pypruss.pru_disable(
        0)  # Disable PRU 0, this is already done by the firmware
    pypruss.exit()  # Exit, don't know what this does.
コード例 #10
0
ファイル: Pru.py プロジェクト: zittix/redeem
    def emergency_interrupt(self):
        pypruss.pru_disable(0)                                  # Disable PRU 0, this is already done by the firmware
        pypruss.exit()                                          # Exit, don't know what this does. 
        logging.debug('Resetting PRU...')
      
        self.pru_data       = []

        while True:
            try:
                b = self.ddr_used.get(block=False)
                if b != None:
                    self.ddr_used.task_done()
            except Queue.Empty:
                break

        self.ddr_reserved   = 0      
        with Pru.ddr_lock: 
            self.ddr_mem_used   = 0  
        self.clear_events   = []       
        self.ddr_start      = self.DDR_START
        self.ddr_nr_events  = self.ddr_addr+self.ddr_size-4

        self.init_pru()
コード例 #11
0
def end():
    pypruss.pru_disable(0)
    pypruss.exit()
コード例 #12
0
ファイル: blinkled.py プロジェクト: Agoa/pypruss
''' blinkled.py - test script for the PyPRUSS library
It blinks the user leds ten times'''

import pypruss

pypruss.modprobe() 			  				       	# This only has to be called once pr boot
pypruss.init()										# Init the PRU
pypruss.open(0)										# Open PRU event 0 which is PRU0_ARM_INTERRUPT
pypruss.pruintc_init()								# Init the interrupt controller
pypruss.exec_program(0, "./blinkled.bin")			# Load firmware "blinkled.bin" on PRU 0
pypruss.wait_for_event(0)							# Wait for event 0 which is connected to PRU0_ARM_INTERRUPT
pypruss.clear_event(0)								# Clear the event
pypruss.pru_disable(0)								# Disable PRU 0, this is already done by the firmware
pypruss.exit()										# Exit, don't know what this does. 
コード例 #13
0
ファイル: stepper.py プロジェクト: miaoqqqq123/quickstep
#      self.rest = 0
      pass

steps, speed, acc, dec = (float(arg) for arg in sys.argv[1:5])

if sim:
  fifo = SimFifo()
else:
  fifo = init('./stepper.bin')

stepper = Stepper(fifo)
stepper.move(steps, speed, acc, dec)

if not sim:
  fifo.write([0,0,0,0])

  olda = fifo.front()
  while True:
    a = fifo.front()
    if not olda == a:
      print 'front:',a
      olda = a
    if a == fifo.back:
      break
    time.sleep(0.1)

  pypruss.wait_for_event(0)
  pypruss.clear_event(0)
  pypruss.pru_disable(0)
  pypruss.exit()
コード例 #14
0
    def stop_pru(self):

        pypruss.pru_disable(0)
        pypruss.exit()
        return 0
コード例 #15
0
 def stop(self):
     logging.debug("[ADC] Stopping the PRUs")
     struct.pack_into('L', self._data, self.PRU0_OFFSET_RES1, 0xdeadbeef)
     time.sleep(0.5)
     pypruss.pru_disable(0)
コード例 #16
0
    print percentChange
    #Now we've compared. Let's write the most recent speed to our file.
    f = open('speed.txt', 'w')
    f.write(speed[0])
    f.close()

    pypruss.modprobe()  # This only has to be called once pr boot
    pypruss.init()  # Init the PRU
    pypruss.open(0)  # Open PRU event 0 which is PRU0_ARM_INTERRUPT
    pypruss.pruintc_init()  # Init the interrupt controller

    if percentChange < -5:
        pypruss.exec_program(0, "./red.bin")
    else:
        if percentChange < 0:
            pypruss.exec_program(0, "./orange.bin")
        else:
            if percentChange > 0:
                pypruss.exec_program(0, "./green.bin")
            else:
                pypruss.exec_program(0, "./other.bin")  #should never hit this

    pypruss.wait_for_event(
        0)  # Wait for event 0 which is connected to PRU0_ARM_INTERRUPT
    pypruss.clear_event(0)  # Clear the event
    pypruss.pru_disable(
        0)  # Disable PRU 0, this is already done by the firmware
    pypruss.exit()  # Exits pypruss
    time.sleep(interval)  # restarts speed evaluation after 'interval' seconds
コード例 #17
0
ファイル: Pru.py プロジェクト: zittix/redeem
 def force_exit(self):
     self.running = False  
     pypruss.pru_disable(0)                                  # Disable PRU 0, this is already done by the firmware
     pypruss.exit()                                          # Exit, don't know what this does. 
コード例 #18
0
ファイル: pypruss_test.py プロジェクト: AhmedSamara/bot-1
def cleanup(signum, frame):
    pypruss.pru_disable(0)
    pypruss.exit()                                # Exit
    sys.exit()
コード例 #19
0
ファイル: pru_stick.py プロジェクト: pbrook/beagle-football
 def stop(self):
     pypruss.pru_disable(1)				# Disable PRU 1, this is already done by the firmware
     pypruss.exit()
     self.data = None
コード例 #20
0
ファイル: pypruss_test.py プロジェクト: AhmedSamara/bot-1
def cleanup(signum, frame):
    pypruss.pru_disable(0)
    pypruss.exit()  # Exit
    sys.exit()
コード例 #21
0
ファイル: pru-enable.py プロジェクト: normansaez/lotuce2
#!/usr/bin/python
import os
import argparse
import pypruss

from math import ceil

if __name__ == '__main__':
    pru = 0
    firmware = "./clock.bin"
    pypruss.modprobe()                                  # This only has to be called once pr boot
    pypruss.init()                                      # Init the PRU
    pypruss.open(pru)                                   # Open PRU event <num> which is PRU<num>_ARM_INTERRUPT
    pypruss.pruintc_init()                              # Init the interrupt controller
    pypruss.exec_program(pru, firmware)                 # Load firmware on PRU <num>
    pypruss.wait_for_event(pru)                         # Wait for event <num> which is connected to PRU<num>_ARM_INTERRUPT
    pypruss.clear_event(pru)                            # Clear the event
    pypruss.pru_disable(pru)                            # Disable PRU <num>, this is already done by the firmware
    pypruss.exit()                                      # Exit, don't know what this does.