Code Monkey home page Code Monkey logo

waveforms-sdk-getting-started-cpp's Introduction

Description

Demo package for the WaveForms SDK Getting Started guide and multiple test scripts for different instruments.

Check: Getting Started with the WaveForms SDK for more details.


Available tests:

  • empty test template
  • analog signal generation and recording test
  • digital signal generation and recording test
  • blinking LEDs with the Suplpies and the Static I/O instruments
  • UART in/out test using the Pmod CLS and the Pmod MAXSonar
  • SPI in/out test using the Pmod CLS and the Pmod ALS
  • I2C in/out test using the Pmod CLS and the Pmod TMP2
  • board temperature test
  • device information logging

Available instruments and functions:

Device

  • open
  • check_error
  • close
  • temperature

Oscilloscope

  • open
  • measure
  • trigger
  • record
  • close

Waveform Generator

  • generate
  • close
  • enable
  • disable

Power Supplies

  • switch_
  • close

Digital Multimeter

  • open
  • measure
  • close

Logic Analyzer

  • open
  • trigger
  • record
  • close

Pattern Generator

  • generate
  • close
  • enable
  • disable

Static I/O

  • set_mode
  • get_state
  • set_state
  • set_current
  • set_pull
  • close

Protocol

UART

  • open
  • read
  • write
  • close

SPI

  • open
  • read
  • write
  • exchange
  • close

I2C

  • open
  • read
  • write
  • exchange
  • close

waveforms-sdk-getting-started-cpp's People

Contributors

vvalmos avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hebron

waveforms-sdk-getting-started-cpp's Issues

Const objects declared in dwf.h and multiple-inclusion errors

I'm building C applications using the dwfsdk. This library has a single header file to import (convenient) which contains both function declarations and configuration/enum constants. When I have a single file including "dwf.h", there is no issue. But when I include this file in multiple source files (i.e. a driver wrapper), GCC complains about multiple declarations of the the 197 "const" entries contained within "dwf.h".

I think the correct way to solve this is to replace the consts with typedef enum, as in:

// analog acquisition filter:
typedef int FILTER;
const FILTER filterDecimate = 0;
const FILTER filterAverage  = 1;
const FILTER filterMinMax   = 2;

can be converted to:

typedef enum {
  filterDecimate = 0,
  filterAverage = 1,
  filterMinMax = 2
} FILTER;

There are a few instances where such a replacement is not quite appropriate, in which case a macro definition is a potential solution.

I'm attaching a version of "dwf.h" which implements this solution (but since github doesn't allow attaching .h files, I have changed
the extension to .txt).
dwf.txt

I have not tested every function in the library (in fact have only tested a few), but it compiles while avoiding multiple definitions and seems to work so far. I have added a few "TODO" comments to highlight potential type conflicts if used with a compiler that doesn't allow implicit type conversion. These can be solved with macro definitions as well if they turn out to cause issues.

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.