Skip to content

Commit

Permalink
Corrected serial init procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
Uros Petrevski committed Feb 25, 2015
1 parent d2a9fe2 commit 0aedb88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion weioLib/weioIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def initI2C():
def initSPI(*args):
return interfaceSPI(gpio.u, *args)

def initSerial(port, baudrate, timeout_=1):
def initSerial(port='/dev/ttyACM1', baudrate=9600, timeout_=1):
# toggle RX and TX pins to secondary (UART) mode
interfaceUART(gpio.u)
return serial.Serial(port, baudrate, timeout=timeout_)
Expand Down
5 changes: 3 additions & 2 deletions weioLib/weioSerial.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
def Serial(baudrate, port='/dev/ttyACM1', timeout=1):
if (port is '/dev/ttyACM1'):
# Switch GPIO to UART on WeIO, this is not necessary if some other port is asked
initSerial()
return serial.Serial(port, baudrate, timeout=timeout)
return initSerial(port, baudrate, timeout=timeout)
else :
return serial.Serial(port, baudrate, timeout=timeout)

# Serial ports
def listSerials():
Expand Down

0 comments on commit 0aedb88

Please sign in to comment.