PyTmcStepper 0.9.0__tar.gz → 0.9.1__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 (62) hide show
  1. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/PKG-INFO +36 -40
  2. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/README.md +31 -34
  3. pytmcstepper-0.9.1/pyproject.toml +52 -0
  4. pytmcstepper-0.9.1/setup.cfg +4 -0
  5. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/PyTmcStepper.egg-info/PKG-INFO +36 -40
  6. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/PyTmcStepper.egg-info/SOURCES.txt +7 -2
  7. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/_tmc_logger.py +5 -8
  8. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/_tmc_math.py +1 -1
  9. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/_tmc_stallguard.py +4 -4
  10. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/_tmc_stepperdriver.py +15 -14
  11. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/com/_tmc_com.py +18 -30
  12. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/com/_tmc_com_spi.py +3 -21
  13. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/com/_tmc_com_spi_base.py +11 -15
  14. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/com/_tmc_com_spi_ftdi.py +4 -12
  15. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/com/_tmc_com_spi_micropython.py +10 -8
  16. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/com/_tmc_com_uart.py +3 -8
  17. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/com/_tmc_com_uart_base.py +13 -15
  18. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/com/_tmc_com_uart_micropython.py +8 -5
  19. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/enable_control/_tmc_ec.py +3 -2
  20. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/enable_control/_tmc_ec_pin.py +3 -3
  21. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/enable_control/_tmc_ec_toff.py +1 -1
  22. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/motion_control/_tmc_mc.py +9 -21
  23. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/motion_control/_tmc_mc_step_dir.py +6 -6
  24. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py +3 -4
  25. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/motion_control/_tmc_mc_step_reg.py +3 -3
  26. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/motion_control/_tmc_mc_vactual.py +4 -3
  27. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/reg/_tmc_reg.py +5 -6
  28. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/tmc_2209.py +11 -6
  29. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/tmc_220x.py +6 -8
  30. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/tmc_2240.py +10 -10
  31. pytmcstepper-0.9.1/src/tmc_driver/tmc_gpio/__init__.py +81 -0
  32. pytmcstepper-0.9.1/src/tmc_driver/tmc_gpio/_tmc_gpio_board_base.py +92 -0
  33. pytmcstepper-0.9.1/src/tmc_driver/tmc_gpio/_tmc_gpio_board_ftdi.py +148 -0
  34. pytmcstepper-0.9.1/src/tmc_driver/tmc_gpio/_tmc_gpio_board_gpiozero.py +94 -0
  35. pytmcstepper-0.9.1/src/tmc_driver/tmc_gpio/_tmc_gpio_board_micropython.py +108 -0
  36. pytmcstepper-0.9.1/src/tmc_driver/tmc_gpio/_tmc_gpio_board_periphery.py +73 -0
  37. pytmcstepper-0.9.1/src/tmc_driver/tmc_gpio/_tmc_gpio_board_rpi_gpio.py +153 -0
  38. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/tests/test_tmc_com_spi.py +1 -2
  39. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/tests/test_tmc_com_uart.py +1 -2
  40. pytmcstepper-0.9.0/pyproject.toml +0 -16
  41. pytmcstepper-0.9.0/setup.cfg +0 -47
  42. pytmcstepper-0.9.0/src/tmc_driver/_tmc_gpio_board.py +0 -681
  43. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/LICENSE +0 -0
  44. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/PyTmcStepper.egg-info/dependency_links.txt +0 -0
  45. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/PyTmcStepper.egg-info/requires.txt +0 -0
  46. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/PyTmcStepper.egg-info/top_level.txt +0 -0
  47. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/__init__.py +0 -0
  48. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/_tmc_exceptions.py +0 -0
  49. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/com/__init__.py +0 -0
  50. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/enable_control/__init__.py +0 -0
  51. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/motion_control/__init__.py +0 -0
  52. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/reg/__init__.py +0 -0
  53. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/reg/_tmc2209_reg.py +0 -0
  54. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/reg/_tmc220x_reg.py +0 -0
  55. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/reg/_tmc224x_reg.py +0 -0
  56. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/src/tmc_driver/tmc_2208.py +0 -0
  57. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/tests/test_tmc2209.py +0 -0
  58. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/tests/test_tmc2240.py +0 -0
  59. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/tests/test_tmc_ec_pin.py +0 -0
  60. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/tests/test_tmc_math.py +0 -0
  61. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/tests/test_tmc_modules.py +0 -0
  62. {pytmcstepper-0.9.0 → pytmcstepper-0.9.1}/tests/test_tmc_move.py +0 -0
@@ -1,19 +1,18 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyTmcStepper
3
- Version: 0.9.0
3
+ Version: 0.9.1
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
- Home-page: https://github.com/Chr157i4n/PyTmcStepper
6
- Author: Christian Köhlke
7
- Author-email: christian@koehlke.de
5
+ Author-email: Christian Köhlke <christian@koehlke.de>
6
+ License-Expression: GPL-3.0
7
+ Project-URL: Homepage, https://github.com/Chr157i4n/PyTmcStepper
8
8
  Project-URL: Bug Tracker, https://github.com/Chr157i4n/PyTmcStepper/issues
9
9
  Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
11
10
  Classifier: Operating System :: POSIX :: Linux
12
11
  Classifier: Development Status :: 4 - Beta
13
12
  Classifier: Intended Audience :: Developers
14
13
  Classifier: Natural Language :: English
15
14
  Classifier: Topic :: System :: Hardware :: Hardware Drivers
16
- Requires-Python: >=3.7
15
+ Requires-Python: >=3.10
17
16
  Description-Content-Type: text/markdown
18
17
  License-File: LICENSE
19
18
  Requires-Dist: pyserial
@@ -127,21 +126,21 @@ is split into their own classes to be able to support the diverse methods.
127
126
 
128
127
  The EnableControl module controls the motor current output. It has a function `set_motor_enabled` with one boolean parameter. This function is used to enable or disable the Motor current output.
129
128
 
130
- EnableControl | Class | Driver | Notes
131
- -- | -- | -- | --
129
+ EnableControl | Class | Driver | Notes
130
+ -- | -- | -- | --
132
131
  Pin | [TmcEnableControlPin](src/tmc_driver/enable_control/_tmc_ec_pin.py) | all | the EN Pin of the Driver needs to be connected to a GPIO of the Pi
133
- TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py) | all | the EN Pin needs to be connected to GND.<br />On the TMC2209 this enables current Output on Startup!<br />On the TMC2240 this works fine, because TOff is per default 0 (off).
132
+ TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py) | all | the EN Pin needs to be connected to GND.<br />On the TMC2209 this enables current Output on Startup!<br />On the TMC2240 this works fine, because TOff is per default 0 (off).
134
133
 
135
134
  ### MotionControl
136
135
 
137
136
  The MotionControl module controls the motion of the motor. Before a movement the motor current output needs to be enabled by the [EnableControl](#enablecontrol) module.
138
137
 
139
- MotionControl | Class | Driver | Notes
140
- -- | -- | -- | --
141
- STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py) | all | the STEP and DIR pin of the driver must each be connected to a GPIO of the Pi
142
- STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py) | all | only the STEP pin needs to be connected to a GPIO of the Pi.<br />The direction is controlled via the Register.
143
- VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py) | TMC220x | the Direction and Speed is controlled via Register. But VActual does only allow setting a speed and therefore cannot control positioning of the Motor.
144
- STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py) | all | In contrast to STEP/DIR, the step pin is controlled by PWM. This reduces the load on the CPU, but does not allow precise positioning (similar to the VACTUAL).<br />STEP must be connected to a PWM-capable pin for this purpose
138
+ MotionControl | Class | Driver | Notes
139
+ -- | -- | -- | --
140
+ STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py) | all | the STEP and DIR pin of the driver must each be connected to a GPIO of the Pi
141
+ STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py) | all | only the STEP pin needs to be connected to a GPIO of the Pi.<br />The direction is controlled via the Register.
142
+ VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py) | TMC220x | the Direction and Speed is controlled via Register. But VActual does only allow setting a speed and therefore cannot control positioning of the Motor.
143
+ STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py) | all | In contrast to STEP/DIR, the step pin is controlled by PWM. This reduces the load on the CPU, but does not allow precise positioning (similar to the VACTUAL).<br />STEP must be connected to a PWM-capable pin for this purpose
145
144
 
146
145
  Further methods of controlling the motion of a motor could be:
147
146
 
@@ -151,10 +150,10 @@ Further methods of controlling the motion of a motor could be:
151
150
 
152
151
  ### Com
153
152
 
154
- Com | Class | Driver | Notes
155
- -- | -- | -- | --
156
- UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py) | all | Communication via UART (RX, TX). See [Wiring](#uart)<br />[pyserial](https://pypi.org/project/pyserial) needs to be installed
157
- SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py) | TMC2240 | Communication via SPI (MOSI, MISO, CLK, CS). See [Wiring](#spi)<br />[spidev](https://pypi.org/project/spidev) needs to be installed
153
+ Com | Class | Driver | Notes
154
+ -- | -- | -- | --
155
+ UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py) | all | Communication via UART (RX, TX). See [Wiring](#uart)<br />[pyserial](https://pypi.org/project/pyserial) needs to be installed
156
+ SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py) | TMC2240 | Communication via SPI (MOSI, MISO, CLK, CS). See [Wiring](#spi)<br />[spidev](https://pypi.org/project/spidev) needs to be installed
158
157
  SPI over FT232H | [TmcComSpiFtdi](src/tmc_driver/com/_tmc_com_spi_ftdi.py) | TMC2240 | Communication via SPI using a FT232H. This can be used on any OS.<br />[pyftdi](https://pypi.org/project/pyftdi) needs to be installed
159
158
 
160
159
  ## Wiring
@@ -254,21 +253,18 @@ So you don't need to connect anything to the Vio pin of the driver.
254
253
 
255
254
  ### Micropython
256
255
 
257
- First you need to upload all need files to the µController with mpremote or another tool. You can use the script `upload_to_pico.py` for that.
258
- Then you can run a demo script by using
256
+ The lib is also compatible with MicroPython. For using it with Micropython the VSCode addon [MicroPico](https://marketplace.visualstudio.com/items?itemName=paulober.pico-w-go) is used. Use the Upload Project function to upload the src folder and the needed lib folder.
259
257
 
260
- some external micropython-lib are needed to be installed:
258
+ the needed libs, which are not builtin in Micropython are:
261
259
 
262
- ```shell
263
- python -m mpremote connect COM4 mip install threading
264
- python -m mpremote connect COM4 mip install types
265
- ```
266
-
267
- Run the demo script with:
260
+ Lib | available on MIP
261
+ -- | --
262
+ abc | yes
263
+ enum | no
264
+ threading | yes
265
+ types | yes
268
266
 
269
- ```shell
270
- python -m mpremote connect COM4 run .\demo\micropython\demo_script_tmc2240_03_basic_movement.py
271
- ```
267
+ You can also use MicroPico to run the demo script by opening one and then pressing Run on the bottom left corner
272
268
 
273
269
  ## Usage
274
270
 
@@ -304,15 +300,15 @@ If you encounter any problems, feel free to open an issue (ENG/GER).
304
300
  Please don't send any E-Mails to me. Pls use Github, so that i don't need to answer the same question multiple times.
305
301
  I reserve the right not to answer E-Mails.
306
302
 
307
- Problem | Solution
308
- -- | --
309
- FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0' | depending on your Raspberry Pi version, you need to enable the Serial Port <br /> run `sudo raspi-config` in your terminal. <br /> there go to '3 Interface Options' -> 'P3 Serial Port' <br /> Would you like a login shell to be accessible over serial? No <br /> Would you like the serial port hardware to be enabled? Yes <br /> Finish and then reboot
310
- PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0' | you need to give the permission to acces the Serial Port to your current user <br /> You may need to add your user (pi) to the dialout group with `sudo usermod -a -G dialout pi` and then relog. <br /> If that does not work, make sure that your user has read/write permissions on the dev file `/dev/serial0` by calling `sudo chmod 660 /dev/serial0`.
311
- "TMC2209: UART Communication Error" | You can use the 'debug_script_01_uart_connection' script to get a better reading on the received bytes and troubleshoot your problem
312
- "TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes" | only 4 total bytes received indicates, that the Raspberry Pi receives its own data, but nothing from the TMC driver. This happens if RX and TX are connected properly, but the TMC driver has no power
313
- "TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes" | 0 total bytes received indicates, a problem with your wiring or your Raspberry Pi. This happens if TX is not connected
314
- "TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes" | this indicates, the Raspberry Pi received only zeroes. This happens if only RX is connected and TX not
315
- "the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits | Make sure the UART ist properly connected to the TMC driver and the driver is powered and working. <br /> Make sure login shell (console) over serial is disabled.
303
+ Problem | Solution
304
+ -- | --
305
+ FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0' | depending on your Raspberry Pi version, you need to enable the Serial Port <br /> run `sudo raspi-config` in your terminal. <br /> there go to '3 Interface Options' -> 'P3 Serial Port' <br /> Would you like a login shell to be accessible over serial? No <br /> Would you like the serial port hardware to be enabled? Yes <br /> Finish and then reboot
306
+ PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0' | you need to give the permission to acces the Serial Port to your current user <br /> You may need to add your user (pi) to the dialout group with `sudo usermod -a -G dialout pi` and then relog. <br /> If that does not work, make sure that your user has read/write permissions on the dev file `/dev/serial0` by calling `sudo chmod 660 /dev/serial0`.
307
+ "TMC2209: UART Communication Error" | You can use the 'debug_script_01_uart_connection' script to get a better reading on the received bytes and troubleshoot your problem
308
+ "TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes" | only 4 total bytes received indicates, that the Raspberry Pi receives its own data, but nothing from the TMC driver. This happens if RX and TX are connected properly, but the TMC driver has no power
309
+ "TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes" | 0 total bytes received indicates, a problem with your wiring or your Raspberry Pi. This happens if TX is not connected
310
+ "TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes" | this indicates, the Raspberry Pi received only zeroes. This happens if only RX is connected and TX not
311
+ "the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits | Make sure the UART ist properly connected to the TMC driver and the driver is powered and working. <br /> Make sure login shell (console) over serial is disabled.
316
312
 
317
313
  ![wiring photo](docs/images/wiring_photo.jpg)
318
314
 
@@ -96,21 +96,21 @@ is split into their own classes to be able to support the diverse methods.
96
96
 
97
97
  The EnableControl module controls the motor current output. It has a function `set_motor_enabled` with one boolean parameter. This function is used to enable or disable the Motor current output.
98
98
 
99
- EnableControl | Class | Driver | Notes
100
- -- | -- | -- | --
99
+ EnableControl | Class | Driver | Notes
100
+ -- | -- | -- | --
101
101
  Pin | [TmcEnableControlPin](src/tmc_driver/enable_control/_tmc_ec_pin.py) | all | the EN Pin of the Driver needs to be connected to a GPIO of the Pi
102
- TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py) | all | the EN Pin needs to be connected to GND.<br />On the TMC2209 this enables current Output on Startup!<br />On the TMC2240 this works fine, because TOff is per default 0 (off).
102
+ TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py) | all | the EN Pin needs to be connected to GND.<br />On the TMC2209 this enables current Output on Startup!<br />On the TMC2240 this works fine, because TOff is per default 0 (off).
103
103
 
104
104
  ### MotionControl
105
105
 
106
106
  The MotionControl module controls the motion of the motor. Before a movement the motor current output needs to be enabled by the [EnableControl](#enablecontrol) module.
107
107
 
108
- MotionControl | Class | Driver | Notes
109
- -- | -- | -- | --
110
- STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py) | all | the STEP and DIR pin of the driver must each be connected to a GPIO of the Pi
111
- STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py) | all | only the STEP pin needs to be connected to a GPIO of the Pi.<br />The direction is controlled via the Register.
112
- VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py) | TMC220x | the Direction and Speed is controlled via Register. But VActual does only allow setting a speed and therefore cannot control positioning of the Motor.
113
- STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py) | all | In contrast to STEP/DIR, the step pin is controlled by PWM. This reduces the load on the CPU, but does not allow precise positioning (similar to the VACTUAL).<br />STEP must be connected to a PWM-capable pin for this purpose
108
+ MotionControl | Class | Driver | Notes
109
+ -- | -- | -- | --
110
+ STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py) | all | the STEP and DIR pin of the driver must each be connected to a GPIO of the Pi
111
+ STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py) | all | only the STEP pin needs to be connected to a GPIO of the Pi.<br />The direction is controlled via the Register.
112
+ VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py) | TMC220x | the Direction and Speed is controlled via Register. But VActual does only allow setting a speed and therefore cannot control positioning of the Motor.
113
+ STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py) | all | In contrast to STEP/DIR, the step pin is controlled by PWM. This reduces the load on the CPU, but does not allow precise positioning (similar to the VACTUAL).<br />STEP must be connected to a PWM-capable pin for this purpose
114
114
 
115
115
  Further methods of controlling the motion of a motor could be:
116
116
 
@@ -120,10 +120,10 @@ Further methods of controlling the motion of a motor could be:
120
120
 
121
121
  ### Com
122
122
 
123
- Com | Class | Driver | Notes
124
- -- | -- | -- | --
125
- UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py) | all | Communication via UART (RX, TX). See [Wiring](#uart)<br />[pyserial](https://pypi.org/project/pyserial) needs to be installed
126
- SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py) | TMC2240 | Communication via SPI (MOSI, MISO, CLK, CS). See [Wiring](#spi)<br />[spidev](https://pypi.org/project/spidev) needs to be installed
123
+ Com | Class | Driver | Notes
124
+ -- | -- | -- | --
125
+ UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py) | all | Communication via UART (RX, TX). See [Wiring](#uart)<br />[pyserial](https://pypi.org/project/pyserial) needs to be installed
126
+ SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py) | TMC2240 | Communication via SPI (MOSI, MISO, CLK, CS). See [Wiring](#spi)<br />[spidev](https://pypi.org/project/spidev) needs to be installed
127
127
  SPI over FT232H | [TmcComSpiFtdi](src/tmc_driver/com/_tmc_com_spi_ftdi.py) | TMC2240 | Communication via SPI using a FT232H. This can be used on any OS.<br />[pyftdi](https://pypi.org/project/pyftdi) needs to be installed
128
128
 
129
129
  ## Wiring
@@ -223,21 +223,18 @@ So you don't need to connect anything to the Vio pin of the driver.
223
223
 
224
224
  ### Micropython
225
225
 
226
- First you need to upload all need files to the µController with mpremote or another tool. You can use the script `upload_to_pico.py` for that.
227
- Then you can run a demo script by using
226
+ The lib is also compatible with MicroPython. For using it with Micropython the VSCode addon [MicroPico](https://marketplace.visualstudio.com/items?itemName=paulober.pico-w-go) is used. Use the Upload Project function to upload the src folder and the needed lib folder.
228
227
 
229
- some external micropython-lib are needed to be installed:
228
+ the needed libs, which are not builtin in Micropython are:
230
229
 
231
- ```shell
232
- python -m mpremote connect COM4 mip install threading
233
- python -m mpremote connect COM4 mip install types
234
- ```
235
-
236
- Run the demo script with:
230
+ Lib | available on MIP
231
+ -- | --
232
+ abc | yes
233
+ enum | no
234
+ threading | yes
235
+ types | yes
237
236
 
238
- ```shell
239
- python -m mpremote connect COM4 run .\demo\micropython\demo_script_tmc2240_03_basic_movement.py
240
- ```
237
+ You can also use MicroPico to run the demo script by opening one and then pressing Run on the bottom left corner
241
238
 
242
239
  ## Usage
243
240
 
@@ -273,15 +270,15 @@ If you encounter any problems, feel free to open an issue (ENG/GER).
273
270
  Please don't send any E-Mails to me. Pls use Github, so that i don't need to answer the same question multiple times.
274
271
  I reserve the right not to answer E-Mails.
275
272
 
276
- Problem | Solution
277
- -- | --
278
- FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0' | depending on your Raspberry Pi version, you need to enable the Serial Port <br /> run `sudo raspi-config` in your terminal. <br /> there go to '3 Interface Options' -> 'P3 Serial Port' <br /> Would you like a login shell to be accessible over serial? No <br /> Would you like the serial port hardware to be enabled? Yes <br /> Finish and then reboot
279
- PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0' | you need to give the permission to acces the Serial Port to your current user <br /> You may need to add your user (pi) to the dialout group with `sudo usermod -a -G dialout pi` and then relog. <br /> If that does not work, make sure that your user has read/write permissions on the dev file `/dev/serial0` by calling `sudo chmod 660 /dev/serial0`.
280
- "TMC2209: UART Communication Error" | You can use the 'debug_script_01_uart_connection' script to get a better reading on the received bytes and troubleshoot your problem
281
- "TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes" | only 4 total bytes received indicates, that the Raspberry Pi receives its own data, but nothing from the TMC driver. This happens if RX and TX are connected properly, but the TMC driver has no power
282
- "TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes" | 0 total bytes received indicates, a problem with your wiring or your Raspberry Pi. This happens if TX is not connected
283
- "TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes" | this indicates, the Raspberry Pi received only zeroes. This happens if only RX is connected and TX not
284
- "the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits | Make sure the UART ist properly connected to the TMC driver and the driver is powered and working. <br /> Make sure login shell (console) over serial is disabled.
273
+ Problem | Solution
274
+ -- | --
275
+ FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0' | depending on your Raspberry Pi version, you need to enable the Serial Port <br /> run `sudo raspi-config` in your terminal. <br /> there go to '3 Interface Options' -> 'P3 Serial Port' <br /> Would you like a login shell to be accessible over serial? No <br /> Would you like the serial port hardware to be enabled? Yes <br /> Finish and then reboot
276
+ PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0' | you need to give the permission to acces the Serial Port to your current user <br /> You may need to add your user (pi) to the dialout group with `sudo usermod -a -G dialout pi` and then relog. <br /> If that does not work, make sure that your user has read/write permissions on the dev file `/dev/serial0` by calling `sudo chmod 660 /dev/serial0`.
277
+ "TMC2209: UART Communication Error" | You can use the 'debug_script_01_uart_connection' script to get a better reading on the received bytes and troubleshoot your problem
278
+ "TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes" | only 4 total bytes received indicates, that the Raspberry Pi receives its own data, but nothing from the TMC driver. This happens if RX and TX are connected properly, but the TMC driver has no power
279
+ "TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes" | 0 total bytes received indicates, a problem with your wiring or your Raspberry Pi. This happens if TX is not connected
280
+ "TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes" | this indicates, the Raspberry Pi received only zeroes. This happens if only RX is connected and TX not
281
+ "the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits | Make sure the UART ist properly connected to the TMC driver and the driver is powered and working. <br /> Make sure login shell (console) over serial is disabled.
285
282
 
286
283
  ![wiring photo](docs/images/wiring_photo.jpg)
287
284
 
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools>=42",
4
+ "wheel"
5
+ ]
6
+ build-backend = "setuptools.build_meta"
7
+
8
+ [project]
9
+ name = "PyTmcStepper"
10
+ version = "0.9.1"
11
+ authors = [
12
+ { name = "Christian Köhlke", email = "christian@koehlke.de" }
13
+ ]
14
+ 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"
15
+ readme = "README.md"
16
+ license = "GPL-3.0"
17
+ requires-python = ">=3.10"
18
+ classifiers = [
19
+ "Programming Language :: Python :: 3",
20
+ "Operating System :: POSIX :: Linux",
21
+ "Development Status :: 4 - Beta",
22
+ "Intended Audience :: Developers",
23
+ "Natural Language :: English",
24
+ "Topic :: System :: Hardware :: Hardware Drivers",
25
+ ]
26
+ dependencies = [
27
+ "pyserial",
28
+ ]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/Chr157i4n/PyTmcStepper"
32
+ "Bug Tracker" = "https://github.com/Chr157i4n/PyTmcStepper/issues"
33
+
34
+ [project.optional-dependencies]
35
+ RASPBERRY_PI = ["RPi.GPIO"]
36
+ RASPBERRY_PI5 = ["gpiozero"]
37
+ NVIDIA_JETSON = ["Jetson.GPIO"]
38
+ LUCKFOX_PICO = ["python-periphery"]
39
+ ORANGE_PI = ["OPi.GPIO"]
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["src"]
43
+
44
+ [tool.pylint."messages control"]
45
+ disable = "C0103,W0511,W0012,R0801"
46
+
47
+ [tool.pylint.main]
48
+ ignored-modules = "machine"
49
+ unsafe-load-any-extension = true
50
+
51
+ [tool.pylint.format]
52
+ max-line-length = 160
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -1,19 +1,18 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyTmcStepper
3
- Version: 0.9.0
3
+ Version: 0.9.1
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
- Home-page: https://github.com/Chr157i4n/PyTmcStepper
6
- Author: Christian Köhlke
7
- Author-email: christian@koehlke.de
5
+ Author-email: Christian Köhlke <christian@koehlke.de>
6
+ License-Expression: GPL-3.0
7
+ Project-URL: Homepage, https://github.com/Chr157i4n/PyTmcStepper
8
8
  Project-URL: Bug Tracker, https://github.com/Chr157i4n/PyTmcStepper/issues
9
9
  Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
11
10
  Classifier: Operating System :: POSIX :: Linux
12
11
  Classifier: Development Status :: 4 - Beta
13
12
  Classifier: Intended Audience :: Developers
14
13
  Classifier: Natural Language :: English
15
14
  Classifier: Topic :: System :: Hardware :: Hardware Drivers
16
- Requires-Python: >=3.7
15
+ Requires-Python: >=3.10
17
16
  Description-Content-Type: text/markdown
18
17
  License-File: LICENSE
19
18
  Requires-Dist: pyserial
@@ -127,21 +126,21 @@ is split into their own classes to be able to support the diverse methods.
127
126
 
128
127
  The EnableControl module controls the motor current output. It has a function `set_motor_enabled` with one boolean parameter. This function is used to enable or disable the Motor current output.
129
128
 
130
- EnableControl | Class | Driver | Notes
131
- -- | -- | -- | --
129
+ EnableControl | Class | Driver | Notes
130
+ -- | -- | -- | --
132
131
  Pin | [TmcEnableControlPin](src/tmc_driver/enable_control/_tmc_ec_pin.py) | all | the EN Pin of the Driver needs to be connected to a GPIO of the Pi
133
- TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py) | all | the EN Pin needs to be connected to GND.<br />On the TMC2209 this enables current Output on Startup!<br />On the TMC2240 this works fine, because TOff is per default 0 (off).
132
+ TOff | [TmcEnableControlToff](src/tmc_driver/enable_control/_tmc_ec_toff.py) | all | the EN Pin needs to be connected to GND.<br />On the TMC2209 this enables current Output on Startup!<br />On the TMC2240 this works fine, because TOff is per default 0 (off).
134
133
 
135
134
  ### MotionControl
136
135
 
137
136
  The MotionControl module controls the motion of the motor. Before a movement the motor current output needs to be enabled by the [EnableControl](#enablecontrol) module.
138
137
 
139
- MotionControl | Class | Driver | Notes
140
- -- | -- | -- | --
141
- STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py) | all | the STEP and DIR pin of the driver must each be connected to a GPIO of the Pi
142
- STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py) | all | only the STEP pin needs to be connected to a GPIO of the Pi.<br />The direction is controlled via the Register.
143
- VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py) | TMC220x | the Direction and Speed is controlled via Register. But VActual does only allow setting a speed and therefore cannot control positioning of the Motor.
144
- STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py) | all | In contrast to STEP/DIR, the step pin is controlled by PWM. This reduces the load on the CPU, but does not allow precise positioning (similar to the VACTUAL).<br />STEP must be connected to a PWM-capable pin for this purpose
138
+ MotionControl | Class | Driver | Notes
139
+ -- | -- | -- | --
140
+ STEP/DIR | [TmcMotionControlStepDir](src/tmc_driver/motion_control/_tmc_mc_step_dir.py) | all | the STEP and DIR pin of the driver must each be connected to a GPIO of the Pi
141
+ STEP/REG | [TmcMotionControlStepReg](src/tmc_driver/motion_control/_tmc_mc_step_reg.py) | all | only the STEP pin needs to be connected to a GPIO of the Pi.<br />The direction is controlled via the Register.
142
+ VACTUAL | [TmcMotionControlVActual](src/tmc_driver/motion_control/_tmc_mc_vactual.py) | TMC220x | the Direction and Speed is controlled via Register. But VActual does only allow setting a speed and therefore cannot control positioning of the Motor.
143
+ STEP_PWM/DIR | [TmcMotionControlStepPwmDir](src/tmc_driver/motion_control/_tmc_mc_step_pwm_dir.py) | all | In contrast to STEP/DIR, the step pin is controlled by PWM. This reduces the load on the CPU, but does not allow precise positioning (similar to the VACTUAL).<br />STEP must be connected to a PWM-capable pin for this purpose
145
144
 
146
145
  Further methods of controlling the motion of a motor could be:
147
146
 
@@ -151,10 +150,10 @@ Further methods of controlling the motion of a motor could be:
151
150
 
152
151
  ### Com
153
152
 
154
- Com | Class | Driver | Notes
155
- -- | -- | -- | --
156
- UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py) | all | Communication via UART (RX, TX). See [Wiring](#uart)<br />[pyserial](https://pypi.org/project/pyserial) needs to be installed
157
- SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py) | TMC2240 | Communication via SPI (MOSI, MISO, CLK, CS). See [Wiring](#spi)<br />[spidev](https://pypi.org/project/spidev) needs to be installed
153
+ Com | Class | Driver | Notes
154
+ -- | -- | -- | --
155
+ UART | [TmcComUart](src/tmc_driver/com/_tmc_com_uart.py) | all | Communication via UART (RX, TX). See [Wiring](#uart)<br />[pyserial](https://pypi.org/project/pyserial) needs to be installed
156
+ SPI | [TmcComSpi](src/tmc_driver/com/_tmc_com_spi.py) | TMC2240 | Communication via SPI (MOSI, MISO, CLK, CS). See [Wiring](#spi)<br />[spidev](https://pypi.org/project/spidev) needs to be installed
158
157
  SPI over FT232H | [TmcComSpiFtdi](src/tmc_driver/com/_tmc_com_spi_ftdi.py) | TMC2240 | Communication via SPI using a FT232H. This can be used on any OS.<br />[pyftdi](https://pypi.org/project/pyftdi) needs to be installed
159
158
 
160
159
  ## Wiring
@@ -254,21 +253,18 @@ So you don't need to connect anything to the Vio pin of the driver.
254
253
 
255
254
  ### Micropython
256
255
 
257
- First you need to upload all need files to the µController with mpremote or another tool. You can use the script `upload_to_pico.py` for that.
258
- Then you can run a demo script by using
256
+ The lib is also compatible with MicroPython. For using it with Micropython the VSCode addon [MicroPico](https://marketplace.visualstudio.com/items?itemName=paulober.pico-w-go) is used. Use the Upload Project function to upload the src folder and the needed lib folder.
259
257
 
260
- some external micropython-lib are needed to be installed:
258
+ the needed libs, which are not builtin in Micropython are:
261
259
 
262
- ```shell
263
- python -m mpremote connect COM4 mip install threading
264
- python -m mpremote connect COM4 mip install types
265
- ```
266
-
267
- Run the demo script with:
260
+ Lib | available on MIP
261
+ -- | --
262
+ abc | yes
263
+ enum | no
264
+ threading | yes
265
+ types | yes
268
266
 
269
- ```shell
270
- python -m mpremote connect COM4 run .\demo\micropython\demo_script_tmc2240_03_basic_movement.py
271
- ```
267
+ You can also use MicroPico to run the demo script by opening one and then pressing Run on the bottom left corner
272
268
 
273
269
  ## Usage
274
270
 
@@ -304,15 +300,15 @@ If you encounter any problems, feel free to open an issue (ENG/GER).
304
300
  Please don't send any E-Mails to me. Pls use Github, so that i don't need to answer the same question multiple times.
305
301
  I reserve the right not to answer E-Mails.
306
302
 
307
- Problem | Solution
308
- -- | --
309
- FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0' | depending on your Raspberry Pi version, you need to enable the Serial Port <br /> run `sudo raspi-config` in your terminal. <br /> there go to '3 Interface Options' -> 'P3 Serial Port' <br /> Would you like a login shell to be accessible over serial? No <br /> Would you like the serial port hardware to be enabled? Yes <br /> Finish and then reboot
310
- PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0' | you need to give the permission to acces the Serial Port to your current user <br /> You may need to add your user (pi) to the dialout group with `sudo usermod -a -G dialout pi` and then relog. <br /> If that does not work, make sure that your user has read/write permissions on the dev file `/dev/serial0` by calling `sudo chmod 660 /dev/serial0`.
311
- "TMC2209: UART Communication Error" | You can use the 'debug_script_01_uart_connection' script to get a better reading on the received bytes and troubleshoot your problem
312
- "TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes" | only 4 total bytes received indicates, that the Raspberry Pi receives its own data, but nothing from the TMC driver. This happens if RX and TX are connected properly, but the TMC driver has no power
313
- "TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes" | 0 total bytes received indicates, a problem with your wiring or your Raspberry Pi. This happens if TX is not connected
314
- "TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes" | this indicates, the Raspberry Pi received only zeroes. This happens if only RX is connected and TX not
315
- "the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits | Make sure the UART ist properly connected to the TMC driver and the driver is powered and working. <br /> Make sure login shell (console) over serial is disabled.
303
+ Problem | Solution
304
+ -- | --
305
+ FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial0' | depending on your Raspberry Pi version, you need to enable the Serial Port <br /> run `sudo raspi-config` in your terminal. <br /> there go to '3 Interface Options' -> 'P3 Serial Port' <br /> Would you like a login shell to be accessible over serial? No <br /> Would you like the serial port hardware to be enabled? Yes <br /> Finish and then reboot
306
+ PermissionError: [Errno 13] <br /> Permission denied: '/dev/serial0' | you need to give the permission to acces the Serial Port to your current user <br /> You may need to add your user (pi) to the dialout group with `sudo usermod -a -G dialout pi` and then relog. <br /> If that does not work, make sure that your user has read/write permissions on the dev file `/dev/serial0` by calling `sudo chmod 660 /dev/serial0`.
307
+ "TMC2209: UART Communication Error" | You can use the 'debug_script_01_uart_connection' script to get a better reading on the received bytes and troubleshoot your problem
308
+ "TMC2209: UART Communication Error: 0 data bytes \| 4 total bytes" | only 4 total bytes received indicates, that the Raspberry Pi receives its own data, but nothing from the TMC driver. This happens if RX and TX are connected properly, but the TMC driver has no power
309
+ "TMC2209: UART Communication Error: 0 data bytes \| 0 total bytes" | 0 total bytes received indicates, a problem with your wiring or your Raspberry Pi. This happens if TX is not connected
310
+ "TMC2209: UART Communication Error: 4 data bytes \| 12 total bytes" | this indicates, the Raspberry Pi received only zeroes. This happens if only RX is connected and TX not
311
+ "the Raspberry Pi received only the sended bits" or<br /> inconsistent received bits | Make sure the UART ist properly connected to the TMC driver and the driver is powered and working. <br /> Make sure login shell (console) over serial is disabled.
316
312
 
317
313
  ![wiring photo](docs/images/wiring_photo.jpg)
318
314
 
@@ -1,7 +1,6 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
- setup.cfg
5
4
  src/PyTmcStepper.egg-info/PKG-INFO
6
5
  src/PyTmcStepper.egg-info/SOURCES.txt
7
6
  src/PyTmcStepper.egg-info/dependency_links.txt
@@ -9,7 +8,6 @@ src/PyTmcStepper.egg-info/requires.txt
9
8
  src/PyTmcStepper.egg-info/top_level.txt
10
9
  src/tmc_driver/__init__.py
11
10
  src/tmc_driver/_tmc_exceptions.py
12
- src/tmc_driver/_tmc_gpio_board.py
13
11
  src/tmc_driver/_tmc_logger.py
14
12
  src/tmc_driver/_tmc_math.py
15
13
  src/tmc_driver/_tmc_stallguard.py
@@ -42,6 +40,13 @@ src/tmc_driver/reg/_tmc2209_reg.py
42
40
  src/tmc_driver/reg/_tmc220x_reg.py
43
41
  src/tmc_driver/reg/_tmc224x_reg.py
44
42
  src/tmc_driver/reg/_tmc_reg.py
43
+ src/tmc_driver/tmc_gpio/__init__.py
44
+ src/tmc_driver/tmc_gpio/_tmc_gpio_board_base.py
45
+ src/tmc_driver/tmc_gpio/_tmc_gpio_board_ftdi.py
46
+ src/tmc_driver/tmc_gpio/_tmc_gpio_board_gpiozero.py
47
+ src/tmc_driver/tmc_gpio/_tmc_gpio_board_micropython.py
48
+ src/tmc_driver/tmc_gpio/_tmc_gpio_board_periphery.py
49
+ src/tmc_driver/tmc_gpio/_tmc_gpio_board_rpi_gpio.py
45
50
  tests/test_tmc2209.py
46
51
  tests/test_tmc2240.py
47
52
  tests/test_tmc_com_spi.py
@@ -4,7 +4,7 @@
4
4
  Tmc2209 stepper driver logger module
5
5
  """
6
6
 
7
- from enum import Enum
7
+ from enum import IntEnum
8
8
  import sys
9
9
 
10
10
  # Detect MicroPython
@@ -17,7 +17,7 @@ if not MICROPYTHON:
17
17
 
18
18
 
19
19
 
20
- class Loglevel(Enum):
20
+ class Loglevel(IntEnum):
21
21
  """loglevel"""
22
22
  ALL = 1 # all messages will be logged
23
23
  MOVEMENT = 5 # error, warning, info, debug and movement messages will be logged
@@ -27,9 +27,6 @@ class Loglevel(Enum):
27
27
  ERROR = 40 # only error messages will be logged
28
28
  NONE = -1 # no messages will be logged
29
29
 
30
- def __int__(self):
31
- return self.value
32
-
33
30
 
34
31
 
35
32
  if MICROPYTHON:
@@ -94,8 +91,8 @@ else:
94
91
  def __init__(self,
95
92
  loglevel: Loglevel = Loglevel.INFO,
96
93
  logprefix: str = "TMC2209",
97
- handlers: list = None,
98
- formatter: logging.Formatter = None):
94
+ handlers: list|None = None,
95
+ formatter: logging.Formatter|None = None):
99
96
  """constructor
100
97
 
101
98
  Args:
@@ -196,7 +193,7 @@ else:
196
193
 
197
194
 
198
195
  @staticmethod
199
- def _add_logging_level(level_name: str, level_num: int, method_name: str = None):
196
+ def _add_logging_level(level_name: str, level_num: int, method_name: str|None = None):
200
197
  if not method_name:
201
198
  method_name = level_name.lower()
202
199
 
@@ -117,4 +117,4 @@ def mean(data) -> int:
117
117
 
118
118
  total = sum(data)
119
119
 
120
- return total / count
120
+ return total // count
@@ -14,8 +14,8 @@
14
14
  import types
15
15
  from ._tmc_stepperdriver import *
16
16
  from .com._tmc_com import TmcCom
17
- from ._tmc_gpio_board import GpioPUD, GpioMode
18
- from . import _tmc_gpio_board as tmc_gpio
17
+ from .tmc_gpio import GpioPUD, GpioMode
18
+ from . import tmc_gpio
19
19
  from ._tmc_logger import Loglevel
20
20
  from .reg._tmc224x_reg import *
21
21
  from . import _tmc_math as tmc_math
@@ -33,8 +33,8 @@ class StallGuard():
33
33
 
34
34
  def __init__(self):
35
35
  """initialize StallGuard instance variables"""
36
- self._pin_stallguard:int = None
37
- self._sg_callback:types.FunctionType = None
36
+ self._pin_stallguard:int|None = None
37
+ self._sg_callback:types.FunctionType|None = None
38
38
 
39
39
 
40
40
  def __del__(self):
@@ -5,20 +5,21 @@
5
5
  #pylint: disable=import-outside-toplevel
6
6
  #pylint: disable=bare-except
7
7
  #pylint: disable=unused-import
8
+ #pylint: disable=wildcard-import
9
+ #pylint: disable=unused-wildcard-import
8
10
  """TmcStepperDriver module
9
11
 
10
12
  this module has the function to move the motor via STEP/DIR pins
11
13
  """
12
14
 
13
- import logging
14
- from ._tmc_gpio_board import Gpio, GpioMode, Board
15
- from . import _tmc_gpio_board as tmc_gpio
15
+ from .tmc_gpio import Gpio, GpioMode, Board
16
+ from . import tmc_gpio
16
17
  from .motion_control._tmc_mc import TmcMotionControl, MovementAbsRel, MovementPhase, StopMode, Direction
17
18
  from .enable_control._tmc_ec import TmcEnableControl
18
19
  from .enable_control._tmc_ec_pin import TmcEnableControlPin
19
20
  from .motion_control._tmc_mc_step_dir import TmcMotionControlStepDir
20
21
  from .motion_control._tmc_mc_step_pwm_dir import TmcMotionControlStepPwmDir
21
- from ._tmc_logger import TmcLogger, Loglevel
22
+ from ._tmc_logger import *
22
23
  from . import _tmc_math as tmc_math
23
24
 
24
25
 
@@ -39,9 +40,9 @@ class TmcStepperDriver:
39
40
  tmc_mc:TmcMotionControl,
40
41
  gpio_mode = None,
41
42
  loglevel:Loglevel = Loglevel.INFO,
42
- logprefix:str = None,
43
- log_handlers:list = None,
44
- log_formatter:logging.Formatter = None
43
+ logprefix:str|None = None,
44
+ log_handlers:list|None = None,
45
+ log_formatter:logging.Formatter|None = None
45
46
  ):
46
47
  """constructor
47
48
 
@@ -62,9 +63,9 @@ class TmcStepperDriver:
62
63
  '%(asctime)s - %(name)s - %(levelname)s - %(message)s').
63
64
  """
64
65
  self.BOARD:Board = tmc_gpio.BOARD
65
- self.tmc_mc:TmcMotionControl = None
66
- self.tmc_ec:TmcEnableControl = None
67
- self.tmc_logger:TmcLogger = None
66
+ self.tmc_mc:TmcMotionControl|None = None
67
+ self.tmc_ec:TmcEnableControl|None = None
68
+ self.tmc_logger:TmcLogger|None = None
68
69
 
69
70
  self._deinit_finished:bool = False
70
71
 
@@ -269,19 +270,19 @@ class TmcStepperDriver:
269
270
  self.tmc_mc.acceleration_fullstep = acceleration_fullstep
270
271
 
271
272
 
272
- def run_to_position_steps(self, steps, movement_abs_rel:MovementAbsRel = None) -> StopMode:
273
+ def run_to_position_steps(self, steps, movement_abs_rel:MovementAbsRel|None = None) -> StopMode:
273
274
  """motioncontrol wrapper"""
274
275
  if self.tmc_mc is not None:
275
276
  return self.tmc_mc.run_to_position_steps(steps, movement_abs_rel)
276
- return None
277
+ return StopMode.NO
277
278
 
278
279
 
279
- def run_to_position_fullsteps(self, steps, movement_abs_rel:MovementAbsRel = None) -> StopMode:
280
+ def run_to_position_fullsteps(self, steps, movement_abs_rel:MovementAbsRel|None = None) -> StopMode:
280
281
  """motioncontrol wrapper"""
281
282
  return self.run_to_position_steps(steps * self.mres, movement_abs_rel)
282
283
 
283
284
 
284
- def run_to_position_revolutions(self, revs, movement_abs_rel:MovementAbsRel = None) -> StopMode:
285
+ def run_to_position_revolutions(self, revs, movement_abs_rel:MovementAbsRel|None = None) -> StopMode:
285
286
  """motioncontrol wrapper"""
286
287
  return self.run_to_position_steps(revs * self.steps_per_rev, movement_abs_rel)
287
288