78 lines
2.2 KiB
TypeScript
78 lines
2.2 KiB
TypeScript
import LogicalWaveFormDisplay from "./LogicalWaveFormDisplay.vue";
|
|
|
|
type LogicDataType = {
|
|
x: number[];
|
|
y: number[][]; // 8 channels of digital data (0 or 1)
|
|
xUnit: "s" | "ms" | "us" | "ns";
|
|
channelNames: string[];
|
|
};
|
|
|
|
// Test data generator for 8-channel digital signals
|
|
function generateTestLogicData(): LogicDataType {
|
|
const sampleRate = 10000; // 10kHz sampling
|
|
const duration = 1;
|
|
const points = Math.floor(sampleRate * duration);
|
|
|
|
const x = Array.from({ length: points }, (_, i) => (i / sampleRate) * 1000); // time in ms
|
|
|
|
// Generate 8 channels with different digital patterns
|
|
const y = [
|
|
// Channel 0: Clock signal 100Hz
|
|
Array.from(
|
|
{ length: points },
|
|
(_, i) => Math.floor((100 * i) / sampleRate) % 2,
|
|
),
|
|
// Channel 1: Clock/2 signal 50Hz
|
|
Array.from(
|
|
{ length: points },
|
|
(_, i) => Math.floor((50 * i) / sampleRate) % 2,
|
|
),
|
|
// Channel 2: Clock/4 signal 25Hz
|
|
Array.from(
|
|
{ length: points },
|
|
(_, i) => Math.floor((25 * i) / sampleRate) % 2,
|
|
),
|
|
// Channel 3: Clock/8 signal 12.5Hz
|
|
Array.from(
|
|
{ length: points },
|
|
(_, i) => Math.floor((12.5 * i) / sampleRate) % 2,
|
|
),
|
|
// Channel 4: Data signal (pseudo-random pattern)
|
|
Array.from(
|
|
{ length: points },
|
|
(_, i) => Math.abs( Math.floor(Math.sin(i * 0.01) * 10) % 2 ),
|
|
),
|
|
// Channel 5: Enable signal (periodic pulse)
|
|
Array.from(
|
|
{ length: points },
|
|
(_, i) => (Math.floor(i / 50) % 10) < 3 ? 1 : 0,
|
|
),
|
|
// Channel 6: Reset signal (occasional pulse)
|
|
Array.from(
|
|
{ length: points },
|
|
(_, i) => (Math.floor(i / 200) % 20) === 0 ? 1 : 0,
|
|
),
|
|
// Channel 7: Status signal (slow changing)
|
|
Array.from(
|
|
{ length: points },
|
|
(_, i) => Math.floor(i / 1000) % 2,
|
|
),
|
|
];
|
|
|
|
const channelNames = [
|
|
"CLK",
|
|
"CLK/2",
|
|
"CLK/4",
|
|
"CLK/8",
|
|
"PWM",
|
|
"ENABLE",
|
|
"RESET",
|
|
"STATUS"
|
|
];
|
|
|
|
return { x, y, xUnit: "ms", channelNames };
|
|
}
|
|
|
|
export { LogicalWaveFormDisplay, generateTestLogicData, type LogicDataType };
|
|
export { default as TriggerSettings } from './TriggerSettings.vue'
|
|
export { default as ChannelConfig } from './ChannelConfig.vue' |