DS402 code cleanup (#245)
DS402 code cleanup (#245)

* ds402: Define additional operation mode constants.

Add the missing CYCLIC_SYNCHRONOUS_... modes to the mapping dicts,
including the supported mode bit flags.

* ds402: Use monotonic clock for timeouts.

The value returned from time.time() can go backwards between multiple
calls, so time.monotonic() is the recommended way for checking
timeouts.

* ds402: Make timeout values configurable.

Move all timing-related magic numbers to class-level constants and use
those for timeout calculations and sleep() calls.  That allows the
library user to override the defaults on a per-node basis if needed,
by just setting the same attribute on the object.  And it's cleaner
code without magic numbers.

* ds402: Code cleanup: whitespace and indentation.

* ds402: Clean up list formatting and style.

Consistently format constant definitions, especially constant
mappings:

* Write Controlword commands with for hex digits (16 bits).
* Same for Supported Drive Modes flags (only 16 of 32 bits).
* Move colon directly after key in dicts and align values
  consistently.  Fixes lots of flake8 errors.
* Always include trailing comma in multi-line sequences.
* Use tuples instead of lists for constant definitions.  They don't
  need to be mutable.

* ds402: Use tuple unpacking for simplified bitmask code.

Apply the same pattern whenever the Statusword is checked for a
specific bit pattern.
christiansandberg/canopen,christiansandberg/canopen