AudioScience HPI Version_4.24.1

GPIO

Blocks

The GPIO (general purpose input and output) block supports reading and writing GPIO inputs and outputs on an adapter. More...

The GPIO (general purpose input and output) block supports reading and writing GPIO inputs and outputs on an adapter.

Most adapters implement GPIO inputs as optos and GPIO outputs as relays. Please refer to the adapter's datasheet for details of the exact electrical interface.

The GPIO is a block control which is in turn an implementation of a universal control (see Universal Control).

Data types

The list of supported datatypes is as follows:

entity_type_boolean

Array of booleans packed as one boolean per octet, using 'T' or 'F' or 'x'.

entity_type_sequence

Sequence of potentially heterogeneous entities.

Conceptually similar to C struct.

entity_type_int

A 32 bit integer.

GPIO

GPIO
    General purpose input and output block
Inputs
    Use this parameter to read the current bit settings
Outputs
    Use this parameter to write the current bit settings
V/G Pin Function
    The function of the V/G pin on the terminal block

Parameter list

Name GPIO
DescriptionGeneral purpose input and output block.
OptionalNo
Typesequence / entity_type_sequence / a sequence of parameters follow
Count2
Attributesread
Added in versionfuture
Example
static void print_block_control(
        hpi_hsubsys_t *hSubSys,
        hpi_handle_t hMixer,
        hpi_handle_t hControl
)
{
        enum e_entity_role r;
        hpi_err_t err;
        char name[256];
        size_t size, items;
        int count;

        err = HPI_Object_GetRole(hControl, &r);
        if (err)
                HandleError(err);

        // name
        size = sizeof(name);
        err = HPI_Object_GetInfo( hControl,
                        entity_type_cstring, entity_role_classname,
                        name, &size, &items);
        if (err)
                HandleError(err);
        printf(" %s", name);

        // count
        size = sizeof(count);
        err = HPI_Object_GetInfo( hControl,
                        entity_type_int, entity_role_value,
                        &count, &size, &items);
        if (err)
                HandleError(err);
        printf(", count %d", count);

        // fetch parameter handles
        if ( r == entity_role_block ) {
                hpi_handle_t params[16]; /* should really use count */
                int i;
                size_t number;

                printf(" [");

                number = sizeof(params)/sizeof(hpi_handle_t);
                err = HPI_Object_BlockParameters(
                        hMixer,
                        hControl,
                        params,
                        &number);
                if (err)
                        HandleError(err);

                for ( i=0 ; i<number ; i++ ) {
                        if (i > 0)
                                printf(", ");
                        printf("%d",params[i]);
                }
                printf("]");
        }
}


Name Inputs
DescriptionUse this parameter to read the current bit settings.
OptionalNo
Typeboolean / entity_type_boolean / C99 type uint8_t
CountAxGpioIn_GetNum()
Attributesread volatile value
Added in version4.10.00
Example
struct hpi_control_t asihpi_control;
hpi_handle_t block;
hpi_handle_t param;
size_t value_size;
size_t value_items;
uint8_t *Inputs;
/* set source and destination node */
asihpi_control.wSrcNodeType = HPI_SOURCENODE_ADAPTER;
asihpi_control.wSrcNodeIndex = 0;
asihpi_control.wDstNodeType = 0;
asihpi_control.wDstNodeIndex = 0;
err = HPI_Object_BlockHandle(hMixer,
                asihpi_control.wSrcNodeType, asihpi_control.wSrcNodeIndex,
                asihpi_control.wDstNodeType, asihpi_control.wDstNodeIndex,
                "GPIO",
                &block );
err = HPI_Object_ParameterHandle( hMixer, block, "Inputs", &param);
if (!err)
{
        err = HPI_Object_GetInfo( param,
                        entity_type_boolean, entity_role_value,
                        NULL, &value_size, &value_items);
}

Inputs = calloc(value_items, 1);
err = HPI_Object_GetValue(param, entity_type_boolean, value_items,
            Inputs, value_items * sizeof(uint8_t) );
// examine Inputs here
free(Inputs);


Name Outputs
DescriptionUse this parameter to write the current bit settings.
OptionalNo
Typeboolean / entity_type_boolean / C99 type uint8_t
CountAxGpioOut_GetNum()
Attributesread/write volatile value
Added in version4.10.00
Example
struct hpi_control_t asihpi_control;
hpi_handle_t block;
hpi_handle_t param;
size_t value_size;
size_t value_items;
uint8_t *Outputs;
/* set source and destination node */
asihpi_control.wSrcNodeType = HPI_SOURCENODE_ADAPTER;
asihpi_control.wSrcNodeIndex = 0;
asihpi_control.wDstNodeType = 0;
asihpi_control.wDstNodeIndex = 0;
err = HPI_Object_BlockHandle(hMixer,
                asihpi_control.wSrcNodeType, asihpi_control.wSrcNodeIndex,
                asihpi_control.wDstNodeType, asihpi_control.wDstNodeIndex,
                "GPIO",
                &block );
err = HPI_Object_ParameterHandle( hMixer, block, "Outputs", &param);
if (!err)
{
        err = HPI_Object_GetInfo( param,
                        entity_type_boolean, entity_role_value,
                        NULL, &value_size, &value_items);
}

Outputs = calloc(value_items, 1);
err = HPI_Object_GetValue(param, entity_type_boolean, value_items,
            Outputs, value_items * sizeof(uint8_t) );
Outputs[0] = 'T';
err = HPI_Object_SetValue(param, entity_type_boolean, value_items,
            Outputs, value_items * sizeof(uint8_t) );


Name V/G Pin Function
Description

The function of the V/G pin on the terminal block. See the user manual for a more complete description.

Valid enumeration strings are:

  • Power Input
  • Ground
OptionalYes
Typeenumerated / #entity_type_enumerated_strings / contains string enumerations
Count1
Attributesread/write
Added in version4.10.00
Example
struct hpi_control_t asihpi_control;
hpi_handle_t block;
hpi_handle_t param;
size_t value_size;
size_t value_items;
uint32_t V_G_Pin_Function;
/* set source and destination node */
asihpi_control.wSrcNodeType = HPI_SOURCENODE_ADAPTER;
asihpi_control.wSrcNodeIndex = 0;
asihpi_control.wDstNodeType = 0;
asihpi_control.wDstNodeIndex = 0;
err = HPI_Object_BlockHandle(hMixer,
                asihpi_control.wSrcNodeType, asihpi_control.wSrcNodeIndex,
                asihpi_control.wDstNodeType, asihpi_control.wDstNodeIndex,
                "GPIO",
                &block );
err = HPI_Object_ParameterHandle( hMixer, block, "V/G Pin Function", &param);
if (!err)
{
        err = HPI_Object_GetInfo( param,
                        entity_type_int, entity_role_value,
                        NULL, &value_size, &value_items);
}

V_G_Pin_Function = 1;
/* TODO */
/* TODO */
/* TODO */
/* TODO */
err = HPI_Object_GetValue(param, entity_type_int, 1,
            &V_G_Pin_Function, sizeof(V_G_Pin_Function));