mraa  1.7.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
 All Data Structures Namespaces Files Functions Typedefs Enumerations Enumerator Macros Pages
Data Structures | Functions | Typedefs
iio.h File Reference

API Description

An iio context represents an IIO device

iio_device0 = mraa_iio_init(0);
if (iio_device0 == NULL) {
return EXIT_FAILURE;
}
float iio_float;
int iio_int;
ret = mraa_iio_write_float(iio_device0, "in_accel_scale", 0.019163);
if (ret == MRAA_SUCCESS) {
fprintf(stdout, "IIO write success\n");
}
ret = mraa_iio_read_float(iio_device0, "in_accel_scale", &iio_float);
if (ret == MRAA_SUCCESS) {
fprintf(stdout, "IIO read %f\n", iio_float);
}
ret = mraa_iio_write_int(iio_device0, "scan_elements/in_accel_x_en", 1);
if (ret == MRAA_SUCCESS) {
fprintf(stdout, "IIO write success\n");
}
ret = mraa_iio_read_int(iio_device0, "scan_elements/in_accel_x_en", &iio_int);
if (ret == MRAA_SUCCESS) {
fprintf(stdout, "IIO read %d\n", iio_int);
}
if (mraa_iio_trigger_buffer(iio_device0, interrupt, NULL) == MRAA_SUCCESS) {
sleep(100);
return EXIT_SUCCESS;
}
/*
struct iio_event_data event;
iio_device6 = mraa_iio_init(6);
if (iio_device6 == NULL) {
return EXIT_FAILURE;
}
mraa_iio_write_int(iio_device6, "events/in_proximity2_thresh_either_en", 1);
// Blocking until event fired
if (mraa_iio_event_poll(iio_device6, &event) == MRAA_SUCCESS) {
event_interrupt(&event); //just to show data
}
if (mraa_iio_event_setup_callback(iio_device6, event_interrupt, NULL) == MRAA_SUCCESS) {
sleep(100);
return EXIT_SUCCESS;
}*/

Go to the source code of this file.

Data Structures

struct  mraa_iio_channel
 
struct  mraa_iio_event
 

Functions

mraa_iio_context mraa_iio_init (int device)
 
mraa_result_t mraa_iio_trigger_buffer (mraa_iio_context dev, void(*fptr)(char *data), void *args)
 
const char * mraa_iio_get_device_name (mraa_iio_context dev)
 
int mraa_iio_get_device_num_by_name (const char *name)
 
int mraa_iio_read_size (mraa_iio_context dev)
 
mraa_iio_channelmraa_iio_get_channels (mraa_iio_context dev)
 
int mraa_iio_get_channel_count (mraa_iio_context dev)
 
mraa_result_t mraa_iio_read_float (mraa_iio_context dev, const char *filename, float *data)
 
mraa_result_t mraa_iio_read_int (mraa_iio_context dev, const char *filename, int *data)
 
mraa_result_t mraa_iio_read_string (mraa_iio_context dev, const char *filename, char *data, int max_len)
 
mraa_result_t mraa_iio_write_float (mraa_iio_context dev, const char *attr_chan, const float data)
 
mraa_result_t mraa_iio_write_int (mraa_iio_context dev, const char *attr_chan, const int data)
 
mraa_result_t mraa_iio_write_string (mraa_iio_context dev, const char *attr_chan, const char *data)
 
mraa_result_t mraa_iio_get_channel_data (mraa_iio_context dev)
 
mraa_result_t mraa_iio_get_event_data (mraa_iio_context dev)
 
mraa_result_t mraa_iio_event_poll (mraa_iio_context dev, struct iio_event_data *data)
 
mraa_result_t mraa_iio_event_setup_callback (mraa_iio_context dev, void(*fptr)(struct iio_event_data *data, void *args), void *args)
 
mraa_result_t mraa_iio_event_extract_event (struct iio_event_data *event, int *chan_type, int *modifier, int *type, int *direction, int *channel, int *channel2, int *different)
 
mraa_result_t mraa_iio_get_mount_matrix (mraa_iio_context dev, const char *sysfs_name, float mm[9])
 
mraa_result_t mraa_iio_create_trigger (mraa_iio_context dev, const char *trigger)
 
mraa_result_t mraa_iio_update_channels (mraa_iio_context dev)
 
mraa_result_t mraa_iio_close (mraa_iio_context dev)
 

Typedefs

typedef struct _iio * mraa_iio_context
 

Function Documentation

mraa_iio_context mraa_iio_init ( int  device)

Initialise iio context

Parameters
busiio device to use
Returns
i2c context or NULL

Here is the caller graph for this function:

mraa_result_t mraa_iio_close ( mraa_iio_context  dev)

De-inits an mraa_iio_context device

Parameters
devThe iio context
Returns
Result of operation

Here is the caller graph for this function:

Typedef Documentation

typedef struct _iio* mraa_iio_context

Opaque pointer definition to the internal struct _iio

Include dependency graph for iio.h: