# -*- coding: utf-8 -*- """ enter DFU-bootloader """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-12-19" __version__ = "0.1.0" import os import sys sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev = CDC_nRF('/dev/ttyACM0') print myDev.enterBootloader()
""" __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.nrfeep import EEP_nRF from lib.cdc import CDC_nRF myDev = CDC_nRF(sys.argv[1]) data = myDev.readEEPROM() print data if data: myEEP = EEP_nRF() myEEP.parse(data) myEEP.dumpData() #print sys.argv[1] #myEEP=EEP_nRF(sys.argv[1]) #myEEP.parse() #myEEP.dumpData()
import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev = CDC_nRF('/dev/ttyACM0') a = 0 while True: a = (a + 1) & 0xff print a, myDev.Echo(a, range(1, a + 1)) time.sleep(1)
# -*- coding: utf-8 -*- """ listen via the command interface """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev = CDC_nRF(sys.argv[1]) #myDev.setRX_Address(0,[0xc0,0x1d,0xbe,0xef,0x01]) while True: myDev.enterRaw() time.sleep(1) myDev.enterCommand() time.sleep(1)
# -*- coding: utf-8 -*- """ send data via the command interface """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev = CDC_nRF(sys.argv[1]) myDev.setPower(1) myDev.debug = True #myDev.setRX_Address(0,[0xc0,0x1d,0xbe,0xef,0x01]) #myDev.setTX_Address([0xc0,0x1d,0xbe,0xef,0x01]) w = 0 while True: w = w + 1 time.sleep(0.2) print myDev.sendMessage(map(ord, '%i\n' % w), False)
# -*- coding: utf-8 -*- """ reset cdc-nrf """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-12-19" __version__ = "0.1.0" import os import sys sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev = CDC_nRF('/dev/ttyACM0') print myDev.Reset()
import sys import time import yaml import os sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.nrfeep import EEP_nRF from lib.cdc import CDC_nRF myDev=CDC_nRF(sys.argv[1]) data=myDev.readEEPROM() print(yaml.safe_dump(data))
# -*- coding: utf-8 -*- """ reset cdc-nrf """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-12-19" __version__ = "0.1.0" import os import sys sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF import time myDev=CDC_nRF(sys.argv[1]) print myDev.setPower(1) while True: print "0x%02x" % myDev.getStatus() time.sleep(1)
# -*- coding: utf-8 -*- """ listen via the command interface """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev = CDC_nRF(sys.argv[1]) #myDev.setRX_Address(0,[0xc0,0x1d,0xbe,0xef,0x01]) while True: print myDev.receiveMessage() time.sleep(1)
# -*- coding: utf-8 -*- """ raw listen, receive bytes in raw mode """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev=CDC_nRF(sys.argv[1]) #myDev.setPower(1) #myDev.setRX_Address(0,[0xc0,0x1d,0xbe,0xef,0x00]) myDev._bus.setDTR(True) myDev._bus.timeout=1#None; while True: print len(myDev._bus.read(1024)) #print myDev._rx(1024)
# -*- coding: utf-8 -*- """ raw listen, receive bytes in raw mode """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev = CDC_nRF(sys.argv[1]) myDev.setPower(1) #myDev.setRX_Address(0,[0xc0,0x1d,0xbe,0xef,0x01]) #myDev.setTX_Address([0xc0,0x1d,0xbe,0xef,0x01]) myDev._bus.setDTR(True) w = 0 while True: w = w + 1 time.sleep(0.1) print myDev._bus.write('This message! (%i)\n\r' % w)
import time from lib.cdc import CDC_nRF myDev=CDC_nRF('/dev/ttyACM0') myDev.writeRegister(1, 0) t_start=time.time() n_regs=10 for reg in range(0,n_regs): print reg, '%X' % myDev.readRegister(reg) t_end=time.time() print "Reading %i registers took %fs" % (n_regs,t_end-t_start)
# -*- coding: utf-8 -*- """ listen via the command interface """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev=CDC_nRF(sys.argv[1]) #myDev.setRX_Address(0,[0xc0,0x1d,0xbe,0xef,0x01]) while True: print myDev.receiveMessage() time.sleep(1)
# -*- coding: utf-8 -*- """ reset cdc-nrf """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-12-19" __version__ = "0.1.0" import os import sys sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev = CDC_nRF('/dev/ttyACM0') print myDev.Reconfigure()
# -*- coding: utf-8 -*- """ listen via the command interface """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev=CDC_nRF(sys.argv[1]) #myDev.setRX_Address(0,[0xc0,0x1d,0xbe,0xef,0x01]) while True: myDev.enterRaw() time.sleep(1) myDev.enterCommand() time.sleep(1)
# -*- coding: utf-8 -*- """ send data via the command interface """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev=CDC_nRF(sys.argv[1]) myDev.setPower(1) myDev.debug=True #myDev.setRX_Address(0,[0xc0,0x1d,0xbe,0xef,0x01]) #myDev.setTX_Address([0xc0,0x1d,0xbe,0xef,0x01]) w=0 while True: w=w+1 time.sleep(0.2) print myDev.sendMessage(map(ord,'%i\n'%w) ,False)
import time from lib.cdc import CDC_nRF myDev = CDC_nRF('/dev/ttyACM0') myDev.writeRegister(1, 0) t_start = time.time() n_regs = 10 for reg in range(0, n_regs): print reg, '%X' % myDev.readRegister(reg) t_end = time.time() print "Reading %i registers took %fs" % (n_regs, t_end - t_start)
# -*- coding: utf-8 -*- """ enter DFU-bootloader """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-12-19" __version__ = "0.1.0" import os import sys sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev=CDC_nRF('/dev/ttyACM0') print myDev.enterBootloader()
# -*- coding: utf-8 -*- """ default ee-prom setup """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-30" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev=CDC_nRF(sys.argv[1]) print myDev.setDefaultPower(1) print myDev.setDefaultTXMode(0) myDev._bus.setDTR(False)
import time import sys import os import yaml sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF from lib.nrfeep import EEP_nRF myDev=CDC_nRF(sys.argv[1]) data=yaml.load(sys.stdin.read(1024)) print("== Data from stdin ==") print(data) myDev.writeEEPROM(0,data) print("== Read-Back ==") print myDev.readEEPROM(0,len(data)) #print myEEP.tobinarray(start=0x00)
# -*- coding: utf-8 -*- """ raw listen, receive bytes in raw mode """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev=CDC_nRF(sys.argv[1]) myDev.setPower(1) #myDev.setRX_Address(0,[0xc0,0x1d,0xbe,0xef,0x01]) #myDev.setTX_Address([0xc0,0x1d,0xbe,0xef,0x01]) myDev._bus.setDTR(True) w=0 while True: w=w+1 time.sleep(0.1) print myDev._bus.write('This message! (%i)\n\r'%w)
""" __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev=CDC_nRF(sys.argv[1]) #myDev.setPower(1) #myDev.setRX_Address(0,[0xc0,0x1d,0xbe,0xef,0x00]) myDev._bus.setDTR(True) myDev._bus.timeout=None; while True: data=myDev._rx(11) myDev._tx(data) print("rx") for char in data: sys.stdout.write("%02x:" % char) sys.stdout.write("\n") sys.stdout.flush() #print myDev._rx(1024)
# -*- coding: utf-8 -*- """ default ee-prom setup """ __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-30" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev = CDC_nRF(sys.argv[1]) print myDev.setDefaultPower(1) print myDev.setDefaultTXMode(0) myDev._bus.setDTR(False)
""" __author__ = """Alexander Krause <*****@*****.**>""" __date__ = "2012-11-22" __version__ = "0.1.0" import os import sys import time sys.path=\ [os.path.dirname(os.path.realpath(__file__))+'/../']+sys.path from lib.cdc import CDC_nRF myDev=CDC_nRF(sys.argv[2]) myDev.setPower(1) myDev.setDefaultTXMode(0) myDev._bus.setDTR(True) if sys.argv[1]=='--server': print "Starting as server..." myDev._bus.timeout=None; while True: char=myDev._bus.read() if char: print('rx',char+myDev._bus.read(myDev._bus.inWaiting())) myDev._bus.flushInput() time.sleep(0.1) print('tx',"Pong!")