mirror of
https://github.com/0xMax42/pydepp.git
synced 2025-08-06 02:20:21 +02:00
Add LICENSE file and update README with project details and usage examples
This commit is contained in:
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 0xMax42
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
120
README.md
120
README.md
@@ -1 +1,119 @@
|
|||||||
# Digilent Asynchronous Parallel Port Interface (DEPP)
|
# PyDEPP: Python Bindings for the Digilent DEPP Protocol
|
||||||
|
|
||||||
|
PyDEPP is a Python library that provides a high-level, object-oriented interface for interacting with Digilent FPGA boards over the DEPP (Digilent Asynchronous Parallel Port) protocol. It leverages the Digilent Adept SDK to enable seamless communication with DEPP-compatible devices.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Register Access**: Read and write single or multiple registers with ease.
|
||||||
|
- **Data Streaming**: Stream data to and from registers for high-performance applications.
|
||||||
|
- **Timeout Configuration**: Set custom communication timeouts for DEPP operations.
|
||||||
|
- **Context Management**: Use Python's `with` statement for automatic resource management.
|
||||||
|
- **Debugging Tools**: Includes a detailed register dump for inspection and debugging.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Python 3.7 or higher
|
||||||
|
- Digilent Adept Runtime and SDK installed on your system
|
||||||
|
- Shared libraries `libdmgr.so` and `libdepp.so` available in your library paths
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### From Source
|
||||||
|
|
||||||
|
1. Clone the repository:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/0xMax42/pydepp.git
|
||||||
|
cd pydepp
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Install the library:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install .
|
||||||
|
```
|
||||||
|
|
||||||
|
### Debian Package
|
||||||
|
|
||||||
|
You can also build and install the Debian package:
|
||||||
|
|
||||||
|
1. Build the package:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dpkg-buildpackage -us -uc
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Install the package:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo dpkg -i ../pydepp_0.1.1_all.deb
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Basic Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from pydepp import AdeptDepp
|
||||||
|
|
||||||
|
DEVICE_NAME = "Basys3"
|
||||||
|
|
||||||
|
with AdeptDepp(DEVICE_NAME) as depp:
|
||||||
|
# Read a register
|
||||||
|
value = depp.get_reg(0)
|
||||||
|
print(f"Register 0 value: {value}")
|
||||||
|
|
||||||
|
# Write to a register
|
||||||
|
depp.set_reg(0, 42)
|
||||||
|
print("Wrote 42 to register 0")
|
||||||
|
|
||||||
|
# Stream data
|
||||||
|
data = bytes([1, 2, 3, 4, 5])
|
||||||
|
depp.put_stream(4, data)
|
||||||
|
print("Streamed data to register 4")
|
||||||
|
```
|
||||||
|
|
||||||
|
### Full Example
|
||||||
|
|
||||||
|
For a more comprehensive example, see the [`example.py`](pydepp/example.py) file in the repository.
|
||||||
|
|
||||||
|
## API Overview
|
||||||
|
|
||||||
|
### `AdeptDepp` Class
|
||||||
|
|
||||||
|
- **Initialization**: Open a connection to a DEPP-compatible device.
|
||||||
|
- **Register Access**:
|
||||||
|
- `get_reg(reg: int) -> int`: Read a single register.
|
||||||
|
- `set_reg(reg: int, value: int)`: Write to a single register.
|
||||||
|
- `get_reg_block(addresses: List[int]) -> List[int]`: Read multiple registers.
|
||||||
|
- `set_reg_block(addr_data: List[int])`: Write multiple registers.
|
||||||
|
- **Data Streaming**:
|
||||||
|
- `put_stream(reg: int, data: bytes)`: Stream data to a register.
|
||||||
|
- `get_stream(reg: int, count: int) -> bytes`: Stream data from a register.
|
||||||
|
- **Timeout**:
|
||||||
|
- `set_timeout(timeout_ns: int)`: Set communication timeout in nanoseconds.
|
||||||
|
- **Context Management**:
|
||||||
|
- Use `with AdeptDepp(...)` for automatic resource cleanup.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
### Building the Project
|
||||||
|
|
||||||
|
To build the project, ensure you have `setuptools` installed and run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python setup.py sdist bdist_wheel
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Contributions are welcome! Please open an issue or submit a pull request on the [GitHub repository](https://github.com/0xMax42/pydepp).
|
||||||
|
|
||||||
|
## Acknowledgments
|
||||||
|
|
||||||
|
- **Digilent Adept SDK**: This library relies on the [Adept SDK](https://digilent.com/reference/software/adept/start) for low-level DEPP communication.
|
||||||
|
- **Author**: [0xMax42](https://github.com/0xMax42)
|
Reference in New Issue
Block a user