Giter Club home page Giter Club logo

saleae-logic2-automation-java's Introduction

Saleae Logic2 Automation API for Java

Lets you control Saleae logic analyzers via the Saleae Logic 2 software from a Java program.

Saleae provides a gRPC API and Python library, this project is a Java library for that API.

The gRPC API can only control an already-running instance of the Logic 2 software. It cannot communicate directly with the logic analyzer hardware.

How to get the Git submodule

The gRPC API is specified using a Protocol Buffer langauge file (saleae.proto) in the Python library. We need that file to generate Java code, so the entire Python library repository is included as a Git submodule.

If you don't do anything special when cloning the repository then there will be an empty subdirectory called "logic2-automation". There are two ways to get the submodule:

  1. When you clone the repository, add the --recurse-submodules option:

    git clone --recurse-submodules https://github.com/pfroud/saleae-logic2-automation-java.git
    
  2. Or, if you have already cloned the repository, run:

    git submodule update --init
    

    Link to documentation about the git submodule update command

See https://git-scm.com/book/en/v2/Git-Tools-Submodules#_cloning_submodules.

After running the Gradle build, a bunch of files will be created:

  • File build/generated/source/proto/main/grpc/saleae/ManagerGrpc.java
  • A lof of .java files in build/generated/source/proto/main/java/saleae
  • A lot of .class files in build/classes/java/main/saleae
  • File build/resources/main/saleae.proto

Example code

The examples directory has lots of ready-to-run examples.

The Logic 2 software must already be running for the examples to work.

All the examples use a simulated device included in Logic 2, so a logic analyzer does not need to be connected to the computer.

Java code style

Java does not support keyword arguments aka named arguments, so we cannot do

my_device_config = automation.LogicDeviceConfiguration(
    enabled_digital_channels=[0, 1, 2, 3],
    digital_sample_rate=10_000_000,
    digital_threshold_volts=3.3
)

Instead I am doing

DeviceConfig myDeviceConfig = new DeviceConfig();
myDeviceConfig.digitalChannels = List.of(0, 1, 2, 3);
myDeviceConfig.digitalSampleRate = 10_000_000;
myDeviceConfig.digitalThresholdVolts = 3.3;

saleae-logic2-automation-java's People

Contributors

pfroud avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.