libpruio  0.0
AM33xx-PRU driver for digital input / output and analog input
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pruio_c_wrapper.h File Reference

The main header code of the C wrapper for libpruio. More...

#include "pruio.h"
#include "pruio.hp"
Include dependency graph for pruio_c_wrapper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

PruIopruio_new (uint8 Av, uint32 OpD, uint8 SaD, uint8 Pru)
 C wrapper to create a PruIo instance. More...
 
void pruio_destroy (PruIo *Io)
 C wrapper to destroy a PruIo instance. More...
 
char * pruio_config (PruIo *Io, uint32 Samp, uint32 Mask, uint32 Tmr, uint16 Mds, uint16 ClDv)
 C wrapper for function PruIo::config(). More...
 
char * pruio_adc_step (PruIo *Io, uint8 Stp, uint8 ChN, uint8 Av, uint8 SaD, uint32 OpD)
 C wrapper for function PruIo::adc_step(). More...
 
char * pruio_gpio_get_config (PruIo *Io, uint8 Ball)
 C wrapper for function PruIo::gpio_get_config(). More...
 
char * pruio_gpio_set (PruIo *Io, uint8 Ball, uint8 Modus, uint8 Lokk)
 C wrapper for function PruIo::gpio_set(). More...
 
uint32 pruio_gpio_get (PruIo *Io, uint8 Ball)
 C wrapper for function PruIo::gpio_get(). More...
 
char * pruio_gpio_out (PruIo *Io, uint8 Ball, uint8 Modus)
 C wrapper for function PruIo::gpio_out(). More...
 
uint32 pruio_mm_trg_pin (PruIo *Io, uint8 Ball, uint8 GpioV, uint16 Skip)
 C wrapper for function PruIo::mm_trg_pin(). More...
 
uint32 pruio_mm_trg_ain (PruIo *Io, uint8 Stp, int32 AdcV, uint8 Rela, uint16 Skip)
 C wrapper for function PruIo::mm_trg_ain(). More...
 
uint32 pruio_mm_trg_pre (PruIo *Io, uint8 Stp, int32 AdcV, uint16 Samp, uint8 Rela)
 C wrapper for function PruIo::mm_trg_pre(). More...
 
char * pruio_mm_start (PruIo *Io, uint32 Trg1, uint32 Trg2, uint32 Trg3, uint32 Trg4)
 C wrapper for function PruIo::mm_start(). More...
 

Detailed Description

The main header code of the C wrapper for libpruio.

This file provides the declarations of the PruIo class member functions in C syntax. It also can be used to create language bindings for non-C languages to use libpruio in polyglot applications.

Note
The includes pruio.h and pruio_pins.h are not shown in this documentation because they confuse Doxygen. It mixes up references with the original headers pruio/pruio.bi and pruio/pruio_pins.bi.

Licence: LGPLv2

Copyright 2014 by Thomas{ dOt ]Freiherr[ At ]gmx[ DoT }net

Definition in file pruio_c_wrapper.h.

Function Documentation

PruIo* pruio_new ( uint8  Av,
uint32  OpD,
uint8  SaD,
uint8  Pru 
)

C wrapper to create a PruIo instance.

Parameters
Avavaraging for default steps (0 to 16, defaults to 0)
OpDopen delay for default steps (0 to 0x3FFFF, defaults to 0x98)
SaDsample delay for default steps (0 to 255, defaults to 0)
Prunumber of PRU subsystem to use (0 or 1, defaults to 1)
Returns
A pointer for the new instance.

This function wraps the constructor, check PruIo::PruIo() for details.

Since the constructor reads the original devices configurations and the destructor restores them, it's recommended to create and use just one PruIo instance at the same time.

Here is the caller graph for this function:

void pruio_destroy ( PruIo Io)

C wrapper to destroy a PruIo instance.

Parameters
IoThe pointer of the instance.

This function wraps the destructor, check PruIo::~PruIo() for details. (Doxygen should create a link here?!)

Here is the caller graph for this function:

char* pruio_config ( PruIo Io,
uint32  Samp,
uint32  Mask,
uint32  Tmr,
uint16  Mds,
uint16  ClDv 
)

C wrapper for function PruIo::config().

Parameters
IoThe pointer of the PruIo instance
Sampnumber of samples to fetch (defaults to zero)
Maskmask for active steps (defaults to all 8 channels active in steps 1 to 8)
Tmrtimer value in [ns] to specify the sampling rate (defaults to zero, MM only)
Mdsmodus for output (defaults to 4 = 16 bit)
ClDvdivisor for ADC input clock (defaults to 0 = full speed = 2.4 MHz)
Returns
zero on success (otherwise a string with an error message)

This function wraps the member function config, check PruIo::config() for details.

Here is the caller graph for this function:

char* pruio_adc_step ( PruIo Io,
uint8  Stp,
uint8  ChN,
uint8  Av,
uint8  SaD,
uint32  OpD 
)

C wrapper for function PruIo::adc_step().

Parameters
IoThe pointer of the PruIo instance
Stpstep index (0 = step 0 => charge step, 1 = step 1 (=> AIN0 by default), ..., 17 = idle step)
ChNchannel number to scan (0 = AIN0, 1 = AIN1, ...)
Avnew value for avaraging (defaults to 4)
SaDnew value for sample delay (defaults to 0)
OpDnew value for open delay (defaults to 0x98)
Returns
zero on success (otherwise a string with an error message)

This function wraps the member function adc_step, check PruIo::adc_step() for details.

char* pruio_gpio_get_config ( PruIo Io,
uint8  Ball 
)

C wrapper for function PruIo::gpio_get_config().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to describe
Returns
a human-readable text string (internal string, never free it)

This function wraps the member function adc_step, check PruIo::gpio_get_config() for details.

Here is the caller graph for this function:

char* pruio_gpio_set ( PruIo Io,
uint8  Ball,
uint8  Modus,
uint8  Lokk 
)

C wrapper for function PruIo::gpio_set().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to set
Modusthe mode for the GPIO
Lokkthe locking specification
Returns
zero on success (otherwise a pionter to an error message)

This function wraps the member function adc_step, check PruIo::gpio_set() for details.

Here is the caller graph for this function:

uint32 pruio_gpio_get ( PruIo Io,
uint8  Ball 
)

C wrapper for function PruIo::gpio_get().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to test
Returns
GPIO state (otherwise -1, check PruIo::Errr for an error message)

This function wraps the member function adc_step, check PruIo::gpio_get() for details.

char* pruio_gpio_out ( PruIo Io,
uint8  Ball,
uint8  Modus 
)

C wrapper for function PruIo::gpio_out().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to test
Modusthe state to set (0 = low, high otherwise)
Returns
zero on success (otherwise a pointer to an error message)

This function wraps the member function adc_step, check PruIo::gpio_out() for details.

Here is the caller graph for this function:

uint32 pruio_mm_trg_pin ( PruIo Io,
uint8  Ball,
uint8  GpioV,
uint16  Skip 
)

C wrapper for function PruIo::mm_trg_pin().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to test
GpioVthe state to check (defaults to high = 1)
Skipthe number of samples to skip (defaults to 0 = zero, max. 1023)
Returns
the trigger configuration (or zero in case of an error, check PruIo::Errr)

This function wraps the member function adc_step, check PruIo::mm_trg_pin() for details.

uint32 pruio_mm_trg_ain ( PruIo Io,
uint8  Stp,
int32  AdcV,
uint8  Rela,
uint16  Skip 
)

C wrapper for function PruIo::mm_trg_ain().

Parameters
IoThe pointer of the PruIo instance
Stpthe step number to use for trigger input
AdcVthe sample value to match (positive check greater than, negative check less than)
Relaif AdcV is relative to the current input
Skipthe number of samples to skip (defaults to 0 = zero, max. 1023)
Returns
the trigger configuration (or zero in case of an error, check PruIo::Errr)

This function wraps the member function adc_step, check PruIo::mm_trg_ain() for details.

uint32 pruio_mm_trg_pre ( PruIo Io,
uint8  Stp,
int32  AdcV,
uint16  Samp,
uint8  Rela 
)

C wrapper for function PruIo::mm_trg_pre().

Parameters
IoThe pointer of the PruIo instance
Stpthe step number to use for trigger input
AdcVthe sample value to match (positive check greater than, negative check less than)
Sampthe number of samples for the pre-trigger
Relaif AdcV is relative to the current input
Returns
the trigger configuration (or zero in case of an error, check PruIo::Errr)

This function wraps the member function adc_step, check PruIo::mm_trg_pre() for details.

char* pruio_mm_start ( PruIo Io,
uint32  Trg1,
uint32  Trg2,
uint32  Trg3,
uint32  Trg4 
)

C wrapper for function PruIo::mm_start().

Parameters
IoThe pointer of the PruIo instance
Trg1settings for first trigger (default = no trigger)
Trg2settings for second trigger (default = no trigger)
Trg3settings for third trigger (default = no trigger)
Trg4settings for fourth trigger (default = no trigger)
Returns
zero on success (otherwise a string with an error message)

This function wraps the member function adc_step, check PruIo::mm_start() for details.