iio.c: run clang format on iio.c
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -120,8 +120,7 @@ mraa_iio_get_channel_data(mraa_iio_context dev)
|
|||||||
fd = open(buf, O_RDONLY);
|
fd = open(buf, O_RDONLY);
|
||||||
if (fd > 0) {
|
if (fd > 0) {
|
||||||
read(fd, readbuf, 31 * sizeof(char));
|
read(fd, readbuf, 31 * sizeof(char));
|
||||||
ret = sscanf(readbuf, "%ce:%c%u/%u>>%u", &shortbuf,
|
ret = sscanf(readbuf, "%ce:%c%u/%u>>%u", &shortbuf, &signchar, &chan->bits_used,
|
||||||
&signchar, &chan->bits_used,
|
|
||||||
&padint, &chan->shift);
|
&padint, &chan->shift);
|
||||||
chan->bytes = padint / 8;
|
chan->bytes = padint / 8;
|
||||||
if (curr_bytes % chan->bytes == 0) {
|
if (curr_bytes % chan->bytes == 0) {
|
||||||
@@ -324,15 +323,13 @@ mraa_iio_get_event_data(mraa_iio_context dev)
|
|||||||
return MRAA_SUCCESS;
|
return MRAA_SUCCESS;
|
||||||
mraa_iio_event* event;
|
mraa_iio_event* event;
|
||||||
dev->events = calloc(event_num, sizeof(mraa_iio_event));
|
dev->events = calloc(event_num, sizeof(mraa_iio_event));
|
||||||
if ( dev->events == NULL)
|
if (dev->events == NULL) {
|
||||||
{
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return MRAA_ERROR_UNSPECIFIED;
|
return MRAA_ERROR_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
rewinddir(dir);
|
rewinddir(dir);
|
||||||
event_num = 0;
|
event_num = 0;
|
||||||
while ((ent = readdir(dir)) != NULL)
|
while ((ent = readdir(dir)) != NULL) {
|
||||||
{
|
|
||||||
if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), "_en") == 0) {
|
if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), "_en") == 0) {
|
||||||
event = &dev->events[event_num];
|
event = &dev->events[event_num];
|
||||||
event->name = strdup(ent->d_name);
|
event->name = strdup(ent->d_name);
|
||||||
@@ -461,8 +458,7 @@ mraa_iio_event_setup_callback(mraa_iio_context dev, void (*fptr)(struct iio_even
|
|||||||
ret = ioctl(dev->fp, IIO_GET_EVENT_FD_IOCTL, &dev->fp_event);
|
ret = ioctl(dev->fp, IIO_GET_EVENT_FD_IOCTL, &dev->fp_event);
|
||||||
close(dev->fp);
|
close(dev->fp);
|
||||||
|
|
||||||
if (ret == -1 || dev->fp_event == -1)
|
if (ret == -1 || dev->fp_event == -1) {
|
||||||
{
|
|
||||||
return MRAA_ERROR_UNSPECIFIED;
|
return MRAA_ERROR_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,7 +469,14 @@ mraa_iio_event_setup_callback(mraa_iio_context dev, void (*fptr)(struct iio_even
|
|||||||
}
|
}
|
||||||
|
|
||||||
mraa_result_t
|
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_iio_event_extract_event(struct iio_event_data* event,
|
||||||
|
int* chan_type,
|
||||||
|
int* modifier,
|
||||||
|
int* type,
|
||||||
|
int* direction,
|
||||||
|
int* channel,
|
||||||
|
int* channel2,
|
||||||
|
int* different)
|
||||||
{
|
{
|
||||||
*chan_type = IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event->id);
|
*chan_type = IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event->id);
|
||||||
*modifier = IIO_EVENT_CODE_EXTRACT_MODIFIER(event->id);
|
*modifier = IIO_EVENT_CODE_EXTRACT_MODIFIER(event->id);
|
||||||
@@ -492,4 +495,3 @@ mraa_iio_stop(mraa_iio_context dev)
|
|||||||
return MRAA_SUCCESS;
|
return MRAA_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user