Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWG - RFC #8

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open

AWG - RFC #8

wants to merge 34 commits into from

Conversation

alon
Copy link

@alon alon commented Apr 7, 2022

This is related to issue #2

It is partially I think correct and partially definitely not.

I would like to get comments on:
enums - is this the right way?
PicoDriver trait extension - ditto? especially the use of unimplemented macro.
ps2000a implementation

Lastly the PicoStreamingDevice additions are pure throw away code, just for testing. What worked was basically:

    fn connect_to_scope_real(&mut self) {
        // ... get a device the regular way
        let stream_device = device.into_streaming_device();

        //stream_device.set_sig_gen_arbitrary();
        stream_device.set_sig_gen_built_in_v2();

        stream_device.enable_channel(PicoChannel::A, PicoRange::X1_PROBE_2V, PicoCoupling::DC);
        stream_device.enable_channel(PicoChannel::B, PicoRange::X1_PROBE_1V, PicoCoupling::AC);
        // When handler goes out of scope, the subscription is dropped

        stream_device.new_data.subscribe(self.handler.clone());
        stream_device.start(1_000_000).unwrap();

        self.stream_device = Some(stream_device);
    }

@timfish
Copy link
Owner

timfish commented Apr 11, 2022

For the enums variants, I would shorten them like:

pub enum PicoSigGenTrigType
{
    Rising = 0,
    Falling = 1,
    ...
}

For the PicoStreamingDevice functions, rather than many arguments, it might be nicer to put them into a struct and then implement Default. This way you can leave out properties that aren't important and use it like:

device.set_sig_gen_properties_built_in(SigGenProperties { 
  trigger_type: PicoTriggerType::Rising,
  ..Default::default()  
});

Having not used the sig gen/awg APIs on these devices I don't know how viable default options are.
I still need to find some time to try out these APIs and also see how they compare across the many drivers.

The PicoStreamingDevice attempts to try and hide all the differences between all the drivers/devices and was primarily for my own use case which was streaming raw, gap-less data at high speed from any Pico device. It also automatically reconfigures and restarts streaming if it gets disconnected and stores the device config required to do this.

What are your plans for siggen/awg while streaming?

@alon
Copy link
Author

alon commented Apr 12, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants