forked from M-Labs/nix-scripts
Compare commits
9 Commits
161-base_u
...
master
Author | SHA1 | Date | |
---|---|---|---|
c486ea6288 | |||
a75d445b9e | |||
aada46a6c9 | |||
7b915dbbca | |||
193a65b154 | |||
fb3d1c2719 | |||
2cd3742d1b | |||
9c225d3a27 | |||
05a56da1d3 |
@ -147,7 +147,7 @@
|
|||||||
"emailoverride": "",
|
"emailoverride": "",
|
||||||
"keepnr": 50,
|
"keepnr": 50,
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.05", "emailresponsible": false },
|
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.11", "emailresponsible": false },
|
||||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||||
"urukulSrc": { "type": "git", "value": "https://github.com/quartiq/urukul.git", "emailresponsible": false },
|
"urukulSrc": { "type": "git", "value": "https://github.com/quartiq/urukul.git", "emailresponsible": false },
|
||||||
"mirnySrc": { "type": "git", "value": "https://github.com/quartiq/mirny.git", "emailresponsible": false },
|
"mirnySrc": { "type": "git", "value": "https://github.com/quartiq/mirny.git", "emailresponsible": false },
|
||||||
@ -161,7 +161,7 @@
|
|||||||
"type": 1,
|
"type": 1,
|
||||||
"hidden": false,
|
"hidden": false,
|
||||||
"description": "Simple Python Communications",
|
"description": "Simple Python Communications",
|
||||||
"flake": "github:m-labs/sipyco",
|
"flake": "git+https://github.com/m-labs/sipyco.git",
|
||||||
"checkinterval": 600,
|
"checkinterval": 600,
|
||||||
"schedulingshares": 10,
|
"schedulingshares": 10,
|
||||||
"enableemail": false,
|
"enableemail": false,
|
||||||
|
@ -11,11 +11,10 @@
|
|||||||
"emailoverride": "",
|
"emailoverride": "",
|
||||||
"keepnr": 10,
|
"keepnr": 10,
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.05", "emailresponsible": false },
|
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.11", "emailresponsible": false },
|
||||||
"mozillaOverlay": { "type": "git", "value": "https://github.com/mozilla/nixpkgs-mozilla.git", "emailresponsible": false },
|
"mozillaOverlay": { "type": "git", "value": "https://github.com/mozilla/nixpkgs-mozilla.git", "emailresponsible": false },
|
||||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||||
"stabilizerSrc": { "type": "git", "value": "https://github.com/quartiq/stabilizer.git main", "emailresponsible": false },
|
"stabilizerSrc": { "type": "git", "value": "https://github.com/quartiq/stabilizer.git main", "emailresponsible": false }
|
||||||
"saymaMmcSrc": { "type": "git", "value": "https://github.com/sinara-hw/openMMC.git sayma-devel", "emailresponsible": false }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"thermostat": {
|
"thermostat": {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"emailoverride": "",
|
"emailoverride": "",
|
||||||
"keepnr": 10,
|
"keepnr": 10,
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.05", "emailresponsible": false },
|
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.11", "emailresponsible": false },
|
||||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||||
"webSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/web2019.git", "emailresponsible": false },
|
"webSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/web2019.git", "emailresponsible": false },
|
||||||
"nmigenSrc": { "type": "git", "value": "https://gitlab.com/nmigen/nmigen.git", "emailresponsible": false }
|
"nmigenSrc": { "type": "git", "value": "https://gitlab.com/nmigen/nmigen.git", "emailresponsible": false }
|
||||||
|
@ -8,8 +8,8 @@ let
|
|||||||
"thumbv7em-none-eabihf"
|
"thumbv7em-none-eabihf"
|
||||||
];
|
];
|
||||||
rustManifest = pkgs.fetchurl {
|
rustManifest = pkgs.fetchurl {
|
||||||
url = "https://static.rust-lang.org/dist/2024-06-13/channel-rust-stable.toml";
|
url = "https://static.rust-lang.org/dist/2024-11-28/channel-rust-stable.toml";
|
||||||
sha256 = "sha256-Ngiz76YP4HTY75GGdH2P+APE/DEIx2R/Dn+BwwOyzZU=";
|
sha256 = "b3544fb72bc3189697fc18ac2d3fa27d57ee8434f59d9919d4d70af2c6f010b3";
|
||||||
};
|
};
|
||||||
rustChannelOfTargets = _channel: _date: targets:
|
rustChannelOfTargets = _channel: _date: targets:
|
||||||
(pkgs.lib.rustLib.fromManifestFile rustManifest {
|
(pkgs.lib.rustLib.fromManifestFile rustManifest {
|
||||||
@ -20,7 +20,12 @@ let
|
|||||||
};
|
};
|
||||||
rust = rustChannelOfTargets "nightly" null targets;
|
rust = rustChannelOfTargets "nightly" null targets;
|
||||||
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
|
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
|
||||||
rustc = rust;
|
rustc = rust // {
|
||||||
|
# https://github.com/oxalica/rust-overlay/commit/c48c2d76b68dd9ede0815fec53479375c61af857
|
||||||
|
targetPlatforms = pkgs.lib.platforms.all;
|
||||||
|
tier1TargetPlatforms = pkgs.lib.platforms.all;
|
||||||
|
badTargetPlatforms = [ ];
|
||||||
|
};
|
||||||
cargo = rust;
|
cargo = rust;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -67,9 +72,6 @@ in
|
|||||||
patch -p1 < ${./pounder-725.diff}
|
patch -p1 < ${./pounder-725.diff}
|
||||||
'';
|
'';
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
outputHashes = {
|
|
||||||
"menu-0.6.0" = "sha256-Zilj27J4a/T/Je2qJr6igFj2OEw0/4fU4f0t+afm4TY=";
|
|
||||||
};
|
|
||||||
} // value))) {
|
} // value))) {
|
||||||
dual-iir = {};
|
dual-iir = {};
|
||||||
dual-iir-pounder_v1_0 = {
|
dual-iir-pounder_v1_0 = {
|
||||||
@ -77,28 +79,4 @@ in
|
|||||||
extraCargoBuildArgs = "--features pounder_v1_0";
|
extraCargoBuildArgs = "--features pounder_v1_0";
|
||||||
};
|
};
|
||||||
lockin = {};
|
lockin = {};
|
||||||
} //
|
|
||||||
{
|
|
||||||
# openMMC build system breaks if host compiler is not available, so do not use stdenvNoCC here
|
|
||||||
sayma-mmc = pkgs.stdenv.mkDerivation {
|
|
||||||
name = "sayma-mmc";
|
|
||||||
src = <saymaMmcSrc>;
|
|
||||||
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
|
|
||||||
nativeBuildInputs = [ pkgs.cmake pkgs.gcc-arm-embedded ];
|
|
||||||
buildPhase =
|
|
||||||
''
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake .. -DBOARD=sayma -DBOARD_RTM=sayma -DVERSION= -DTARGET_CONTROLLER=LPC1776 -DCMAKE_BUILD_TYPE=Debug
|
|
||||||
make
|
|
||||||
'';
|
|
||||||
installPhase =
|
|
||||||
''
|
|
||||||
mkdir $out
|
|
||||||
cp out/* $out
|
|
||||||
mkdir -p $out $out/nix-support
|
|
||||||
echo file binary-dist $out/openMMC.axf >> $out/nix-support/hydra-build-products
|
|
||||||
echo file binary-dist $out/openMMC.bin >> $out/nix-support/hydra-build-products
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ index 025f7d4f..59578cce 100644
|
|||||||
fn add_write(&mut self, register: Register, value: &[u8]) {
|
fn add_write(&mut self, register: Register, value: &[u8]) {
|
||||||
let data = &mut self.data[self.index..];
|
let data = &mut self.data[self.index..];
|
||||||
diff --git a/src/bin/dual-iir.rs b/src/bin/dual-iir.rs
|
diff --git a/src/bin/dual-iir.rs b/src/bin/dual-iir.rs
|
||||||
index ea566e14..84bde34a 100644
|
index d4146cc2..b9bc99d9 100644
|
||||||
--- a/src/bin/dual-iir.rs
|
--- a/src/bin/dual-iir.rs
|
||||||
+++ b/src/bin/dual-iir.rs
|
+++ b/src/bin/dual-iir.rs
|
||||||
@@ -28,7 +28,7 @@
|
@@ -28,7 +28,7 @@
|
||||||
@ -226,9 +226,9 @@ index ea566e14..84bde34a 100644
|
|||||||
-use core::mem::MaybeUninit;
|
-use core::mem::MaybeUninit;
|
||||||
+use core::mem::{MaybeUninit, size_of};
|
+use core::mem::{MaybeUninit, size_of};
|
||||||
use core::sync::atomic::{fence, Ordering};
|
use core::sync::atomic::{fence, Ordering};
|
||||||
|
use miniconf::{Leaf, Tree};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@@ -48,6 +48,8 @@ use stabilizer::{
|
||||||
@@ -47,6 +47,8 @@ use stabilizer::{
|
|
||||||
dac::{Dac0Output, Dac1Output, DacCode},
|
dac::{Dac0Output, Dac1Output, DacCode},
|
||||||
hal,
|
hal,
|
||||||
signal_generator::{self, SignalGenerator},
|
signal_generator::{self, SignalGenerator},
|
||||||
@ -237,9 +237,9 @@ index ea566e14..84bde34a 100644
|
|||||||
timers::SamplingTimer,
|
timers::SamplingTimer,
|
||||||
DigitalInput0, DigitalInput1, SerialTerminal, SystemTimer, Systick,
|
DigitalInput0, DigitalInput1, SerialTerminal, SystemTimer, Systick,
|
||||||
UsbDevice, AFE0, AFE1,
|
UsbDevice, AFE0, AFE1,
|
||||||
@@ -179,6 +181,16 @@ pub struct DualIir {
|
@@ -173,6 +175,16 @@ pub struct DualIir {
|
||||||
|
/// # Value
|
||||||
/// See [signal_generator::BasicConfig#miniconf]
|
/// See [signal_generator::BasicConfig#miniconf]
|
||||||
#[tree(depth = 2)]
|
|
||||||
source: [signal_generator::BasicConfig; 2],
|
source: [signal_generator::BasicConfig; 2],
|
||||||
+
|
+
|
||||||
+ /// Specifies the config for pounder DDS clock configuration, DDS channels & attenuations
|
+ /// Specifies the config for pounder DDS clock configuration, DDS channels & attenuations
|
||||||
@ -254,7 +254,7 @@ index ea566e14..84bde34a 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Default for DualIir {
|
impl Default for DualIir {
|
||||||
@@ -206,6 +218,8 @@ impl Default for DualIir {
|
@@ -200,6 +212,8 @@ impl Default for DualIir {
|
||||||
source: Default::default(),
|
source: Default::default(),
|
||||||
|
|
||||||
stream: Default::default(),
|
stream: Default::default(),
|
||||||
@ -263,7 +263,13 @@ index ea566e14..84bde34a 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,6 +236,7 @@ mod app {
|
@@ -211,22 +225,24 @@ mod app {
|
||||||
|
#[shared]
|
||||||
|
struct Shared {
|
||||||
|
usb: UsbDevice,
|
||||||
|
- network: NetworkUsers<DualIir, 3>,
|
||||||
|
+ network: NetworkUsers<DualIir, 6>,
|
||||||
|
settings: Settings,
|
||||||
active_settings: DualIir,
|
active_settings: DualIir,
|
||||||
telemetry: TelemetryBuffer,
|
telemetry: TelemetryBuffer,
|
||||||
source: [SignalGenerator; 2],
|
source: [SignalGenerator; 2],
|
||||||
@ -271,7 +277,12 @@ index ea566e14..84bde34a 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[local]
|
#[local]
|
||||||
@@ -233,6 +248,7 @@ mod app {
|
struct Local {
|
||||||
|
- usb_terminal: SerialTerminal<Settings, 4>,
|
||||||
|
+ usb_terminal: SerialTerminal<Settings, 6>,
|
||||||
|
sampling_timer: SamplingTimer,
|
||||||
|
digital_inputs: (DigitalInput0, DigitalInput1),
|
||||||
|
afes: (AFE0, AFE1),
|
||||||
adcs: (Adc0Input, Adc1Input),
|
adcs: (Adc0Input, Adc1Input),
|
||||||
dacs: (Dac0Output, Dac1Output),
|
dacs: (Dac0Output, Dac1Output),
|
||||||
iir_state: [[[f32; 4]; IIR_CASCADE_LENGTH]; 2],
|
iir_state: [[[f32; 4]; IIR_CASCADE_LENGTH]; 2],
|
||||||
@ -279,16 +290,16 @@ index ea566e14..84bde34a 100644
|
|||||||
generator: FrameGenerator,
|
generator: FrameGenerator,
|
||||||
cpu_temp_sensor: stabilizer::hardware::cpu_temp_sensor::CpuTempSensor,
|
cpu_temp_sensor: stabilizer::hardware::cpu_temp_sensor::CpuTempSensor,
|
||||||
}
|
}
|
||||||
@@ -242,7 +258,7 @@ mod app {
|
@@ -236,7 +252,7 @@ mod app {
|
||||||
let clock = SystemTimer::new(|| Systick::now().ticks());
|
let clock = SystemTimer::new(|| Systick::now().ticks());
|
||||||
|
|
||||||
// Configure the microcontroller
|
// Configure the microcontroller
|
||||||
- let (stabilizer, _pounder) = hardware::setup::setup::<Settings, 4>(
|
- let (stabilizer, _pounder) = hardware::setup::setup::<Settings, 4>(
|
||||||
+ let (mut stabilizer, pounder) = hardware::setup::setup::<Settings, 4>(
|
+ let (mut stabilizer, pounder) = hardware::setup::setup::<Settings, 6>(
|
||||||
c.core,
|
c.core,
|
||||||
c.device,
|
c.device,
|
||||||
clock,
|
clock,
|
||||||
@@ -261,6 +277,13 @@ mod app {
|
@@ -255,6 +271,13 @@ mod app {
|
||||||
|
|
||||||
let generator = network.configure_streaming(StreamFormat::AdcDacData);
|
let generator = network.configure_streaming(StreamFormat::AdcDacData);
|
||||||
|
|
||||||
@ -302,7 +313,7 @@ index ea566e14..84bde34a 100644
|
|||||||
let shared = Shared {
|
let shared = Shared {
|
||||||
usb: stabilizer.usb,
|
usb: stabilizer.usb,
|
||||||
network,
|
network,
|
||||||
@@ -279,6 +302,7 @@ mod app {
|
@@ -273,6 +296,7 @@ mod app {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
settings: stabilizer.settings,
|
settings: stabilizer.settings,
|
||||||
@ -310,7 +321,7 @@ index ea566e14..84bde34a 100644
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut local = Local {
|
let mut local = Local {
|
||||||
@@ -289,6 +313,7 @@ mod app {
|
@@ -283,6 +307,7 @@ mod app {
|
||||||
adcs: stabilizer.adcs,
|
adcs: stabilizer.adcs,
|
||||||
dacs: stabilizer.dacs,
|
dacs: stabilizer.dacs,
|
||||||
iir_state: [[[0.; 4]; IIR_CASCADE_LENGTH]; 2],
|
iir_state: [[[0.; 4]; IIR_CASCADE_LENGTH]; 2],
|
||||||
@ -318,7 +329,7 @@ index ea566e14..84bde34a 100644
|
|||||||
generator,
|
generator,
|
||||||
cpu_temp_sensor: stabilizer.temperature_sensor,
|
cpu_temp_sensor: stabilizer.temperature_sensor,
|
||||||
};
|
};
|
||||||
@@ -458,7 +483,7 @@ mod app {
|
@@ -452,7 +477,7 @@ mod app {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,8 +337,8 @@ index ea566e14..84bde34a 100644
|
|||||||
+ #[task(priority = 1, local=[afes, dds_clock_state], shared=[network, settings, active_settings, source, pounder])]
|
+ #[task(priority = 1, local=[afes, dds_clock_state], shared=[network, settings, active_settings, source, pounder])]
|
||||||
async fn settings_update(mut c: settings_update::Context) {
|
async fn settings_update(mut c: settings_update::Context) {
|
||||||
c.shared.settings.lock(|settings| {
|
c.shared.settings.lock(|settings| {
|
||||||
c.local.afes.0.set_gain(settings.dual_iir.afe[0]);
|
c.local.afes.0.set_gain(*settings.dual_iir.afe[0]);
|
||||||
@@ -480,6 +505,17 @@ mod app {
|
@@ -474,6 +499,17 @@ mod app {
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -345,7 +356,7 @@ index ea566e14..84bde34a 100644
|
|||||||
|
|
||||||
c.shared
|
c.shared
|
||||||
.network
|
.network
|
||||||
@@ -491,21 +527,30 @@ mod app {
|
@@ -485,22 +521,31 @@ mod app {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,15 +364,16 @@ index ea566e14..84bde34a 100644
|
|||||||
+ #[task(priority = 1, shared=[network, settings, telemetry, pounder], local=[cpu_temp_sensor])]
|
+ #[task(priority = 1, shared=[network, settings, telemetry, pounder], local=[cpu_temp_sensor])]
|
||||||
async fn telemetry(mut c: telemetry::Context) {
|
async fn telemetry(mut c: telemetry::Context) {
|
||||||
loop {
|
loop {
|
||||||
let telemetry = c.shared.telemetry.lock(|telemetry| *telemetry);
|
let telemetry =
|
||||||
|
c.shared.telemetry.lock(|telemetry| telemetry.clone());
|
||||||
|
|
||||||
- let (gains, telemetry_period) =
|
- let (gains, telemetry_period) =
|
||||||
+ let (gains, telemetry_period, pounder_config) =
|
+ let (gains, telemetry_period, pounder_config) =
|
||||||
c.shared.settings.lock(|settings| {
|
c.shared.settings.lock(|settings| {
|
||||||
- (settings.dual_iir.afe, settings.dual_iir.telemetry_period)
|
- (settings.dual_iir.afe, *settings.dual_iir.telemetry_period)
|
||||||
+ (
|
+ (
|
||||||
+ settings.dual_iir.afe,
|
+ settings.dual_iir.afe,
|
||||||
+ settings.dual_iir.telemetry_period,
|
+ *settings.dual_iir.telemetry_period,
|
||||||
+ settings.dual_iir.pounder
|
+ settings.dual_iir.pounder
|
||||||
+ )
|
+ )
|
||||||
});
|
});
|
||||||
@ -372,15 +384,15 @@ index ea566e14..84bde34a 100644
|
|||||||
+
|
+
|
||||||
c.shared.network.lock(|net| {
|
c.shared.network.lock(|net| {
|
||||||
net.telemetry.publish(&telemetry.finalize(
|
net.telemetry.publish(&telemetry.finalize(
|
||||||
gains[0],
|
*gains[0],
|
||||||
gains[1],
|
*gains[1],
|
||||||
c.local.cpu_temp_sensor.get_temperature().unwrap(),
|
c.local.cpu_temp_sensor.get_temperature().unwrap(),
|
||||||
+ pounder_telemetry,
|
+ pounder_telemetry,
|
||||||
))
|
))
|
||||||
});
|
});
|
||||||
|
|
||||||
diff --git a/src/bin/lockin.rs b/src/bin/lockin.rs
|
diff --git a/src/bin/lockin.rs b/src/bin/lockin.rs
|
||||||
index 3ddecd7c..77a7474b 100644
|
index d8d193dd..4e5abb28 100644
|
||||||
--- a/src/bin/lockin.rs
|
--- a/src/bin/lockin.rs
|
||||||
+++ b/src/bin/lockin.rs
|
+++ b/src/bin/lockin.rs
|
||||||
@@ -29,7 +29,7 @@
|
@@ -29,7 +29,7 @@
|
||||||
@ -392,14 +404,70 @@ index 3ddecd7c..77a7474b 100644
|
|||||||
sync::atomic::{fence, Ordering},
|
sync::atomic::{fence, Ordering},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -547,6 +547,7 @@ mod app {
|
@@ -248,7 +248,7 @@ mod app {
|
||||||
gains[0],
|
#[shared]
|
||||||
gains[1],
|
struct Shared {
|
||||||
|
usb: UsbDevice,
|
||||||
|
- network: NetworkUsers<Lockin, 2>,
|
||||||
|
+ network: NetworkUsers<Lockin, 6>,
|
||||||
|
settings: Settings,
|
||||||
|
active_settings: Lockin,
|
||||||
|
telemetry: TelemetryBuffer,
|
||||||
|
@@ -256,7 +256,7 @@ mod app {
|
||||||
|
|
||||||
|
#[local]
|
||||||
|
struct Local {
|
||||||
|
- usb_terminal: SerialTerminal<Settings, 3>,
|
||||||
|
+ usb_terminal: SerialTerminal<Settings, 6>,
|
||||||
|
sampling_timer: SamplingTimer,
|
||||||
|
digital_inputs: (DigitalInput0, DigitalInput1),
|
||||||
|
timestamper: InputStamper,
|
||||||
|
@@ -275,7 +275,7 @@ mod app {
|
||||||
|
let clock = SystemTimer::new(|| Systick::now().ticks());
|
||||||
|
|
||||||
|
// Configure the microcontroller
|
||||||
|
- let (mut stabilizer, _pounder) = hardware::setup::setup::<Settings, 3>(
|
||||||
|
+ let (mut stabilizer, _pounder) = hardware::setup::setup::<Settings, 6>(
|
||||||
|
c.core,
|
||||||
|
c.device,
|
||||||
|
clock,
|
||||||
|
@@ -543,6 +543,7 @@ mod app {
|
||||||
|
*gains[0],
|
||||||
|
*gains[1],
|
||||||
c.local.cpu_temp_sensor.get_temperature().unwrap(),
|
c.local.cpu_temp_sensor.get_temperature().unwrap(),
|
||||||
+ None,
|
+ None,
|
||||||
))
|
))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
diff --git a/src/bin/urukul.rs b/src/bin/urukul.rs
|
||||||
|
index fc7faf40..10ff9016 100644
|
||||||
|
--- a/src/bin/urukul.rs
|
||||||
|
+++ b/src/bin/urukul.rs
|
||||||
|
@@ -104,21 +104,21 @@ mod app {
|
||||||
|
#[shared]
|
||||||
|
struct Shared {
|
||||||
|
usb: UsbDevice,
|
||||||
|
- network: NetworkUsers<App, 3>,
|
||||||
|
+ network: NetworkUsers<App, 6>,
|
||||||
|
settings: Settings,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[local]
|
||||||
|
struct Local {
|
||||||
|
urukul: Urukul,
|
||||||
|
- usb_terminal: SerialTerminal<Settings, 4>,
|
||||||
|
+ usb_terminal: SerialTerminal<Settings, 6>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[init]
|
||||||
|
fn init(c: init::Context) -> (Shared, Local) {
|
||||||
|
let clock = SystemTimer::new(|| Systick::now().ticks());
|
||||||
|
|
||||||
|
- let (stabilizer, _pounder) = hardware::setup::setup::<Settings, 4>(
|
||||||
|
+ let (stabilizer, _pounder) = hardware::setup::setup::<Settings, 6>(
|
||||||
|
c.core,
|
||||||
|
c.device,
|
||||||
|
clock,
|
||||||
diff --git a/src/hardware/pounder/attenuators.rs b/src/hardware/pounder/attenuators.rs
|
diff --git a/src/hardware/pounder/attenuators.rs b/src/hardware/pounder/attenuators.rs
|
||||||
index cfd08b7f..2570f506 100644
|
index cfd08b7f..2570f506 100644
|
||||||
--- a/src/hardware/pounder/attenuators.rs
|
--- a/src/hardware/pounder/attenuators.rs
|
||||||
@ -429,7 +497,7 @@ index cfd08b7f..2570f506 100644
|
|||||||
Ok(attenuation_code as f32 / 2.0)
|
Ok(attenuation_code as f32 / 2.0)
|
||||||
}
|
}
|
||||||
diff --git a/src/hardware/pounder/dds_output.rs b/src/hardware/pounder/dds_output.rs
|
diff --git a/src/hardware/pounder/dds_output.rs b/src/hardware/pounder/dds_output.rs
|
||||||
index 3ae1ce90..cd978b01 100644
|
index 5527a8e1..23435e2e 100644
|
||||||
--- a/src/hardware/pounder/dds_output.rs
|
--- a/src/hardware/pounder/dds_output.rs
|
||||||
+++ b/src/hardware/pounder/dds_output.rs
|
+++ b/src/hardware/pounder/dds_output.rs
|
||||||
@@ -55,7 +55,7 @@
|
@@ -55,7 +55,7 @@
|
||||||
@ -441,7 +509,7 @@ index 3ae1ce90..cd978b01 100644
|
|||||||
use ad9959::{Channel, Mode, ProfileSerializer};
|
use ad9959::{Channel, Mode, ProfileSerializer};
|
||||||
|
|
||||||
/// The DDS profile update stream.
|
/// The DDS profile update stream.
|
||||||
@@ -157,6 +157,46 @@ impl<'a> ProfileBuilder<'a> {
|
@@ -157,6 +157,46 @@ impl ProfileBuilder<'_> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,7 +557,7 @@ index 3ae1ce90..cd978b01 100644
|
|||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[inline]
|
#[inline]
|
||||||
diff --git a/src/hardware/pounder/mod.rs b/src/hardware/pounder/mod.rs
|
diff --git a/src/hardware/pounder/mod.rs b/src/hardware/pounder/mod.rs
|
||||||
index 5bc7e9ff..5b8d5d30 100644
|
index c144db0c..a6831605 100644
|
||||||
--- a/src/hardware/pounder/mod.rs
|
--- a/src/hardware/pounder/mod.rs
|
||||||
+++ b/src/hardware/pounder/mod.rs
|
+++ b/src/hardware/pounder/mod.rs
|
||||||
@@ -1,10 +1,17 @@
|
@@ -1,10 +1,17 @@
|
||||||
@ -502,28 +570,30 @@ index 5bc7e9ff..5b8d5d30 100644
|
|||||||
+use ad9959::{
|
+use ad9959::{
|
||||||
+ amplitude_to_acr, frequency_to_ftw, phase_to_pow, validate_clocking,
|
+ amplitude_to_acr, frequency_to_ftw, phase_to_pow, validate_clocking,
|
||||||
+};
|
+};
|
||||||
use embedded_hal::blocking::spi::Transfer;
|
use embedded_hal_02::blocking::spi::Transfer;
|
||||||
use enum_iterator::Sequence;
|
use enum_iterator::Sequence;
|
||||||
+use miniconf::Tree;
|
+use miniconf::{Leaf, Tree};
|
||||||
+use rf_power::PowerMeasurementInterface;
|
+use rf_power::PowerMeasurementInterface;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
+use stm32h7xx_hal::time::MegaHertz;
|
+use stm32h7xx_hal::time::MegaHertz;
|
||||||
|
|
||||||
pub mod attenuators;
|
pub mod attenuators;
|
||||||
pub mod dds_output;
|
pub mod dds_output;
|
||||||
@@ -120,40 +127,99 @@ impl From<Channel> for GpioPin {
|
@@ -120,38 +127,97 @@ impl From<Channel> for GpioPin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
||||||
-pub struct DdsChannelState {
|
-pub struct DdsChannelState {
|
||||||
- pub phase_offset: f32,
|
- pub phase_offset: f32,
|
||||||
|
- pub frequency: f32,
|
||||||
|
- pub amplitude: f32,
|
||||||
|
- pub enabled: bool,
|
||||||
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, Tree)]
|
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, Tree)]
|
||||||
+pub struct DdsChannelConfig {
|
+pub struct DdsChannelConfig {
|
||||||
pub frequency: f32,
|
+ pub frequency: Leaf<f32>,
|
||||||
+ pub phase_offset: f32,
|
+ pub phase_offset: Leaf<f32>,
|
||||||
pub amplitude: f32,
|
+ pub amplitude: Leaf<f32>,
|
||||||
- pub enabled: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
||||||
@ -533,9 +603,9 @@ index 5bc7e9ff..5b8d5d30 100644
|
|||||||
+impl Default for DdsChannelConfig {
|
+impl Default for DdsChannelConfig {
|
||||||
+ fn default() -> Self {
|
+ fn default() -> Self {
|
||||||
+ Self {
|
+ Self {
|
||||||
+ frequency: 0.0,
|
+ frequency: 0.0.into(),
|
||||||
+ phase_offset: 0.0,
|
+ phase_offset: 0.0.into(),
|
||||||
+ amplitude: 0.0,
|
+ amplitude: 0.0.into(),
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
@ -557,8 +627,12 @@ index 5bc7e9ff..5b8d5d30 100644
|
|||||||
+ /// Control amplitudes of DDS channels. It corresponds to the AD9959 ACR register, which
|
+ /// Control amplitudes of DDS channels. It corresponds to the AD9959 ACR register, which
|
||||||
+ /// controls the amplitude scaling factor of DDS channels.
|
+ /// controls the amplitude scaling factor of DDS channels.
|
||||||
+ pub amplitude_control: u32,
|
+ pub amplitude_control: u32,
|
||||||
+}
|
}
|
||||||
+
|
|
||||||
|
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
||||||
|
-pub struct OutputChannelState {
|
||||||
|
- pub attenuation: f32,
|
||||||
|
- pub channel: DdsChannelState,
|
||||||
+impl TryFrom<(ClockConfig, ChannelConfig)> for Profile {
|
+impl TryFrom<(ClockConfig, ChannelConfig)> for Profile {
|
||||||
+ type Error = ad9959::Error;
|
+ type Error = ad9959::Error;
|
||||||
+
|
+
|
||||||
@ -566,52 +640,52 @@ index 5bc7e9ff..5b8d5d30 100644
|
|||||||
+ (clocking, channel): (ClockConfig, ChannelConfig),
|
+ (clocking, channel): (ClockConfig, ChannelConfig),
|
||||||
+ ) -> Result<Self, Self::Error> {
|
+ ) -> Result<Self, Self::Error> {
|
||||||
+ let system_clock_frequency =
|
+ let system_clock_frequency =
|
||||||
+ clocking.reference_clock * clocking.multiplier as f32;
|
+ *clocking.reference_clock * *clocking.multiplier as f32;
|
||||||
+ Ok(Profile {
|
+ Ok(Profile {
|
||||||
+ frequency_tuning_word: frequency_to_ftw(
|
+ frequency_tuning_word: frequency_to_ftw(
|
||||||
+ channel.dds.frequency,
|
+ *channel.dds.frequency,
|
||||||
+ system_clock_frequency,
|
+ system_clock_frequency,
|
||||||
+ )?,
|
+ )?,
|
||||||
+ phase_offset: phase_to_pow(channel.dds.phase_offset)?,
|
+ phase_offset: phase_to_pow(*channel.dds.phase_offset)?,
|
||||||
+ amplitude_control: amplitude_to_acr(channel.dds.amplitude)?,
|
+ amplitude_control: amplitude_to_acr(*channel.dds.amplitude)?,
|
||||||
+ })
|
+ })
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
|
|
||||||
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
||||||
-pub struct OutputChannelState {
|
-pub struct DdsClockConfig {
|
||||||
|
- pub multiplier: u8,
|
||||||
|
- pub reference_clock: f32,
|
||||||
|
- pub external_clock: bool,
|
||||||
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, Tree)]
|
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, Tree)]
|
||||||
+pub struct ChannelConfig {
|
+pub struct ChannelConfig {
|
||||||
+ #[tree]
|
+ #[tree]
|
||||||
+ pub dds: DdsChannelConfig,
|
+ pub dds: DdsChannelConfig,
|
||||||
pub attenuation: f32,
|
+ pub attenuation: Leaf<f32>,
|
||||||
- pub channel: DdsChannelState,
|
+}
|
||||||
}
|
+
|
||||||
|
|
||||||
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
|
||||||
-pub struct DdsClockConfig {
|
|
||||||
+impl Default for ChannelConfig {
|
+impl Default for ChannelConfig {
|
||||||
+ fn default() -> Self {
|
+ fn default() -> Self {
|
||||||
+ ChannelConfig {
|
+ ChannelConfig {
|
||||||
+ dds: DdsChannelConfig::default(),
|
+ dds: DdsChannelConfig::default(),
|
||||||
+ attenuation: 31.5,
|
+ attenuation: 31.5.into(),
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, PartialEq, Tree)]
|
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, PartialEq, Tree)]
|
||||||
+pub struct ClockConfig {
|
+pub struct ClockConfig {
|
||||||
pub multiplier: u8,
|
+ pub multiplier: Leaf<u8>,
|
||||||
pub reference_clock: f32,
|
+ pub reference_clock: Leaf<f32>,
|
||||||
pub external_clock: bool,
|
+ pub external_clock: Leaf<bool>,
|
||||||
}
|
+}
|
||||||
|
+
|
||||||
+impl Default for ClockConfig {
|
+impl Default for ClockConfig {
|
||||||
+ fn default() -> Self {
|
+ fn default() -> Self {
|
||||||
+ Self {
|
+ Self {
|
||||||
+ multiplier: 5,
|
+ multiplier: 5.into(),
|
||||||
+ reference_clock: MegaHertz::MHz(100).to_Hz() as f32,
|
+ reference_clock: (MegaHertz::MHz(100).to_Hz() as f32).into(),
|
||||||
+ external_clock: false,
|
+ external_clock: false.into(),
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
@ -620,15 +694,13 @@ index 5bc7e9ff..5b8d5d30 100644
|
|||||||
+pub struct PounderConfig {
|
+pub struct PounderConfig {
|
||||||
+ #[tree]
|
+ #[tree]
|
||||||
+ pub clock: ClockConfig,
|
+ pub clock: ClockConfig,
|
||||||
+ #[tree(depth = 2)]
|
+ #[tree]
|
||||||
+ pub in_channel: [ChannelConfig; 2],
|
+ pub in_channel: [ChannelConfig; 2],
|
||||||
+ #[tree(depth = 2)]
|
+ #[tree]
|
||||||
+ pub out_channel: [ChannelConfig; 2],
|
+ pub out_channel: [ChannelConfig; 2],
|
||||||
+}
|
}
|
||||||
+
|
|
||||||
impl From<Channel> for ad9959::Channel {
|
impl From<Channel> for ad9959::Channel {
|
||||||
/// Translate pounder channels to DDS output channels.
|
|
||||||
fn from(other: Channel) -> Self {
|
|
||||||
@@ -585,3 +651,78 @@ impl rf_power::PowerMeasurementInterface for PounderDevices {
|
@@ -585,3 +651,78 @@ impl rf_power::PowerMeasurementInterface for PounderDevices {
|
||||||
Ok(adc_scale * 2.048)
|
Ok(adc_scale * 2.048)
|
||||||
}
|
}
|
||||||
@ -642,19 +714,19 @@ index 5bc7e9ff..5b8d5d30 100644
|
|||||||
+ ) {
|
+ ) {
|
||||||
+ if *clocking != settings.clock {
|
+ if *clocking != settings.clock {
|
||||||
+ match validate_clocking(
|
+ match validate_clocking(
|
||||||
+ settings.clock.reference_clock,
|
+ *settings.clock.reference_clock,
|
||||||
+ settings.clock.multiplier,
|
+ *settings.clock.multiplier,
|
||||||
+ ) {
|
+ ) {
|
||||||
+ Ok(_frequency) => {
|
+ Ok(_frequency) => {
|
||||||
+ self.pounder
|
+ self.pounder
|
||||||
+ .set_ext_clk(settings.clock.external_clock)
|
+ .set_ext_clk(*settings.clock.external_clock)
|
||||||
+ .unwrap();
|
+ .unwrap();
|
||||||
+
|
+
|
||||||
+ self.dds_output
|
+ self.dds_output
|
||||||
+ .builder()
|
+ .builder()
|
||||||
+ .set_system_clock(
|
+ .set_system_clock(
|
||||||
+ settings.clock.reference_clock,
|
+ *settings.clock.reference_clock,
|
||||||
+ settings.clock.multiplier,
|
+ *settings.clock.multiplier,
|
||||||
+ )
|
+ )
|
||||||
+ .unwrap()
|
+ .unwrap()
|
||||||
+ .write();
|
+ .write();
|
||||||
@ -685,7 +757,7 @@ index 5bc7e9ff..5b8d5d30 100644
|
|||||||
+
|
+
|
||||||
+ if let Err(err) = self.pounder.set_attenuation(
|
+ if let Err(err) = self.pounder.set_attenuation(
|
||||||
+ pounder_channel,
|
+ pounder_channel,
|
||||||
+ channel_config.attenuation,
|
+ *channel_config.attenuation,
|
||||||
+ ) {
|
+ ) {
|
||||||
+ log::error!("Invalid attenuation settings: {:?}", err)
|
+ log::error!("Invalid attenuation settings: {:?}", err)
|
||||||
+ }
|
+ }
|
||||||
@ -722,7 +794,7 @@ index 714ec57f..d442f197 100644
|
|||||||
box_pool,
|
box_pool,
|
||||||
pool::boxed::{Box, BoxBlock},
|
pool::boxed::{Box, BoxBlock},
|
||||||
diff --git a/src/net/mod.rs b/src/net/mod.rs
|
diff --git a/src/net/mod.rs b/src/net/mod.rs
|
||||||
index 43733fa8..a8b90f86 100644
|
index 8d815e51..5541f8ba 100644
|
||||||
--- a/src/net/mod.rs
|
--- a/src/net/mod.rs
|
||||||
+++ b/src/net/mod.rs
|
+++ b/src/net/mod.rs
|
||||||
@@ -32,14 +32,14 @@ pub type NetworkReference =
|
@@ -32,14 +32,14 @@ pub type NetworkReference =
|
||||||
@ -743,7 +815,7 @@ index 43733fa8..a8b90f86 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/net/telemetry.rs b/src/net/telemetry.rs
|
diff --git a/src/net/telemetry.rs b/src/net/telemetry.rs
|
||||||
index c8eb536b..116382a3 100644
|
index 6b42b97c..48f9828e 100644
|
||||||
--- a/src/net/telemetry.rs
|
--- a/src/net/telemetry.rs
|
||||||
+++ b/src/net/telemetry.rs
|
+++ b/src/net/telemetry.rs
|
||||||
@@ -16,7 +16,7 @@ use minimq::{DeferredPublication, Publication};
|
@@ -16,7 +16,7 @@ use minimq::{DeferredPublication, Publication};
|
||||||
@ -781,8 +853,8 @@ index c8eb536b..116382a3 100644
|
|||||||
+ pub config: PounderConfig,
|
+ pub config: PounderConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TelemetryBuffer {
|
impl TelemetryBuffer {
|
||||||
@@ -87,10 +107,17 @@ impl TelemetryBuffer {
|
@@ -77,10 +97,17 @@ impl TelemetryBuffer {
|
||||||
/// * `afe0` - The current AFE configuration for channel 0.
|
/// * `afe0` - The current AFE configuration for channel 0.
|
||||||
/// * `afe1` - The current AFE configuration for channel 1.
|
/// * `afe1` - The current AFE configuration for channel 1.
|
||||||
/// * `cpu_temp` - The current CPU temperature.
|
/// * `cpu_temp` - The current CPU temperature.
|
||||||
@ -801,7 +873,7 @@ index c8eb536b..116382a3 100644
|
|||||||
let in0_volts = Into::<f32>::into(self.adcs[0]) / afe0.as_multiplier();
|
let in0_volts = Into::<f32>::into(self.adcs[0]) / afe0.as_multiplier();
|
||||||
let in1_volts = Into::<f32>::into(self.adcs[1]) / afe1.as_multiplier();
|
let in1_volts = Into::<f32>::into(self.adcs[1]) / afe1.as_multiplier();
|
||||||
|
|
||||||
@@ -99,6 +126,7 @@ impl TelemetryBuffer {
|
@@ -89,6 +116,7 @@ impl TelemetryBuffer {
|
||||||
adcs: [in0_volts, in1_volts],
|
adcs: [in0_volts, in1_volts],
|
||||||
dacs: [self.dacs[0].into(), self.dacs[1].into()],
|
dacs: [self.dacs[0].into(), self.dacs[1].into()],
|
||||||
digital_inputs: self.digital_inputs,
|
digital_inputs: self.digital_inputs,
|
||||||
|
3
web.nix
3
web.nix
@ -8,7 +8,8 @@ in
|
|||||||
web-intl = pkgs.runCommand "web-intl" {}
|
web-intl = pkgs.runCommand "web-intl" {}
|
||||||
''
|
''
|
||||||
cd ${web-src}
|
cd ${web-src}
|
||||||
DOMAINNAME=m-labs-intl.com ${pkgs.zola}/bin/zola build -o $out -u https://m-labs-intl.com
|
export DOMAINNAME=m-labs-intl.com
|
||||||
|
${pkgs.zola}/bin/zola build -o $out -u https://$DOMAINNAME
|
||||||
'';
|
'';
|
||||||
sphinxcontrib-platformpicker = pkgs.python3Packages.buildPythonPackage rec {
|
sphinxcontrib-platformpicker = pkgs.python3Packages.buildPythonPackage rec {
|
||||||
pname = "sphinxcontrib-platformpicker";
|
pname = "sphinxcontrib-platformpicker";
|
||||||
|
Loading…
Reference in New Issue
Block a user