Example: fetch ADC samples in a ring buffer and draw graf. More...
#include "BBB/pruio.bi"
#include "fbgfx.bi"
Go to the source code of this file.
Macros | |
#define | DRAW_GRAF() |
Macro to draw a graph from the valid half of the ring buffer. More... | |
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). More... | |
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 | samp = S_W SHL 1 |
The number of samples to fetch (ring buffer size). | |
VAR | scale = S_H / 65520 |
The scaling factor. | |
VAR | half = .Adc->Samples SHR 1 |
half size of the ring buffer | |
Example: fetch ADC samples in a ring buffer and draw graf.
This file contains an example on how to use the ring buffer mode of libpruio. A fixed step mask of AIN-4 and AIN-7 get sampled and drawn as a line graf to a grafic window. Unlike IO mode, the step mask cannot get changed in RB mode at run-time. Find a functional description in section rb_oszi.
Licence: GPLv3, Copyright 2014-2023 by Thomas{ doT ]Freiherr[ At ]gmx[ DoT }net
Compile by: fbc -w all rb_oszi.bas
Definition in file rb_oszi.bas.
#define DRAW_GRAF | ( | ) |
Macro to draw a graph from the valid half of the ring buffer.
Definition at line 58 of file rb_oszi.bas.
int main | ( | ) |
The main function.
Definition at line 97 of file rb_oszi.bas.
UInt32 col[...] |
The colors for the lines (= channels).
Definition at line 46 of file rb_oszi.bas.
VAR p = INSTR(COMMAND, "x") |
The position of the 'x' character (if any).
local pointer to the samples
Definition at line 28 of file rb_oszi.bas.