libpruio  0.6.8
Fast and easy Digital/Analog Input/Output for Beaglebones
triggers.bas File Reference

Example: start measurements in MM mode by triggers. More...

#include "BBB/pruio.bi"
#include "BBB/pruio_pins.bi"
#include "fbgfx.bi"
Include dependency graph for triggers.bas:

Go to the source code of this file.

Macros

#define PIN   /* P8_07 */
 define the pin to use for digital trigger
 
#define STP   /* 11 */
 define the step number to use for analog trigger
 

Functions

int main ()
 

Variables

VAR S_W = 0
 The screen width.
 
VAR S_H = 0
 The srceen hight.
 
VAR BPP = 0
 The bits per plain number.
 
VAR full = fb.GFX_FULLSCREEN
 Fullscreen or windowed mode.
 
VAR p = INSTR(COMMAND, "x")
 The position of the 'x' character (if any).
 
VAR w = VALINT(COMMAND)
 The required window width.
 
VAR h = VALINT(MID(COMMAND, p + 1))
 The required window hight.
 
UInt32 col [...]
 The colors for the lines (= channels). More...
 
VAR io = NEW PruIo
 Create a PruIo structure, wakeup subsystems.
 
VAR gap = 2
 The gap between x values.
 
VAR samp = S_W \ gap
 The number of samples to fetch.
 
VAR mask = (1 SHL 5) + (1 SHL 8)
 Steps 5 & 8 active (AIN4, AIN7).
 
VAR tmr = 1e6
 The sampling rate (1 kHz).
 
VAR trg = 0
 The current trigger value.
 
VAR trg1 = .Adc->mm_trg_pin(PIN)
 A GPIO trigger specification.
 
VAR trg2 = .Adc->mm_trg_ain(STP, &h8000)
 An analog trigger specification.
 
VAR trg3 = .Adc->mm_trg_pre(0, -&h8000, samp SHR 1)
 A pre-trigger specification.
 
VAR lnr = IIF(S_H > 72, S_H SHR 3 - 8, 1)
 The menue line number.
 
VAR max = .Adc->Samples - .Adc->ChAz
 The max. index for samples.
 
VAR scale = S_H / 65520
 The factor to scale sample to screen pixels.
 
VAR k = 0
 The keycode of user input.
 
VAR fg = RGB(0, 0, 0)
 The foreground color.
 
VAR bg = RGB(250, 250, 250)
 The background color.
 
VAR i = c + .Adc->ChAz
 The samples index.
 
VAR x = gap
 The x position at the screen.
 

Detailed Description

Example: start measurements in MM mode by triggers.

This file contains an example on how to use libpruio to measure analog input and draw a graph of the sampled data. Triggering of measurement can be done by different events. Find a functional description in section triggers.

Licence: GPLv3, Copyright 2014-2023 by Thomas{ doT ]Freiherr[ At ]gmx[ DoT }net

Compile by: fbc -w all triggers.bas

Since
0.0

Definition in file triggers.bas.

Function Documentation

◆ main()

int main ( )

The main function.

Definition at line 147 of file triggers.bas.

Here is the call graph for this function:

Variable Documentation

◆ col

UInt32 col[...]
Initial value:
= {
, RGBA(255, 0, 0, 255)
, RGBA( 0, 255, 0, 255)
, RGBA( 0, 0, 255, 255)
, RGBA(255, 255, 0, 255)
, RGBA(255, 0, 255, 255)
, RGBA( 0, 255, 255, 255)
, RGBA(127, 127, 127, 255)
}

The colors for the lines (= channels).

Definition at line 52 of file triggers.bas.