Esempio n. 1
0
class TetheredJ1b(swapforth.TetheredTarget):
    cellsize = 4

    def open_ser(self, port, speed):
        self.ser = vsimj1b.vsimj1b()

    def reset(self):
        ser = self.ser
        ser.reset()
        if 0:
            for c in '    1 tth !':
                ser.write(c)
            ser.write('\r')

        while 1:
            c = ser.read(1)
            print repr(c)
            if c == chr(30):
                break

    def boot(self, bootfile = None):
        sys.stdout.write('Contacting... ')
        self.reset()
        print 'established'

    def interrupt(self):
        self.reset()
        
if __name__ == '__main__':
    swapforth.main(TetheredJ1b)
Esempio n. 2
0
        bl.setspeed(speed)

        if bl.confirm() != 0xf70a0d13:
            print 'High-speed CONFIRM command failed'
            sys.exit(1)
        if bootfile is not None:
            program = array.array('I', open(bootfile).read())
            bl.loadprogram(program)
        bl.ex()

        time.sleep(.05)
        while True:
            n = ser.inWaiting()
            if not n:
                break
            ser.read(n)

        ser.write("true tethered !\r\n")
        while ser.read(1) != chr(30):
            pass

    def interrupt(self):
        self.ser.write(chr(3))
        self.ser.flush()
        while self.ser.read(1) != chr(30):
            pass


if __name__ == '__main__':
    swapforth.main(TetheredFT900)
Esempio n. 3
0
class TetheredJ1a(swapforth.TetheredTarget):
    cellsize = 2

    def open_ser(self, port, speed):
        self.ser = vsimj1a.vsimj1a()

    def reset(self):
        ser = self.ser
        ser.reset()
        for c in '    1 tth !':
            ser.write(c)
        ser.write('\r')

        while 1:
            c = ser.read(1)
            print repr(c)
            if c == chr(30):
                break

    def boot(self, bootfile=None):
        sys.stdout.write('Contacting... ')
        self.reset()
        print 'established'

    def interrupt(self):
        self.reset()


if __name__ == '__main__':
    swapforth.main(TetheredJ1a)
Esempio n. 4
0
            sys.exit(1)
        bl.setspeed(speed)

        if bl.confirm() != 0xf70a0d13:
            print 'High-speed CONFIRM command failed'
            sys.exit(1)
        if bootfile is not None:
            program = array.array('I', open(bootfile).read())
            bl.loadprogram(program)
        bl.ex()

        time.sleep(.05)
        while True:
            n = ser.inWaiting()
            if not n:
                break
            ser.read(n)

        ser.write("true tethered !\r\n")
        while ser.read(1) != chr(30):
            pass

    def interrupt(self):
        self.ser.write(chr(3))
        self.ser.flush()
        while self.ser.read(1) != chr(30):
            pass

if __name__ == '__main__':
    swapforth.main(TetheredFT900)