Skip to content

Commit

Permalink
Web imports (#474)
Browse files Browse the repository at this point in the history
* use .unit-input

* use .fft-select

* radio button checked

* use .fft-input

* clkgenInputs

* rm dependency to Control in plot

* rm fftWindowIndex

* use clkgenInputs for setSamplingFrequency

* use .fft-channel-input

* use .precision-dac-input

* use .precision-adc-span

* use .supply-span

* rm redundant toFixed toString

* use .temperature-span

* yUnit

* use imports

* fft.css and imports

* use imports

* use imports

* rm functions.ts

* group temperature-sensor

* group

* group

* group

* group

* rename control to fft-app

* mv export-file

* navigation

* group

* imports in ts

* mv imports.ts, navigation.html to web/

* redpitaya fft

* rm duplicate

* use .laser-control-input

* rm control.ts

* switch mode updates data-command

* laserControlInputs range max

* initLaserModeSelect()

* laser-control.html

* mv css to main.css

* use imports and initAverageSwitch()

* average

* modulation.ts

* import modulation

* spectrum

* initVelocitySwitch()

* laser controller

* mv dds-frequency

* export-file.ts

* minor

* minor

* rm resetRange()

* rm plot_data construction from redraw

* max_x as arg

* break down plot / plotBasics

* mv plotBasics

* plotBasics arg driver

* rangeFunction

* break down in oscillo

* spectrum

* minor

* fft plot

* use polyfill HTMLImports

* use imports pulse-generator, led-blinker

* import plot-basics.html

* mv imports.ts in koheron.ts and download polyfill

* group nav html ts, default in os.mk and web.mk

* replace with simpler navigation

* mv led blinker to web/

* update SDK version to 0.17.1 and instruments version

* fix export plot

* update version to 0.18.0
  • Loading branch information
minjungkh committed Aug 14, 2018
1 parent 180a244 commit 629d288
Show file tree
Hide file tree
Showing 115 changed files with 1,955 additions and 3,504 deletions.
2 changes: 2 additions & 0 deletions build_examples.sh
Expand Up @@ -8,6 +8,7 @@ make CONFIG=examples/alpha250/fft/config.yml MODE=$mode $target
make CONFIG=examples/alpha250/loopback/config.yml MODE=$mode $target
make CONFIG=examples/alpha250/adc-dac-bram/config.yml MODE=$mode $target
make CONFIG=examples/alpha250/adc-dac-dma/config.yml MODE=$mode $target
make CONFIG=examples/alpha250/phase-noise-analyzer/config.yml MODE=$mode $target
make CONFIG=examples/red-pitaya/led-blinker/config.yml MODE=$mode $target
make CONFIG=examples/red-pitaya/oscillo/config.yml MODE=$mode $target
make CONFIG=examples/red-pitaya/spectrum/config.yml MODE=$mode $target
Expand All @@ -18,5 +19,6 @@ make CONFIG=examples/red-pitaya/adc-dac/config.yml MODE=$mode $target
make CONFIG=examples/red-pitaya/cluster/config.yml MODE=$mode $target
make CONFIG=examples/red-pitaya/dual-dds/config.yml MODE=$mode $target
make CONFIG=examples/red-pitaya/fft/config.yml MODE=$mode $target
make CONFIG=examples/red-pitaya/phase-noise-analyzer/config.yml MODE=$mode $target
make CONFIG=examples/zedboard/led-blinker/config.yml MODE=$mode $target
make CONFIG=examples/zedboard/picoblaze/config.yml MODE=$mode $target
4 changes: 2 additions & 2 deletions examples/alpha250/adc-dac-bram/config.yml
@@ -1,7 +1,7 @@
---
name: adc-dac-bram
board: boards/alpha250
version: 0.1.0
version: 0.1.1

cores:
- fpga/cores/axi_ctl_register_v1_0
Expand Down Expand Up @@ -66,4 +66,4 @@ drivers:
web:
- web/index.html
- web/main.css
- web/navigation.ts
- web/koheron.ts
5 changes: 2 additions & 3 deletions examples/alpha250/adc-dac-dma/config.yml
@@ -1,7 +1,7 @@
---
name: adc-dac-dma
board: boards/alpha250
version: 0.1.0
version: 0.1.1

cores:
- fpga/cores/axi_ctl_register_v1_0
Expand Down Expand Up @@ -90,5 +90,4 @@ drivers:
web:
- web/index.html
- web/main.css
- web/navigation.ts

- web/koheron.ts
42 changes: 30 additions & 12 deletions examples/alpha250/fft/config.yml
@@ -1,7 +1,7 @@
---
name: fft
board: boards/alpha250
version: 0.1.0
version: 0.1.1

cores:
- fpga/cores/axi_ctl_register_v1_0
Expand Down Expand Up @@ -83,15 +83,33 @@ drivers:
web:
- web/koheron.ts
- web/jquery.flot.d.ts
- ./web/fft.ts
- ./web/app.ts
- ./web/control.ts
- ./web/plot.ts
- ./web/temperature-sensor.ts
- ./web/power-monitor.ts
- ./web/precision-adc.ts
- ./web/precision-dac.ts
- ./web/clock-generator.ts
- ./web/index.html
- web/main.css
- web/navigation.ts
- web/dds-frequency/dds-frequency.html
- web/dds-frequency/dds-frequency.ts
- ./web/index.html
- ./web/app.ts
- ./web/fft.ts
- ./web/fft/fft-window.html
- ./web/fft/input-channel.html
- ./web/fft/fft-app.ts
- web/plot-basics/plot-basics.ts
- web/plot-basics/plot-basics.html
- ./web/plot/plot.ts
- ./web/plot/yunit.html
- ./web/plot/peak-detection.html
- ./web/precision-channels/precision-adc.ts
- ./web/precision-channels/precision-dac.ts
- ./web/precision-channels/precision-channels-app.ts
- ./web/precision-channels/precision-channels.html
- ./web/clock-generator/clock-generator.ts
- ./web/clock-generator/clock-generator-app.ts
- ./web/clock-generator/sampling-frequency.html
- ./web/clock-generator/reference-clock.html
- ./web/export-file/export-file.html
- ./web/export-file/export-file.ts
- ./web/temperature-sensor/temperature-sensor.html
- ./web/temperature-sensor/temperature-sensor.ts
- ./web/temperature-sensor/temperature-sensor-app.ts
- ./web/power-monitor/power-monitor.html
- ./web/power-monitor/power-monitor.ts
- ./web/power-monitor/power-monitor-app.ts
109 changes: 39 additions & 70 deletions examples/alpha250/fft/web/app.ts
@@ -1,100 +1,69 @@
class App {
public control: Control;

private imports: Imports;
public plot: Plot;
private plotBasics: PlotBasics;
private fft: FFT;
private precisionDac: PrecisionDac;

public fftApp: FFTApp;
public ddsFrequency: DDSFrequency;
private temperatureSensor: TemperatureSensor;
private temperatureSensorApp: TemperatureSensorApp;
private powerMonitor: PowerMonitor;
private powerMonitorApp: PowerMonitorApp;
private clockGenerator: ClockGenerator;
private clockGeneratorApp: ClockGeneratorApp;
private precisionDac: PrecisionDac;
private precisionAdc: PrecisionAdc;
private clkGenerator: ClockGenerator;

private temperatureVoltageReference: HTMLSpanElement;
private temperatureBoardSpan: HTMLSpanElement;
private temperatureZynqSpan: HTMLSpanElement;
private supplyMainVoltageSpan: HTMLSpanElement;
private supplyMainCurrentSpan: HTMLSpanElement;
private supplyClockVoltageSpan: HTMLSpanElement;
private supplyClockCurrentSpan: HTMLSpanElement;

private precisionAdcNum: number;
private precisionAdcSpans: HTMLSpanElement[];
private precisionChannelsApp: PrecisionChannelsApp;
private exportFile: ExportFile;

private navigation: Navigation;
private n_pts: number;
private x_min: number;
private x_max: number;
private y_min: number;
private y_max: number;

constructor(window: Window, document: Document,
ip: string, plot_placeholder: JQuery) {
let sockpoolSize: number = 10;
let client = new Client(ip, sockpoolSize);

this.temperatureVoltageReference = <HTMLSpanElement>document.getElementById('temperature-voltage-reference');
this.temperatureBoardSpan = <HTMLSpanElement>document.getElementById('temperature-board');
this.temperatureZynqSpan = <HTMLSpanElement>document.getElementById('temperature-zynq');
this.supplyMainVoltageSpan = <HTMLSpanElement>document.getElementById('supply-main-voltage');
this.supplyMainCurrentSpan = <HTMLSpanElement>document.getElementById('supply-main-current');
this.supplyClockVoltageSpan = <HTMLSpanElement>document.getElementById('supply-clock-voltage');
this.supplyClockCurrentSpan = <HTMLSpanElement>document.getElementById('supply-clock-current');

this.precisionAdcNum = 4;
this.precisionAdcSpans = [];

for (let i:number = 0; i < this.precisionAdcNum; i++) {
this.precisionAdcSpans[i] = <HTMLInputElement>document.getElementById('precision-adc-' + i.toString());
}

window.addEventListener('load', () => {
window.addEventListener('HTMLImportsLoaded', () => {
client.init( () => {
this.imports = new Imports(document);
this.fft = new FFT(client);
this.precisionDac = new PrecisionDac(client);
this.precisionAdc = new PrecisionAdc(client);
this.temperatureSensor = new TemperatureSensor(client);
this.powerMonitor = new PowerMonitor(client);
this.precisionAdc = new PrecisionAdc(client);
this.clkGenerator = new ClockGenerator(client);
this.navigation = new Navigation(document);
this.clockGenerator = new ClockGenerator(client);

this.fft.init( () => {
this.control = new Control(document, this.fft, this.precisionDac, this.clkGenerator);
this.plot = new Plot(document, plot_placeholder, this.fft, this.control);
this.updateTemperatures();
this.updateSupplies();
this.updatePrecisionAdcValues();
});
});
}, false);
this.fftApp = new FFTApp(document, this.fft);
this.ddsFrequency = new DDSFrequency(document, this.fft);

window.onbeforeunload = () => { client.exit(); };
}
this.n_pts = this.fft.fft_size / 2;
this.x_min = 0;
this.x_max = this.fft.status.fs / 1E6 / 2;
this.y_min = -200;
this.y_max = 170;

private updateTemperatures() {
this.temperatureSensor.getTemperatures((temperatures: Float32Array) => {
this.temperatureVoltageReference.innerHTML = temperatures[0].toFixed(3).toString();
this.temperatureBoardSpan.innerHTML = temperatures[1].toFixed(3).toString();
this.temperatureZynqSpan.innerHTML = temperatures[2].toFixed(3).toString();
this.plotBasics = new PlotBasics(document, plot_placeholder, this.plot, this.n_pts, this.x_min, this.x_max, this.y_min, this.y_max, this.fft, "", "Frequency (MHz)");
this.plot = new Plot(document, this.fft, this.plotBasics);

requestAnimationFrame( () => { this.updateTemperatures(); } );
});
}
this.temperatureSensorApp = new TemperatureSensorApp(document, this.temperatureSensor);
this.powerMonitorApp = new PowerMonitorApp(document, this.powerMonitor);
this.clockGeneratorApp = new ClockGeneratorApp(document, this.clockGenerator);
this.precisionChannelsApp = new PrecisionChannelsApp(document, this.precisionAdc, this.precisionDac);
this.exportFile = new ExportFile(document, this.plot);

private updateSupplies() {
this.powerMonitor.getSuppliesUI((supplyValues: Float32Array) => {
this.supplyMainCurrentSpan.innerHTML = (supplyValues[0] * 1E3).toFixed(1).toString();
this.supplyMainVoltageSpan.innerHTML = supplyValues[1].toFixed(3).toString();
this.supplyClockCurrentSpan.innerHTML = (supplyValues[2] * 1E3).toFixed(1).toString();
this.supplyClockVoltageSpan.innerHTML = supplyValues[3].toFixed(3).toString();
});
});
}, false);

requestAnimationFrame( () => { this.updateSupplies(); });
});
window.onbeforeunload = () => { client.exit(); };
}

private updatePrecisionAdcValues() {
this.precisionAdc.getAdcValues((adcValues: Float32Array) => {
for (let i: number = 0; i < this.precisionAdcNum; i++) {
this.precisionAdcSpans[i].innerHTML = (adcValues[i] * 1000).toFixed(4).toString();
}

requestAnimationFrame( () => { this.updatePrecisionAdcValues(); });
});
}
}

let app = new App(window, document, location.hostname, $('#plot-placeholder'));
32 changes: 32 additions & 0 deletions examples/alpha250/fft/web/clock-generator/clock-generator-app.ts
@@ -0,0 +1,32 @@
class ClockGeneratorApp {

private clkgenInputs: HTMLInputElement[];

constructor(document: Document, private driver) {
this.clkgenInputs = <HTMLInputElement[]><any>document.getElementsByClassName("clkgen-input");
this.initClkgenInputs();
this.updateReferenceClock();
}

private initClkgenInputs(): void {
for (let i = 0; i < this.clkgenInputs.length; i ++) {
this.clkgenInputs[i].addEventListener('change', (event) => {
this.driver[(<HTMLInputElement>event.currentTarget).dataset.command](parseInt((<HTMLInputElement>event.currentTarget).value));
})
}
}

private updateReferenceClock() {
this.driver.getReferenceClock( (clkin: number) => {

let clkIndex: string = "0";
if (clkin !== 0) {
clkIndex = "2";
}

(<HTMLInputElement>document.querySelector("[data-command='setReferenceClock'][value='" + clkIndex + "']")).checked = true;
requestAnimationFrame( () => { this.updateReferenceClock(); } )
});
}

}
@@ -0,0 +1,9 @@
<template class="template">
<label for="reference-clock">Reference Clock (10 MHz):</label>
<div class="radio-wrapper">
<input type="radio" name="reference-clock" value="2" checked class="clkgen-input" data-valuestr="internal" data-command="setReferenceClock">Internal
</div>
<div class="radio-wrapper">
<input type="radio" name="reference-clock" value="0" class="clkgen-input" data-valuestr="external" data-command="setReferenceClock">External
</div>
</template>
@@ -0,0 +1,9 @@
<template class="template">
<label for="sampling-frequency">Sampling Frequency:</label>
<div class="radio-wrapper">
<input type="radio" name="sampling-frequency" value="0" checked class="clkgen-input" data-command="setSamplingFrequency" data-valuestr="200">200 MHz
</div>
<div class="radio-wrapper">
<input type="radio" name="sampling-frequency" value="1" class="clkgen-input" data-command="setSamplingFrequency" data-valuestr="250">250 MHz
</div>
</template>

0 comments on commit 629d288

Please sign in to comment.