firmware+controller: Initial USB device

This commit is contained in:
2024-12-09 13:41:22 +00:00
parent db683dbc71
commit 768ee410d8
13 changed files with 229 additions and 3 deletions

2
controller/.envrc Normal file
View File

@@ -0,0 +1,2 @@
watch_file default.nix
use flake ..#controller --override-input rootdir "file+file://"<(printf %s "$PWD")

View File

@@ -0,0 +1 @@
3.13

30
controller/default.nix Normal file
View File

@@ -0,0 +1,30 @@
{
perSystem = { libMy, pkgs, ... }: {
devenv.shells.controller = libMy.withRootdir {
languages = {
python = {
enable = true;
version = "3.13";
libraries = with pkgs; [
libusb1
];
uv = {
enable = true;
sync.enable = true;
};
};
};
packages = with pkgs; [ ];
env = { };
scripts = {
# build.exec = ''
# cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -D PICO_STDIO_SEMIHOSTING=1
# cmake --build build --parallel
# '';
};
};
};
}

View File

@@ -0,0 +1,8 @@
[project]
name = "valconomy"
version = "0.1.0"
description = "Valconomy controller"
requires-python = ">=3.13"
dependencies = [
"pyusb>=1.2.1",
]

22
controller/uv.lock generated Normal file
View File

@@ -0,0 +1,22 @@
version = 1
requires-python = ">=3.13"
[[package]]
name = "pyusb"
version = "1.2.1"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/d9/6e/433a5614132576289b8643fe598dd5d51b16e130fd591564be952e15bb45/pyusb-1.2.1.tar.gz", hash = "sha256:a4cc7404a203144754164b8b40994e2849fde1cfff06b08492f12fff9d9de7b9", size = 75292 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/15/a8/4982498b2ab44d1fcd5c49f07ea3795eab01601dc143b009d333fcace3b9/pyusb-1.2.1-py3-none-any.whl", hash = "sha256:2b4c7cb86dbadf044dfb9d3a4ff69fd217013dbe78a792177a3feb172449ea36", size = 58439 },
]
[[package]]
name = "valconomy"
version = "0.1.0"
source = { virtual = "." }
dependencies = [
{ name = "pyusb" },
]
[package.metadata]
requires-dist = [{ name = "pyusb", specifier = ">=1.2.1" }]

8
controller/valconomy.py Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env python3
import usb.core
def main():
print(usb.core.find(idVendor=0x6969, idProduct=0x0004))
if __name__ == '__main__':
main()