PyTmcStepper 0.13.0__tar.gz → 0.14.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/PKG-INFO +2 -2
  2. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/README.md +1 -1
  3. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/pyproject.toml +1 -1
  4. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/PyTmcStepper.egg-info/PKG-INFO +2 -2
  5. pytmcstepper-0.14.0/src/tmc_driver/__init__.py +96 -0
  6. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/_tmc_stepperdriver.py +1 -1
  7. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/_tmc_xxxx.py +10 -8
  8. pytmcstepper-0.14.0/src/tmc_driver/com/__init__.py +64 -0
  9. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/com/_tmc_com.py +1 -1
  10. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/com/_tmc_com_spi_base.py +4 -5
  11. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/com/_tmc_com_uart_base.py +386 -341
  12. pytmcstepper-0.14.0/src/tmc_driver/enable_control/__init__.py +55 -0
  13. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/enable_control/_tmc_ec_toff.py +0 -12
  14. pytmcstepper-0.14.0/src/tmc_driver/motion_control/__init__.py +111 -0
  15. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/motion_control/_tmc_mc_int_ramp_generator.py +0 -12
  16. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/motion_control/_tmc_mc_step_reg.py +0 -12
  17. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/motion_control/_tmc_mc_vactual.py +0 -12
  18. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/reg/_tmc220x_reg.py +1 -0
  19. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/reg/_tmc224x_reg.py +1 -0
  20. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/reg/_tmc5160_reg.py +1 -0
  21. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_220x.py +1 -9
  22. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_2240.py +0 -9
  23. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_5160.py +0 -9
  24. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_logger/_tmc_logger_micropython.py +2 -0
  25. pytmcstepper-0.13.0/src/tmc_driver/com/__init__.py +0 -0
  26. pytmcstepper-0.13.0/src/tmc_driver/enable_control/__init__.py +0 -0
  27. pytmcstepper-0.13.0/src/tmc_driver/motion_control/__init__.py +0 -0
  28. pytmcstepper-0.13.0/src/tmc_driver/reg/__init__.py +0 -0
  29. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/LICENSE +0 -0
  30. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/setup.cfg +0 -0
  31. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/PyTmcStepper.egg-info/SOURCES.txt +0 -0
  32. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/PyTmcStepper.egg-info/dependency_links.txt +0 -0
  33. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/PyTmcStepper.egg-info/requires.txt +0 -0
  34. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/PyTmcStepper.egg-info/top_level.txt +0 -0
  35. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/_tmc_exceptions.py +0 -0
  36. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/_tmc_math.py +0 -0
  37. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/_tmc_stallguard.py +0 -0
  38. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/_tmc_validation.py +0 -0
  39. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/com/_tmc_com_spi.py +0 -0
  40. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/com/_tmc_com_spi_ftdi.py +0 -0
  41. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/com/_tmc_com_spi_micropython.py +0 -0
  42. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/com/_tmc_com_uart.py +0 -0
  43. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/com/_tmc_com_uart_micropython.py +0 -0
  44. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/enable_control/_tmc_ec.py +0 -0
  45. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/enable_control/_tmc_ec_pin.py +0 -0
  46. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/motion_control/_tmc_mc.py +0 -0
  47. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/motion_control/_tmc_mc_step_dir.py +0 -0
  48. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py +0 -0
  49. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/platform_utils.py +0 -0
  50. {pytmcstepper-0.13.0/src/tmc_driver → pytmcstepper-0.14.0/src/tmc_driver/reg}/__init__.py +0 -0
  51. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/reg/_tmc2209_reg.py +0 -0
  52. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/reg/_tmc_reg.py +0 -0
  53. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/reg/_tmc_shared_regs.py +0 -0
  54. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_2208.py +0 -0
  55. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_2209.py +0 -0
  56. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_gpio/__init__.py +0 -0
  57. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_gpio/_tmc_gpio_board_base.py +0 -0
  58. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_gpio/_tmc_gpio_board_ftdi.py +0 -0
  59. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_gpio/_tmc_gpio_board_gpiozero.py +0 -0
  60. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_gpio/_tmc_gpio_board_micropython.py +0 -0
  61. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_gpio/_tmc_gpio_board_periphery.py +0 -0
  62. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_gpio/_tmc_gpio_board_rpi_gpio.py +0 -0
  63. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_logger/__init__.py +0 -0
  64. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_logger/_tmc_logger_base.py +0 -0
  65. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/src/tmc_driver/tmc_logger/_tmc_logger_cpython.py +0 -0
  66. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/tests/test_tmc2209.py +0 -0
  67. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/tests/test_tmc2240.py +0 -0
  68. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/tests/test_tmc_com_spi.py +0 -0
  69. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/tests/test_tmc_com_uart.py +0 -0
  70. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/tests/test_tmc_ec_pin.py +0 -0
  71. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/tests/test_tmc_math.py +0 -0
  72. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/tests/test_tmc_modules.py +0 -0
  73. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/tests/test_tmc_move.py +0 -0
  74. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/tests/test_tmc_set_current.py +0 -0
  75. {pytmcstepper-0.13.0 → pytmcstepper-0.14.0}/tests/test_tmc_stallguard.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyTmcStepper
3
- Version: 0.13.0
3
+ Version: 0.14.0
4
4
  Summary: This is a Python libary to drive a stepper motor with a Trinamic stepper driver and a single board computer like a Raspberry Pi
5
5
  Author-email: Christian Köhlke <christian@koehlke.de>
6
6
  License-Expression: GPL-3.0
@@ -283,7 +283,7 @@ from tmc_driver.tmc_2209 import *
283
283
  tmc = Tmc2209(TmcEnableControlPin(21), TmcMotionControlStepDir(16, 20), TmcComUart("/dev/serial0"))
284
284
 
285
285
  tmc.set_direction_reg(False)
286
- tmc.set_current(300)
286
+ tmc.set_current_rms(300)
287
287
  tmc.set_interpolation(True)
288
288
  tmc.set_spreadcycle(False)
289
289
  tmc.set_microstepping_resolution(2)
@@ -253,7 +253,7 @@ from tmc_driver.tmc_2209 import *
253
253
  tmc = Tmc2209(TmcEnableControlPin(21), TmcMotionControlStepDir(16, 20), TmcComUart("/dev/serial0"))
254
254
 
255
255
  tmc.set_direction_reg(False)
256
- tmc.set_current(300)
256
+ tmc.set_current_rms(300)
257
257
  tmc.set_interpolation(True)
258
258
  tmc.set_spreadcycle(False)
259
259
  tmc.set_microstepping_resolution(2)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PyTmcStepper"
7
- version = "0.13.0"
7
+ version = "0.14.0"
8
8
  authors = [{ name = "Christian Köhlke", email = "christian@koehlke.de" }]
9
9
  description = "This is a Python libary to drive a stepper motor with a Trinamic stepper driver and a single board computer like a Raspberry Pi"
10
10
  readme = "README.md"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyTmcStepper
3
- Version: 0.13.0
3
+ Version: 0.14.0
4
4
  Summary: This is a Python libary to drive a stepper motor with a Trinamic stepper driver and a single board computer like a Raspberry Pi
5
5
  Author-email: Christian Köhlke <christian@koehlke.de>
6
6
  License-Expression: GPL-3.0
@@ -283,7 +283,7 @@ from tmc_driver.tmc_2209 import *
283
283
  tmc = Tmc2209(TmcEnableControlPin(21), TmcMotionControlStepDir(16, 20), TmcComUart("/dev/serial0"))
284
284
 
285
285
  tmc.set_direction_reg(False)
286
- tmc.set_current(300)
286
+ tmc.set_current_rms(300)
287
287
  tmc.set_interpolation(True)
288
288
  tmc.set_spreadcycle(False)
289
289
  tmc.set_microstepping_resolution(2)
@@ -0,0 +1,96 @@
1
+ """
2
+ PyTmcStepper - Python library for Trinamic TMC stepper motor drivers
3
+
4
+ This package provides a high-level interface for controlling TMC stepper motor drivers
5
+ via UART or SPI communication on various platforms including Raspberry Pi, Jetson, and MicroPython.
6
+
7
+ Main Components:
8
+ - Driver Classes: Tmc2208, Tmc2209, Tmc2240, Tmc5160
9
+ - Communication: TmcCom and subclasses for UART/SPI
10
+ - Motion Control: Various strategies for motor movement
11
+ - Enable Control: Motor enable/disable functionality
12
+ - GPIO Abstraction: Platform-independent GPIO access
13
+ - Logging: Configurable logging support
14
+
15
+ Example:
16
+ >>> from tmc_driver import Tmc2209, Loglevel
17
+ >>> from tmc_driver.com import TmcComUart
18
+ >>> from tmc_driver.motion_control import TmcMotionControlStepDir
19
+ >>> from tmc_driver.enable_control import TmcEnableControlPin
20
+ >>>
21
+ >>> tmc = Tmc2209(
22
+ ... TmcEnableControlPin(21),
23
+ ... TmcMotionControlStepDir(16, 20),
24
+ ... TmcComUart("/dev/serial0"),
25
+ ... loglevel=Loglevel.INFO
26
+ ... )
27
+ """
28
+
29
+ # Driver classes
30
+ from .tmc_2208 import Tmc2208
31
+ from .tmc_2209 import Tmc2209
32
+ from .tmc_2240 import Tmc2240
33
+ from .tmc_5160 import Tmc5160
34
+
35
+ # Exceptions
36
+ from ._tmc_exceptions import (
37
+ TmcException,
38
+ TmcDriverException,
39
+ TmcComException,
40
+ TmcMotionControlException,
41
+ TmcEnableControlException,
42
+ )
43
+
44
+ # Logger
45
+ from .tmc_logger import TmcLogger, Loglevel
46
+
47
+ # GPIO
48
+ from . import tmc_gpio
49
+ from .tmc_gpio import Board
50
+
51
+ # Enable Control
52
+ from .enable_control._tmc_ec_pin import TmcEnableControlPin
53
+ from .enable_control._tmc_ec_toff import TmcEnableControlToff
54
+
55
+ # Motion Control
56
+ from .motion_control._tmc_mc import StopMode, MovementAbsRel, MovementPhase, Direction
57
+ from .motion_control._tmc_mc_step_dir import TmcMotionControlStepDir
58
+ from .motion_control._tmc_mc_step_pwm_dir import TmcMotionControlStepPwmDir
59
+ from .motion_control._tmc_mc_step_reg import TmcMotionControlStepReg
60
+ from .motion_control._tmc_mc_vactual import TmcMotionControlVActual
61
+ from .motion_control._tmc_mc_int_ramp_generator import TmcMotionControlIntRampGenerator
62
+
63
+ __all__ = [
64
+ # Driver classes
65
+ "Tmc2208",
66
+ "Tmc2209",
67
+ "Tmc2240",
68
+ "Tmc5160",
69
+ # Exceptions
70
+ "TmcException",
71
+ "TmcDriverException",
72
+ "TmcComException",
73
+ "TmcMotionControlException",
74
+ "TmcEnableControlException",
75
+ # Logger
76
+ "TmcLogger",
77
+ "Loglevel",
78
+ # GPIO
79
+ "tmc_gpio",
80
+ "Board",
81
+ # Enable Control
82
+ "TmcEnableControlPin",
83
+ "TmcEnableControlToff",
84
+ # Motion Control
85
+ "StopMode",
86
+ "MovementAbsRel",
87
+ "MovementPhase",
88
+ "Direction",
89
+ "TmcMotionControlStepDir",
90
+ "TmcMotionControlStepPwmDir",
91
+ "TmcMotionControlStepReg",
92
+ "TmcMotionControlVActual",
93
+ "TmcMotionControlIntRampGenerator",
94
+ ]
95
+
96
+ __version__ = "0.5.0"
@@ -12,7 +12,7 @@
12
12
  this module has the function to move the motor via STEP/DIR pins
13
13
  """
14
14
 
15
- from .tmc_gpio import Gpio, GpioMode, Board
15
+ from .tmc_gpio import Board
16
16
  from . import tmc_gpio
17
17
  from .motion_control._tmc_mc import (
18
18
  TmcMotionControl,
@@ -1,5 +1,6 @@
1
1
  # pylint: disable=wildcard-import
2
2
  # pylint: disable=unused-wildcard-import
3
+ # pylint: disable=unused-import
3
4
  # pylint: disable=too-many-arguments
4
5
  # pylint: disable=too-many-positional-arguments
5
6
  # pylint: disable=too-many-public-methods
@@ -13,6 +14,7 @@ this module has two different functions:
13
14
 
14
15
  import time
15
16
  from abc import abstractmethod
17
+ from .tmc_gpio import Gpio
16
18
  from ._tmc_stepperdriver import *
17
19
  from .tmc_logger import Loglevel
18
20
  from .enable_control._tmc_ec import TmcEnableControl
@@ -21,7 +23,13 @@ from .com._tmc_com import TmcCom
21
23
  from .reg._tmc_reg import TmcReg
22
24
  from .reg import _tmc_shared_regs as tmc_shared_regs
23
25
  from ._tmc_validation import validate_submodule
24
- from ._tmc_exceptions import TmcDriverException, TmcComException
26
+ from ._tmc_exceptions import (
27
+ TmcException,
28
+ TmcComException,
29
+ TmcMotionControlException,
30
+ TmcEnableControlException,
31
+ TmcDriverException,
32
+ )
25
33
 
26
34
 
27
35
  class TmcXXXX(TmcStepperDriver):
@@ -92,14 +100,8 @@ class TmcXXXX(TmcStepperDriver):
92
100
  if self.tmc_com is not None:
93
101
  self.tmc_com.tmc_logger = self.tmc_logger
94
102
  self.tmc_com.driver_address = driver_address
95
-
96
103
  self.tmc_com.init()
97
104
 
98
- if self.tmc_mc is not None:
99
- setattr(self.tmc_mc, "tmc_com", self.tmc_com)
100
- if self.tmc_ec is not None:
101
- setattr(self.tmc_ec, "tmc_com", self.tmc_com)
102
-
103
105
  # Register callback for submodules to access registers
104
106
  self.tmc_com.set_get_register_callback(self._get_register)
105
107
  if self.tmc_mc is not None:
@@ -479,4 +481,4 @@ class TmcXXXX(TmcStepperDriver):
479
481
  self.tmc_logger.log("---")
480
482
  self.tmc_logger.log("TEST COM")
481
483
 
482
- return self.tmc_com.test_com()
484
+ return self.tmc_com.test_com(self.ioin)
@@ -0,0 +1,64 @@
1
+ # pylint: disable=import-outside-toplevel
2
+ """Communication module for TMC stepper drivers
3
+
4
+ Provides UART and SPI communication implementations for different platforms:
5
+ - TmcComUart: Standard UART communication (CPython with pyserial)
6
+ - TmcComSpi: Standard SPI communication (CPython with spidev)
7
+ - TmcComUartMicroPython: UART for MicroPython
8
+ - TmcComSpiMicroPython: SPI for MicroPython
9
+ - TmcComSpiFtdi: SPI via FTDI USB devices
10
+
11
+ Example:
12
+ >>> from tmc_driver.com import TmcComUart
13
+ >>> tmc_com = TmcComUart("/dev/serial0")
14
+
15
+ Note: Base classes (TmcCom, TmcComUartBase, TmcComSpiBase) can be imported
16
+ directly from their respective files if needed for type hints or subclassing.
17
+ """
18
+
19
+ try:
20
+ from typing import TYPE_CHECKING
21
+
22
+ if TYPE_CHECKING:
23
+ # Import for type checkers/IDE only - not executed at runtime
24
+ from ._tmc_com_uart import TmcComUart
25
+ from ._tmc_com_spi import TmcComSpi
26
+ from ._tmc_com_uart_micropython import TmcComUartMicroPython
27
+ from ._tmc_com_spi_micropython import TmcComSpiMicroPython
28
+ from ._tmc_com_spi_ftdi import TmcComSpiFtdi
29
+ except ImportError:
30
+ pass
31
+
32
+
33
+ def __getattr__(name):
34
+ """Lazy import of communication classes to avoid circular imports"""
35
+ if name == "TmcComUart":
36
+ from ._tmc_com_uart import TmcComUart
37
+
38
+ return TmcComUart
39
+ if name == "TmcComSpi":
40
+ from ._tmc_com_spi import TmcComSpi
41
+
42
+ return TmcComSpi
43
+ if name == "TmcComUartMicroPython":
44
+ from ._tmc_com_uart_micropython import TmcComUartMicroPython
45
+
46
+ return TmcComUartMicroPython
47
+ if name == "TmcComSpiMicroPython":
48
+ from ._tmc_com_spi_micropython import TmcComSpiMicroPython
49
+
50
+ return TmcComSpiMicroPython
51
+ if name == "TmcComSpiFtdi":
52
+ from ._tmc_com_spi_ftdi import TmcComSpiFtdi
53
+
54
+ return TmcComSpiFtdi
55
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
56
+
57
+
58
+ __all__ = [
59
+ "TmcComUart",
60
+ "TmcComSpi",
61
+ "TmcComUartMicroPython",
62
+ "TmcComSpiMicroPython",
63
+ "TmcComSpiFtdi",
64
+ ]
@@ -144,5 +144,5 @@ class TmcCom:
144
144
  """this function clear the communication buffers of the Raspberry Pi"""
145
145
 
146
146
  @abstractmethod
147
- def test_com(self):
147
+ def test_com(self, ioin) -> bool:
148
148
  """test com connection"""
@@ -138,16 +138,15 @@ class TmcComSpiBase(TmcCom):
138
138
  def flush_com_buffer(self):
139
139
  """this function clear the communication buffers of the Raspberry Pi"""
140
140
 
141
- def test_com(self):
141
+ def test_com(self, ioin: tmc_shared_reg.Ioin):
142
142
  """test com connection
143
143
 
144
+ Args:
145
+ ioin: IOIN register instance
146
+
144
147
  Returns:
145
148
  bool: True if communication is OK, False otherwise
146
-
147
- Raises:
148
- TmcComException: if TMC register IOIN not available
149
149
  """
150
- ioin: tmc_shared_reg.Ioin = self.get_register("ioin") # type: ignore
151
150
  data, flags = ioin.read()
152
151
  del flags # unused
153
152