Skip to content

Commit

Permalink
rename nScope to nLab (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjmeyer committed Oct 18, 2024
1 parent 10346dd commit b814302
Show file tree
Hide file tree
Showing 24 changed files with 232 additions and 232 deletions.
4 changes: 2 additions & 2 deletions .run/List All nScopes.run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="List All nScopes" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Examples">
<option name="command" value="run --example list_all_nscopes" />
<configuration default="false" name="List All nLabs" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Examples">
<option name="command" value="run --example list_all_nlabs" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<option name="emulateTerminal" value="false" />
<option name="channel" value="DEFAULT" />
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "nscope"
name = "nlabapi"
version = "1.0.0"
authors = ["David Meyer <david@nscope.org>"]
authors = ["David Meyer <david@getnlab.com>"]
license = "GPL-3.0"
description = """
Communication with nScope devices
Communication with nLab devices
"""
homepage = "https://www.nscope.org"
repository = "https://github.com/nLabs-nScope/nscope-rs"
documentation = "https://github.com/nLabs-nScope/nscope-rs"
homepage = "https://www.getnlab.com"
repository = "https://github.com/nLabs-nScope/nlabapi"
documentation = "https://github.com/nLabs-nScope/nlabapi"
readme = "README.md"
edition = "2018"

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# nscope-rs
[![Crates.io](https://img.shields.io/crates/v/nscope)](https://crates.io/crates/nscope)
[![License](https://img.shields.io/crates/l/nscope)](LICENSE)
[![Documentation](https://docs.rs/nscope/badge.svg)](https://docs.rs/nscope)
# nlabapi
[![Crates.io](https://img.shields.io/crates/v/nlabapi)](https://crates.io/crates/nlabapi)
[![License](https://img.shields.io/crates/l/nlabapi)](LICENSE)
[![Documentation](https://docs.rs/nlabapi/badge.svg)](https://docs.rs/nlabapi)

![Cargo Test](https://github.com/nLabs-nScope/nscope-rs/actions/workflows/tests.yml/badge.svg)
![Cargo Test](https://github.com/nLabs-nScope/nlabapi/actions/workflows/tests.yml/badge.svg)

A Rust implementation of the nScope API.
Low-level software interface for nLab devices
18 changes: 9 additions & 9 deletions examples/analog_outputs.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/***************************************************************************************************
*
* nLabs, LLC
* https://nscope.org
* https://getnlab.com
* Copyright(c) 2020. All Rights Reserved
*
* This file is part of the nScope API
* This file is part of the nLab API
*
**************************************************************************************************/

use nscope::{LabBench};
use nlabapi::{LabBench};
use std::{thread, time};
use std::error::Error;

Expand All @@ -18,16 +18,16 @@ fn main() -> Result<(), Box<dyn Error>> {
// Create a LabBench
let bench = LabBench::new()?;

// Open the first available nScope
let nscope = bench.open_first_available(true)?;
// Open the first available nLab
let nlab = bench.open_first_available(true)?;

nscope.a1.turn_on();
nlab.a1.turn_on();
thread::sleep(time::Duration::from_secs(10));
nscope.a1.turn_off();
nlab.a1.turn_off();

nscope.a2.turn_on();
nlab.a2.turn_on();
thread::sleep(time::Duration::from_secs(10));
nscope.a2.turn_off();
nlab.a2.turn_off();

Ok(())
}
22 changes: 11 additions & 11 deletions examples/data_request.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/***************************************************************************************************
*
* nLabs, LLC
* https://nscope.org
* https://getnlab.com
* Copyright(c) 2020. All Rights Reserved
*
* This file is part of the nScope API
* This file is part of the nLab API
*
**************************************************************************************************/

use nscope::{AnalogSignalPolarity, LabBench, Trigger, TriggerType};
use nlabapi::{AnalogSignalPolarity, LabBench, Trigger, TriggerType};
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
Expand All @@ -17,30 +17,30 @@ fn main() -> Result<(), Box<dyn Error>> {
// Create a LabBench
let bench = LabBench::new()?;

// Open the first available nScope
let nscope = bench.open_first_available(true)?;
// Open the first available nLab
let nlab = bench.open_first_available(true)?;

nscope.a1.turn_on();
nlab.a1.turn_on();

let sweep_handle = nscope.request(8000.0, 19200, None);
let sweep_handle = nlab.request(8000.0, 19200, None);

for sample in sweep_handle.receiver {
println!("{:?}", sample.data);
}

nscope.a1.turn_off();
nlab.a1.turn_off();


let sweep_handle = nscope.request(8000.0, 19200, Some(Trigger{
let sweep_handle = nlab.request(8000.0, 19200, Some(Trigger{
is_enabled: true,
trigger_type: TriggerType::RisingEdge,
source_channel: 0,
trigger_level: 0.0,
trigger_delay_us: 0,
}));

nscope.a1.set_polarity(AnalogSignalPolarity::Bipolar);
nscope.a1.turn_on();
nlab.a1.set_polarity(AnalogSignalPolarity::Bipolar);
nlab.a1.turn_on();
for sample in sweep_handle.receiver {
println!("{:?}", sample.data);
}
Expand Down
20 changes: 10 additions & 10 deletions examples/fast_communication.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/***************************************************************************************************
*
* nLabs, LLC
* https://nscope.org
* https://getnlab.com
* Copyright(c) 2020. All Rights Reserved
*
* This file is part of the nScope API
* This file is part of the nLab API
*
**************************************************************************************************/

use nscope::LabBench;
use nlabapi::LabBench;
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
Expand All @@ -17,16 +17,16 @@ fn main() -> Result<(), Box<dyn Error>> {
// Create a LabBench
let bench = LabBench::new()?;

// Open the first available nScope
let mut nscope = bench.open_first_available(true)?;
// Open the first available nLab
let mut nlab = bench.open_first_available(true)?;

nscope.ch1.turn_on();
nscope.ch2.turn_on();
nscope.ch3.turn_on();
nscope.ch4.turn_on();
nlab.ch1.turn_on();
nlab.ch2.turn_on();
nlab.ch3.turn_on();
nlab.ch4.turn_on();

loop {
let sweep_handle = nscope.request(2_000_000.0, 1200, None);
let sweep_handle = nlab.request(2_000_000.0, 1200, None);
while sweep_handle.receiver.recv().is_ok() {}
}
}
16 changes: 8 additions & 8 deletions examples/list_all_nscopes.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/***************************************************************************************************
*
* nLabs, LLC
* https://nscope.org
* https://getnlab.com
* Copyright(c) 2020. All Rights Reserved
*
* This file is part of the nScope API
* This file is part of the nLab API
*
**************************************************************************************************/

use nscope::LabBench;
use nlabapi::LabBench;
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
Expand All @@ -17,13 +17,13 @@ fn main() -> Result<(), Box<dyn Error>> {
// Create a LabBench
let bench = LabBench::new()?;

// Print the bench to show a list of detected nScopes
// Print the bench to show a list of detected nLabs
println!("Lab Bench: \n{:?}", bench);

println!("\nManual list of all detected nScopes:");
// Or loop over all nScope links in the list and print them
for nscope_link in bench.list() {
println!(" {:?}", nscope_link)
println!("\nManual list of all detected nLabs:");
// Or loop over all nLab links in the list and print them
for nlab_link in bench.list() {
println!(" {:?}", nlab_link)
}
Ok(())
}
18 changes: 9 additions & 9 deletions examples/monitor_power.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/***************************************************************************************************
*
* nLabs, LLC
* https://nscope.org
* https://getnlab.com
* Copyright(c) 2020. All Rights Reserved
*
* This file is part of the nScope API
* This file is part of the nLab API
*
**************************************************************************************************/

use nscope::{LabBench, Nscope};
use nlabapi::{LabBench, Nlab};
use std::{thread, time};
use std::error::Error;

Expand All @@ -18,15 +18,15 @@ fn main() -> Result<(), Box<dyn Error>> {
// Create a LabBench
let bench = LabBench::new()?;

// Open all available nScope links
let mut nscopes: Vec<Nscope> = bench.open_all_available();
// Open all available nLab links
let mut nlabs: Vec<Nlab> = bench.open_all_available();

loop {
thread::sleep(time::Duration::from_millis(10));

nscopes.retain(|n| n.is_connected());
nlabs.retain(|n| n.is_connected());

for n in nscopes.iter() {
for n in nlabs.iter() {
match n.power_status() {
Ok(status) => {
let state = format!("{:?}", status.state);
Expand All @@ -36,8 +36,8 @@ fn main() -> Result<(), Box<dyn Error>> {
}
}

if nscopes.is_empty() {
return Err("Cannot find any nScopes".into())
if nlabs.is_empty() {
return Err("Cannot find any nLabs".into())
}
}
}
18 changes: 9 additions & 9 deletions examples/pulse_outputs.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/***************************************************************************************************
*
* nLabs, LLC
* https://nscope.org
* https://getnlab.com
* Copyright(c) 2020. All Rights Reserved
*
* This file is part of the nScope API
* This file is part of the nLab API
*
**************************************************************************************************/

use nscope::{LabBench};
use nlabapi::{LabBench};
use std::{thread, time};
use std::error::Error;

Expand All @@ -18,16 +18,16 @@ fn main() -> Result<(), Box<dyn Error>> {
// Create a LabBench
let bench = LabBench::new()?;

// Open the first available nScope
let nscope = bench.open_first_available(true)?;
// Open the first available nLab
let nlab = bench.open_first_available(true)?;

nscope.p1.turn_on();
nlab.p1.turn_on();
thread::sleep(time::Duration::from_secs(10));
nscope.p1.turn_off();
nlab.p1.turn_off();

nscope.p2.turn_on();
nlab.p2.turn_on();
thread::sleep(time::Duration::from_secs(10));
nscope.p2.turn_off();
nlab.p2.turn_off();

Ok(())
}
24 changes: 12 additions & 12 deletions examples/update_firmware.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/***************************************************************************************************
*
* nLabs, LLC
* https://nscope.org
* https://getnlab.com
* Copyright(c) 2020. All Rights Reserved
*
* This file is part of the nScope API
* This file is part of the nLab API
*
**************************************************************************************************/

use nscope::LabBench;
use nlabapi::LabBench;
use std::error::Error;
use std::thread;
use std::time::Duration;
Expand All @@ -19,14 +19,14 @@ fn main() -> Result<(), Box<dyn Error>> {
// Create a LabBench
let mut bench = LabBench::new()?;

// Print the bench to show a list of detected nScopes
// Print the bench to show a list of detected nLabs
println!("{:?}", bench);

for nscope_link in bench.list() {
// Request DFU on any nScope that is available
if nscope_link.available {
if let Err(e) = nscope_link.request_dfu() {
println!("Failed to request DFU on an available nScope: {e}")
for nlab_link in bench.list() {
// Request DFU on any nLab that is available
if nlab_link.available {
if let Err(e) = nlab_link.request_dfu() {
println!("Failed to request DFU on an available nLab: {e}")
}
}
}
Expand All @@ -38,9 +38,9 @@ fn main() -> Result<(), Box<dyn Error>> {
// Print the bench to show the refreshed list
println!("{:?}", bench);

for nscope_link in bench.list() {
if let Err(e) = nscope_link.update() {
println!("Encountered an error updating nScope: {e}")
for nlab_link in bench.list() {
if let Err(e) = nlab_link.update() {
println!("Encountered an error updating nLab: {e}")
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/firmware.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/***************************************************************************************************
*
* nLabs, LLC
* https://nscope.org
* https://getnlab.com
* Copyright(c) 2020. All Rights Reserved
*
* This file is part of the nScope API
* This file is part of the nLab API
*
**************************************************************************************************/

Expand Down
Loading

0 comments on commit b814302

Please sign in to comment.