Metadata-Version: 2.1
Name: pyx2cscope
Version: 0.6.1
Summary: python implementation of X2Cscope
Home-page: https://x2cscope.github.io/
License: Proprietary
Author: Yash Agarwal
Requires-Python: >=3.10,<4.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: PyQt5 (>=5.15.9,<6.0.0)
Requires-Dist: flask (>=3.0.3,<4.0.0)
Requires-Dist: matplotlib (>=3.7.2,<4.0.0)
Requires-Dist: mchplnet (==0.4.1)
Requires-Dist: numpy (>=1.26.0,<2.0.0)
Requires-Dist: pyelftools (>=0.31,<0.32)
Requires-Dist: pyqtgraph (>=0.13.7,<0.14.0)
Requires-Dist: pyserial (>=3.5,<4.0)
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
Project-URL: Documentation, https://x2cscope.github.io/pyx2cscope
Project-URL: Repository, https://github.com/X2Cscope/pyx2cscope
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://raw.githubusercontent.com/X2Cscope/pyx2cscope/refs/heads/main/doc/images/pyx2cscope_logo.png" alt="pyX2Cscope Logo" width="250">
</p>

# pyX2Cscope
The pyx2cscope Python package communicates with X2Cscope enabled firmwares running on microcontrollers. Focusing real time control applications like motor control and power conversion.
- It allows user to:
  - Read - Write variables to the embedded target in runtime
  - Record and Plot fast, continuous signals from the target firmware
  - Implement Automated Unit Tests (TDD) and HIL tests for embedded development
  - Record data in run-time for AI models
  - Implement custom user interface, dashboards for embedded applications (QT, Tkinter, Web)

Detailed documentation is hosted at GitHub.io:
[https://x2cscope.github.io/pyx2cscope/](https://x2cscope.github.io/pyx2cscope/)

## Install

Create a virtual environment and install pyx2cscope using the following commands (Windows):
```
python -m venv .venv
.venv\Scripts\activate
pip install pyx2cscope
```

## Start GUI

To execute Qt version, type:
```
   pyx2cscope
```
To execute the Browser based version type:

```
   pyx2cscope -w
```

## Basic scripting

```py
from pyx2cscope.x2cscope import X2CScope

# initialize the X2CScope class with serial port, by default baud rate is 115200
x2c_scope = X2CScope(port="COM8")
# instead of loading directly the elf file, we can import it after instantiating the X2CScope class
x2c_scope.import_variables(r"..\..\tests\data\qspin_foc_same54.elf")

# Collect some variables.
speed_reference = x2c_scope.get_variable("motor.apiData.velocityReference")
speed_measured = x2c_scope.get_variable("motor.apiData.velocityMeasured")

# Read the value of the "motor.apiData.velocityMeasured" variable from the target
print(speed_measured.get_value())
# Write a new value to the "motor.apiData.velocityReference" variable on the target
speed_reference.set_value(1000)
```

Check [Examples](https://github.com/X2Cscope/pyx2cscope/tree/main/pyx2cscope/examples) directory in the pyX2Cscope project to see common uses of this library.

## Development

[https://github.com/X2Cscope/pyx2cscope/tree/main/doc/development.md](https://github.com/X2Cscope/pyx2cscope/tree/main/doc/development.md)


