forked from M-Labs/nac3
WIP
This commit is contained in:
parent
d658d9b00e
commit
31a8b17a84
@ -160,8 +160,10 @@
|
|||||||
cargo-insta
|
cargo-insta
|
||||||
clippy
|
clippy
|
||||||
pre-commit
|
pre-commit
|
||||||
rustfmt
|
rust-analyzer
|
||||||
];
|
];
|
||||||
|
# https://nixos.wiki/wiki/Rust#Shell.nix_example
|
||||||
|
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||||
};
|
};
|
||||||
devShells.x86_64-linux.msys2 = pkgs.mkShell {
|
devShells.x86_64-linux.msys2 = pkgs.mkShell {
|
||||||
name = "nac3-dev-shell-msys2";
|
name = "nac3-dev-shell-msys2";
|
||||||
|
@ -1,25 +1,45 @@
|
|||||||
|
from numpy import int64
|
||||||
from min_artiq import *
|
from min_artiq import *
|
||||||
|
|
||||||
|
@nac3
|
||||||
|
class A:
|
||||||
|
pass
|
||||||
|
@nac3
|
||||||
|
class B(A):
|
||||||
|
pass
|
||||||
|
@nac3
|
||||||
|
class C(B):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@kernel
|
||||||
|
def test():
|
||||||
|
pass
|
||||||
|
|
||||||
@nac3
|
@nac3
|
||||||
class Demo:
|
class Demo:
|
||||||
core: KernelInvariant[Core]
|
core: Kernel[Core]
|
||||||
led0: KernelInvariant[TTLOut]
|
led0: Kernel[TTLOut]
|
||||||
led1: KernelInvariant[TTLOut]
|
optt: Kernel[float]
|
||||||
|
t_mu: Kernel[int64]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.core = Core()
|
self.core = Core()
|
||||||
self.led0 = TTLOut(self.core, 18)
|
self.led0 = TTLOut(self.core, 18)
|
||||||
self.led1 = TTLOut(self.core, 19)
|
self.optt = 0.0
|
||||||
|
self.t_mu = int64(0)
|
||||||
|
|
||||||
|
@kernel
|
||||||
|
def set_time_kernel(self, t: float):
|
||||||
|
self.optt = t
|
||||||
|
self.t_mu = self.core.seconds_to_mu(self.optt)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def run(self):
|
def run(self):
|
||||||
|
for t in [20.*us, 15.*us, 10.*us, 5.*us, 2.*us, 1.*us]:
|
||||||
|
self.set_time_kernel(t)
|
||||||
self.core.reset()
|
self.core.reset()
|
||||||
while True:
|
for _ in range(10000):
|
||||||
with parallel:
|
self.led0.pulse(self.optt)
|
||||||
self.led0.pulse(100.*ms)
|
|
||||||
self.led1.pulse(100.*ms)
|
|
||||||
self.core.delay(100.*ms)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user