Soletta™ Framework
|
Analog I/O API for Soletta. More...
Typedefs | |
typedef struct sol_aio | sol_aio |
AIO handle structure. More... | |
typedef struct sol_aio_pending | sol_aio_pending |
AIO pending operation handle structure. More... | |
Functions | |
void | sol_aio_close (struct sol_aio *aio) |
Close the given AIO handle. More... | |
struct sol_aio_pending * | sol_aio_get_value (struct sol_aio *aio, void(*read_cb)(void *cb_data, struct sol_aio *aio, int32_t ret), const void *cb_data) |
Request an (asynchronous) read operation to take place on AIO handle aio. More... | |
struct sol_aio * | sol_aio_open (int device, int pin, unsigned int precision) |
Open the given Analog I/O pin on device to be used. More... | |
struct sol_aio * | sol_aio_open_by_label (const char *label, unsigned int precision) |
Open the given board pin by its label to be used as Analog I/O. More... | |
struct sol_aio * | sol_aio_open_raw (int device, int pin, unsigned int precision) |
Open the given Analog I/O pin on device to be used. More... | |
void | sol_aio_pending_cancel (struct sol_aio *aio, struct sol_aio_pending *pending) |
Cancel a pending operation. More... | |
Analog I/O API for Soletta.
AIO handle structure.
AIO pending operation handle structure.
void sol_aio_close | ( | struct sol_aio * | aio | ) |
Close the given AIO handle.
aio | AIO handle to be closed. |
struct sol_aio_pending* sol_aio_get_value | ( | struct sol_aio * | aio, |
void(*)(void *cb_data, struct sol_aio *aio, int32_t ret) | read_cb, | ||
const void * | cb_data | ||
) |
Request an (asynchronous) read operation to take place on AIO handle aio.
aio | A valid AIO handle for the desired 'device/pin' pair. |
read_cb | The callback to be issued when the operation finishes. The ret parameter will contain the given digital reading (non-negative value) on success or a negative error code, on failure. |
cb_data | The data pointer to be passed to read_cb. |
0
, otherwise NULL
. It's only valid before read_cb is called. It may be used before that to cancel the read operation. If NULL
is returned, the errno variable will be set with the correct error value. In case that the AIO device is in use, the errno variable is set to EBUSY. struct sol_aio* sol_aio_open | ( | int | device, |
int | pin, | ||
unsigned int | precision | ||
) |
Open the given Analog I/O pin
on device
to be used.
This function also applies any pin multiplexer rules needed if a multiplexer for the current board was previously loaded.
device | The AIO device number. |
pin | The AIO pin on device. |
precision | The number of valid bits on the data received from the analog to digital converter. Some simpler operating systems might have that hardcoded for analog-to-digital converters, in which case this value will be ignored. |
struct sol_aio* sol_aio_open_by_label | ( | const char * | label, |
unsigned int | precision | ||
) |
Open the given board pin
by its label to be used as Analog I/O.
This function only works when the board was successfully detected by Soletta and a corresponding pin multiplexer module was found.
This function also applies any pin multiplexer rules needed if a multiplexer for the current board was previously loaded.
label | Label of the pin on the board. |
precision | The number of valid bits on the data received from the analog to digital converter. Some simpler operating systems might have that hardcoded for analog-to-digital converters, in which case this value will be ignored. |
struct sol_aio* sol_aio_open_raw | ( | int | device, |
int | pin, | ||
unsigned int | precision | ||
) |
Open the given Analog I/O pin
on device
to be used.
precision
is used to filter the valid bits from the data received from hardware (which is manufacturer-dependent), therefore it should not be used as a way to change intended device's output range, because it will be applied to the least significant bits of the read data.
device | The AIO device number |
pin | The AIO pin on device |
precision | The number of valid bits on the data received from the analog to digital converter. |
void sol_aio_pending_cancel | ( | struct sol_aio * | aio, |
struct sol_aio_pending * | pending | ||
) |
Cancel a pending operation.
aio | the AIO handle |
pending | the operation handle |