flinklib
flinklib: flink C library for Linux
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
dio.c File Reference

flink userspace library, subdevice function "digital I/O". More...

#include "flinklib.h"
#include "types.h"
#include "error.h"
#include "log.h"
#include <stdint.h>
Include dependency graph for dio.c:

Go to the source code of this file.

Functions

int flink_dio_set_direction (flink_subdev *subdev, uint32_t channel, uint8_t output)
 Configures a channel as input or output. More...
 
int flink_dio_set_value (flink_subdev *subdev, uint32_t channel, uint8_t value)
 Sets a output channel to a value. More...
 
int flink_dio_get_value (flink_subdev *subdev, uint32_t channel, uint8_t *value)
 Reads an input channel. More...
 

Detailed Description

flink userspace library, subdevice function "digital I/O".

Contains the high-level functions for a flink subdevice which realizes the function "digital I/O".

Author
Martin Züger

Definition in file dio.c.

Function Documentation

int flink_dio_get_value ( flink_subdev subdev,
uint32_t  channel,
uint8_t *  value 
)

Reads an input channel.

Parameters
subdevSubdevice containing the channel.
channelChannel number.
valueContains a value of nonzero if the input is set.
Returns
int: 0 on success, -1 in case of failure.

Definition at line 92 of file dio.c.

int flink_dio_set_direction ( flink_subdev subdev,
uint32_t  channel,
uint8_t  output 
)

Configures a channel as input or output.

Parameters
subdevSubdevice containing the channel.
channelChannel number.
outputValue, a value of nonzero configures the channel as output.
Returns
int: 0 on success, -1 in case of failure.

Definition at line 38 of file dio.c.

int flink_dio_set_value ( flink_subdev subdev,
uint32_t  channel,
uint8_t  value 
)

Sets a output channel to a value.

Parameters
subdevSubdevice containing the channel.
channelChannel number.
outputA value of nonzero sets the channel.
Returns
int: 0 on success, -1 in case of failure.

Definition at line 64 of file dio.c.