-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Aharoni-Lab/wireless_fpga
feat: add support for wireless fpga-based manchester daq
- Loading branch information
Showing
46 changed files
with
14,517 additions
and
413 deletions.
There are no files selected for viewing
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
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
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,11 @@ | ||
# Devices | ||
|
||
Interfaces to external devices like miniscopes and DAQs | ||
|
||
## OpalKelly | ||
|
||
```{eval-rst} | ||
.. autoclass:: miniscope_io.devices.opalkelly.okDev | ||
:members: | ||
:undoc-members: | ||
``` |
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 |
---|---|---|
|
@@ -4,10 +4,13 @@ | |
:caption: API | ||
data | ||
devices | ||
formats | ||
io | ||
sdcard | ||
exceptions | ||
plots/index | ||
utils | ||
uart_daq | ||
vendor/index | ||
``` |
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,11 @@ | ||
# UART Daq | ||
|
||
(Some description of what this module does, can happen either here in markdown | ||
or in the module docstring as RST) | ||
|
||
```{eval-rst} | ||
.. automodule:: miniscope_io.uart_daq | ||
:members: | ||
:undoc-members: | ||
``` | ||
|
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,9 @@ | ||
# Vendor | ||
|
||
Modules that incorporate some proprietary/nonfree component and are vendored in | ||
|
||
```{toctree} | ||
:caption: Vendor | ||
opalkelly | ||
``` |
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,4 @@ | ||
# OpalKelly FrontPanel | ||
|
||
(your docs on what this is for and how it works here!!!) | ||
|
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
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,5 @@ | ||
# Guide | ||
|
||
```{toctree} | ||
installation | ||
``` |
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,50 @@ | ||
# Installation | ||
|
||
From PyPI: | ||
|
||
```bash | ||
pip install miniscope_io | ||
``` | ||
|
||
From git repository, using pip: | ||
```bash | ||
git clone https://github.com/Aharoni-Lab/miniscope-io | ||
cd miniscope-io | ||
pip install . | ||
``` | ||
|
||
Or poetry: | ||
```bash | ||
git clone https://github.com/Aharoni-Lab/miniscope-io | ||
cd miniscope-io | ||
poetry install | ||
``` | ||
|
||
|
||
## Additional Dependencies | ||
|
||
### OpalKelly | ||
|
||
`miniscope_io.vendor.opalkelly` - used for FPGA I/O | ||
|
||
#### Linux | ||
|
||
We package the OpalKelly FrontPanel SDK here, but it has an unadvertised dependency | ||
on some system level packages: | ||
|
||
- `liblua5.3-0` | ||
|
||
So eg. on debian/ubuntu you'll need to: | ||
|
||
```bash | ||
apt install liblua5.3-0 | ||
``` | ||
|
||
#### Mac | ||
|
||
No special installation should be required. | ||
|
||
#### Windows | ||
|
||
Currently windows is not implemented - see `miniscope_io/vencor/opalkelly/README.md` for | ||
what was done to implement Linux and Mac to see what might need to be done here, pull requests welcome :) |
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
File renamed without changes.
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,8 @@ | ||
# Meta | ||
|
||
|
||
```{toctree} | ||
changelog | ||
todo | ||
``` | ||
|
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,4 @@ | ||
# TODO | ||
|
||
```{todolist} | ||
``` |
Binary file not shown.
Empty file.
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,55 @@ | ||
import time | ||
|
||
from bitstring import BitArray | ||
|
||
from miniscope_io.vendor import opalkelly as ok | ||
|
||
|
||
class okDev(ok.okCFrontPanel): | ||
""" | ||
I/O and configuration for an (what kind of opal kelly device?) | ||
.. todo:: | ||
Phil: document what this thing does, including how bitfiles work | ||
and how they're generated/where they're located. | ||
""" | ||
def __init__(self, serial_id: str = ""): | ||
super().__init__() | ||
ret = self.OpenBySerial("") | ||
if ret != self.NoError: | ||
raise ValueError("Cannot open device: {}".format(serial_id)) | ||
self.info = ok.okTDeviceInfo() | ||
ret = self.GetDeviceInfo(self.info) | ||
if ret == self.NoError: | ||
print("Connected to {}".format(self.info.productName)) | ||
|
||
def uploadBit(self, bit_file: str): | ||
|
||
ret = self.ConfigureFPGA(bit_file) | ||
if ret == self.NoError: | ||
print("Succesfully uploaded {}".format(bit_file)) | ||
else: | ||
raise ValueError("Configuration of {} failed".format(self.info.productName)) | ||
print( | ||
"FrontPanel {} supported".format( | ||
"is" if self.IsFrontPanelEnabled() else "not" | ||
) | ||
) | ||
ret = self.ResetFPGA() | ||
|
||
def readData(self, length: int, addr: int = 0xA0, blockSize: int = 16): | ||
buf = bytearray(length) | ||
ret = self.ReadFromBlockPipeOut(addr, data=buf, blockSize=blockSize) | ||
if ret < 0: | ||
raise ValueError("Read failed: {}".format(ret)) | ||
elif ret < length: | ||
print("Only {} bytes read".format(ret)) | ||
return buf | ||
|
||
def setWire(self, addr: int, val: int): | ||
ret = self.SetWireInValue(addr, val) | ||
ret = self.UpdateWireIns() | ||
if ret != self.NoError: | ||
raise ValueError("Wire update failed: {}".format(ret)) |
Oops, something went wrong.