예제 #1
0
    # fw = Firmware(path.join(modulePath, "avr", "Button", "Release", "Button.elf")
    print("Loading {}".format(fw.filename))

    avr = Avr(firmware=fw)  # The Button.elf has mcu and freq info embedded
    # avr = Avr(firmware=fw, mcu='atmega2560', f_cpu=8000000)
    # avr = Avr(firmware=fw, mcu='attiny2313', f_cpu=8000000)

    print("Fw loaded")

    # Set the GDB port and start simavr GDB
    avr.gdb_port = 1234
    avr_gdb_init(avr.backend)
    # avr.state = cpu_Stopped #To let simavr wait on the first instruction for GDB to connect.

    # Get the AVR A3 input pin.
    A3IRQ = avr.getirq(('A', 3))

    # Create simavr inbuilt button part.
    b = Button(avr)

    # Get the button's output port and attach it to the AVR input.
    pysimavr.connect.avr_connect_irq(b.getirq(0), A3IRQ)

    prevState = -1
    i = 0

    # Main loop.
    try:
        while True:

            # Do multiple simavr simulation steps synchronously.
예제 #2
0
파일: button.py 프로젝트: ponty/pysimavr
    # fw = Firmware(path.join(modulePath, "avr", "Button", "Release", "Button.elf")
    print("Loading {}".format(fw.filename))
    
    avr = Avr(firmware=fw)  # The Button.elf has mcu and freq info embedded
    # avr = Avr(firmware=fw, mcu='atmega2560', f_cpu=8000000)
    # avr = Avr(firmware=fw, mcu='attiny2313', f_cpu=8000000)  
          
    print("Fw loaded")
    
    # Set the GDB port and start simavr GDB
    avr.gdb_port = 1234;
    avr_gdb_init(avr.backend)
    # avr.state = cpu_Stopped #To let simavr wait on the first instruction for GDB to connect. 
    
    # Get the AVR A3 input pin.
    A3IRQ = avr.getirq(('A', 3));
    
    # Create simavr inbuilt button part.
    b = Button(avr); 
    
    # Get the button's output port and attach it to the AVR input.
    pysimavr.connect.avr_connect_irq(b.getirq(0), A3IRQ)
    
    prevState = -1
    i = 0
 
    # Main loop. 
    try:
        while True:
        
            # Do multiple simavr simulation steps synchronously.