Motoron Motor Controller library for Raspberry Pi
|
Public Member Functions | |
def | __init__ (self, *port=None, device_number=None) |
def | set_port (self, port) |
def | expect_7bit_responses (self) |
def | expect_8bit_responses (self) |
def | use_14bit_device_number (self) |
def | use_7bit_device_number (self) |
def | multi_device_error_check_start (self, starting_device_number, device_count) |
def | multi_device_error_check (self, starting_device_number, device_count) |
def | multi_device_write (self, starting_device_number, device_count, command_byte, data) |
def | __init__ (self, *port=None, device_number=None) |
def | set_port (self, port) |
def | expect_7bit_responses (self) |
def | expect_8bit_responses (self) |
def | use_14bit_device_number (self) |
def | use_7bit_device_number (self) |
def | multi_device_error_check_start (self, starting_device_number, device_count) |
def | multi_device_error_check (self, starting_device_number, device_count) |
def | multi_device_write (self, starting_device_number, device_count, command_byte, data) |
Public Attributes | |
device_number | |
communication_options | |
port | |
Protected Member Functions | |
def | _send_command_core (self, cmd, send_crc) |
def | _read_response (self, length) |
def | _send_command_core (self, cmd, send_crc) |
def | _read_response (self, length) |
Represents a serial connection to a Pololu Motoron Motor Controller.
Definition at line 1761 of file motoron.py.
def motoron.MotoronSerial.__init__ | ( | self, | |
* | port = None , |
||
device_number = None |
|||
) |
Creates a new MotoronSerial object.
The deviceNumber
argument is optional. If it is omitted or None, the object will use the compact protocol.
The port
argument specifies the serial port to use and is passed directly to set_port().
The bits in this variable are defined by the motoron.COMMUNICATION_OPTION_* constants. The bits that affect the behavior of this library are:
Reimplemented from motoron.MotoronBase.
Definition at line 1766 of file motoron.py.
def motoron.MotoronSerial.__init__ | ( | self, | |
* | port = None , |
||
device_number = None |
|||
) |
Creates a new MotoronSerial object.
The deviceNumber
argument is optional. If it is omitted or None, the object will use the compact protocol.
The port
argument specifies the serial port to use and is passed directly to set_port().
The bits in this variable are defined by the motoron.COMMUNICATION_OPTION_* constants. The bits that affect the behavior of this library are:
Reimplemented from motoron.MotoronBase.
Definition at line 1766 of file motoron.py.
|
protected |
Definition at line 1957 of file motoron.py.
|
protected |
Definition at line 1957 of file motoron.py.
|
protected |
Definition at line 1937 of file motoron.py.
|
protected |
Definition at line 1937 of file motoron.py.
def motoron.MotoronSerial.expect_7bit_responses | ( | self | ) |
Configures this object to work with Motorons that are configured to send 7-bit serial responses.
Definition at line 1813 of file motoron.py.
def motoron.MotoronSerial.expect_7bit_responses | ( | self | ) |
Configures this object to work with Motorons that are configured to send 7-bit serial responses.
Definition at line 1813 of file motoron.py.
def motoron.MotoronSerial.expect_8bit_responses | ( | self | ) |
Configures this object to work with Motorons that are configured to send responses in the normal 8-bit format.
Definition at line 1820 of file motoron.py.
def motoron.MotoronSerial.expect_8bit_responses | ( | self | ) |
Configures this object to work with Motorons that are configured to send responses in the normal 8-bit format.
Definition at line 1820 of file motoron.py.
def motoron.MotoronSerial.multi_device_error_check | ( | self, | |
starting_device_number, | |||
device_count | |||
) |
Sends a "Multi-device error check" command and reads the responses.
This function assumes that each addressed Motoron can see the responses sent by the other Motorons (e.g. they are in a half-duplex RS-485 network).
Returns the number of devices that indicated they have no errors. If the return value is less than device count, you can add the return value to the starting_device_number to get the device number of the first device where the check failed. This device either did not respond or it responded with an indication that it has an error, or an unexpected byte was received for some reason.
Note: Before using this, most users should make sure the MotoronSerial object is configured to use the compact protocol: construct the object without specifying a device number, or set device_number to None.
Definition at line 1871 of file motoron.py.
def motoron.MotoronSerial.multi_device_error_check | ( | self, | |
starting_device_number, | |||
device_count | |||
) |
Sends a "Multi-device error check" command and reads the responses.
This function assumes that each addressed Motoron can see the responses sent by the other Motorons (e.g. they are in a half-duplex RS-485 network).
Returns the number of devices that indicated they have no errors. If the return value is less than device count, you can add the return value to the starting_device_number to get the device number of the first device where the check failed. This device either did not respond or it responded with an indication that it has an error, or an unexpected byte was received for some reason.
Note: Before using this, most users should make sure the MotoronSerial object is configured to use the compact protocol: construct the object without specifying a device number, or set device_number to None.
Definition at line 1871 of file motoron.py.
def motoron.MotoronSerial.multi_device_error_check_start | ( | self, | |
starting_device_number, | |||
device_count | |||
) |
Sends a "Multi-device error check" command but does not read any responses.
Note: Before using this, most users should make sure the MotoronSerial object is configured to use the compact protocol: construct the object without specifying a device number, or set device_number to None.
Definition at line 1840 of file motoron.py.
def motoron.MotoronSerial.multi_device_error_check_start | ( | self, | |
starting_device_number, | |||
device_count | |||
) |
Sends a "Multi-device error check" command but does not read any responses.
Note: Before using this, most users should make sure the MotoronSerial object is configured to use the compact protocol: construct the object without specifying a device number, or set device_number to None.
Definition at line 1840 of file motoron.py.
def motoron.MotoronSerial.multi_device_write | ( | self, | |
starting_device_number, | |||
device_count, | |||
command_byte, | |||
data | |||
) |
Sends a "Multi-device write" command.
Note: Before using this, most users should make sure the MotoronSerial object is configured to use the compact protocol: construct the object without specifying a device number, or call setDeviceNumber with an argument of 0xFFFF.
Definition at line 1895 of file motoron.py.
def motoron.MotoronSerial.multi_device_write | ( | self, | |
starting_device_number, | |||
device_count, | |||
command_byte, | |||
data | |||
) |
Sends a "Multi-device write" command.
Note: Before using this, most users should make sure the MotoronSerial object is configured to use the compact protocol: construct the object without specifying a device number, or call setDeviceNumber with an argument of 0xFFFF.
Definition at line 1895 of file motoron.py.
def motoron.MotoronSerial.set_port | ( | self, | |
port | |||
) |
Configures this object to use the specified serial port object.
The port argument should be one of the following:
Definition at line 1796 of file motoron.py.
def motoron.MotoronSerial.set_port | ( | self, | |
port | |||
) |
Configures this object to use the specified serial port object.
The port argument should be one of the following:
Definition at line 1796 of file motoron.py.
def motoron.MotoronSerial.use_14bit_device_number | ( | self | ) |
Configures this object to send 14-bit device numbers when using the Pololu protocol, instead of the default 7-bit.
Definition at line 1827 of file motoron.py.
def motoron.MotoronSerial.use_14bit_device_number | ( | self | ) |
Configures this object to send 14-bit device numbers when using the Pololu protocol, instead of the default 7-bit.
Definition at line 1827 of file motoron.py.
def motoron.MotoronSerial.use_7bit_device_number | ( | self | ) |
Configures this object to send 7-bit device numbers, which is the default.
Definition at line 1834 of file motoron.py.
def motoron.MotoronSerial.use_7bit_device_number | ( | self | ) |
Configures this object to send 7-bit device numbers, which is the default.
Definition at line 1834 of file motoron.py.
motoron.MotoronSerial.communication_options |
The serial options used by this object.
This must match the serial options in the EEPROM of the Motoron you are communicating with. The default is 7-bit device numbers and 8-bit responses.
Definition at line 1788 of file motoron.py.
motoron.MotoronSerial.device_number |
The device number that will be included in commands sent by this object.
The default is None, which means to not send a device number and use the compact protocol instead.
Definition at line 1783 of file motoron.py.
motoron.MotoronSerial.port |