mraa  0.4.5
Low Level Skeleton Library for Communication on GNU/Linux platforms
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Functions | Typedefs
aio.h File Reference
Include dependency graph for aio.h:

API Description

AIO is the anlog input & output interface to libmraa. It is used to read or set the voltage applied to an AIO pin.

#include "mraa/aio.h"
int main ()
{
uint16_t adc_value = 0;
adc_a0 = mraa_aio_init(0);
if (adc_a0 == NULL) {
return 1;
}
for(;;) {
adc_value = mraa_aio_read(adc_a0);
fprintf(stdout, "ADC A0 read %X - %d\n", adc_value, adc_value);
}
mraa_aio_close(adc_a0);
return MRAA_SUCCESS;
}

Go to the source code of this file.

Functions

mraa_aio_context mraa_aio_init (unsigned int pin)
 
uint16_t mraa_aio_read (mraa_aio_context dev)
 
mraa_result_t mraa_aio_close (mraa_aio_context dev)
 

Typedefs

typedef struct _aio * mraa_aio_context
 

Function Documentation

mraa_aio_context mraa_aio_init ( unsigned int  pin)

Initialise an Analog input device, connected to the specified pin

Parameters
pinChannel number to read ADC inputs
Returns
aio context or NULL

Here is the caller graph for this function:

uint16_t mraa_aio_read ( mraa_aio_context  dev)

Read the input voltage

Parameters
devThe AIO context
Returns
The current input voltage, normalised to a 16-bit value

Here is the caller graph for this function:

mraa_result_t mraa_aio_close ( mraa_aio_context  dev)

Close the analog input context, this will free the memory for the context

Parameters
devThe AIO context
Returns
Result of operation

Here is the caller graph for this function:

Typedef Documentation

typedef struct _aio* mraa_aio_context

Opaque pointer definition to the internal struct _aio. This context refers to one single AIO pin on the board.