ckbot :: pololu :: Bus :: Class Bus
[hide private]
[frames] | no frames]

Class Bus

source code


Concrete class that provides the functionality needed to send messages to a pololu controller over a serial connection.

It is responsible for correctly formatting certain inputs to Pololu-understandable formats as documented in the Pololu Maestro User Manual located at http://www.pololu.com/docs/0J40/all

Instance Methods [hide private]
 
__init__(self, port='tty={ "glob":"/dev/ttyACM0", "baudrate":38400, "timeout":0.1}', crc_enabled=False, *args, **kw)
Initialize a Pololu Bus class
source code
 
get_errors(self)
Retrieve error messages from the Pololu Maestro device using the protocol outlined by the Pololu Maestro documentation
source code
 
open(self) source code
 
write(self, val)
Write data to the pololu controller over serial
source code
 
close(self)
Close serial connection to the pololu controller if a connection has been made
source code
 
crc7(self, comstr)
This function calculates and appends the Cyclic Redundancy Check (CRC7) byte for error checking
source code
 
__bitrev(self, bytes)
Creates a lookup table of reversed bit orders
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, port='tty={ "glob":"/dev/ttyACM0", "baudrate":38400, "timeout":0.1}', crc_enabled=False, *args, **kw)
(Constructor)

source code 

Initialize a Pololu Bus class

INPUT: port -- port / connection specification (see port2port.Connection)

ATTRIBUTES: ser -- connection handle

Overrides: object.__init__

get_errors(self)

source code 

Retrieve error messages from the Pololu Maestro device using the protocol outlined by the Pololu Maestro documentation

WARNING: This method will hang if there is a faulty serial connection

write(self, val)

source code 

Write data to the pololu controller over serial

INPUT: val -- tuple -- tuple of ints to write to serial

__bitrev(self, bytes)

source code 

Creates a lookup table of reversed bit orders

Input: 
   bytes -- tuple -- tuple of 1 byte values to be reversed
Output:
   bitrev_table -- dict