-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Examples/TMC9660: Add a demo that reads all registers and fields of T…
…MC9660.MCC
- Loading branch information
1 parent
ffe0c4c
commit 9399c20
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
examples/evalboards/TMC9660/reg/with_landungsbruecke/read_all_mcc_register_and_fields.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
################################################################################ | ||
# Copyright © 2025 Analog Devices Inc. All Rights Reserved. | ||
# This software is proprietary to Analog Devices, Inc. and its licensors. | ||
################################################################################ | ||
"""Example on how to use TMC9660-3PH-EVKIT. | ||
Note: To run this script the TMC9660-3PH-EVAL first needs an uploaded/burned configuration | ||
and the register app must have been started. | ||
+-----+ +-------------------+ | ||
USB | |==| | | ||
-------| |==| | | ||
Connected to the machine | |==| | | ||
running this script. |LB |==|TMC9660-3PH-EVAL | | ||
+-----+ +-------------------+ | ||
""" | ||
|
||
import time | ||
|
||
from pytrinamic.connections import ConnectionManager | ||
|
||
from pytrinamic.ic import TMC9660 | ||
from pytrinamic.evalboards import TMC9660_3PH_eval | ||
|
||
|
||
with ConnectionManager().connect() as my_interface: | ||
|
||
tmc9660_eval = TMC9660_3PH_eval(my_interface) | ||
|
||
for register in TMC9660.MCC.registers(): | ||
register_value = tmc9660_eval.read(register) | ||
print(f"{register.name:17}: 0x{register_value:08X}") | ||
for field in register.fields(): | ||
field_value = field.get(register_value) | ||
if field.choice: | ||
print(f" {field.name:22}: {field.choice.get(field_value).name}") | ||
else: | ||
print(f" {field.name:22}: {field_value}") | ||
|