no-OS
Loading...
Searching...
No Matches
iio_trigger_example.c File Reference

Implementation of IIO trigger example for AD74413R project. More...

#include "common_data.h"
#include "iio_app.h"
#include "iio_ad74413r.h"
#include "no_os_util.h"
#include "parameters.h"
#include "iio_trigger.h"
Include dependency graph for iio_trigger_example.c:

Macros

#define DATA_BUFFER_SIZE   400
 
#define AD74413R_GPIO_TRIG_NAME   "ad74413r-dev0"
 

Functions

int example_main ()
 Basic example main executiont.
 

Variables

uint8_t iio_data_buffer [DATA_BUFFER_SIZE *8 *sizeof(uint32_t)]
 
struct iio_trigger ad74413r_iio_trig_desc
 
struct iio_hw_trig_init_param ad74413r_gpio_trig_ip
 
struct no_os_irq_init_param ad74413r_gpio_irq_ip
 
const struct iio_hw_trig_cb_info gpio_cb_info
 

Detailed Description

Implementation of IIO trigger example for AD74413R project.

Author
Ciprian Regus (cipri.nosp@m.an.r.nosp@m.egus@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2022(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ AD74413R_GPIO_TRIG_NAME

#define AD74413R_GPIO_TRIG_NAME   "ad74413r-dev0"

◆ DATA_BUFFER_SIZE

#define DATA_BUFFER_SIZE   400

Function Documentation

◆ example_main()

int example_main ( void )

Basic example main executiont.

Basic example main execution.

Returns
ret - Result of the example execution. If working correctly, will execute continuously the while(1) loop and will not return.

Basic example main executiont.

  • 50 ADC readings with delay.
  • Threshold event (non-blocking).
    Returns
    ret - Result of the example execution. If working correctly, will execute continuously the while(1) loop and will not return.
    Basic example main executiont.
Returns
ret - Result of the example execution. If working correctly, will execute print the sample data.

Basic example main executiont.

Returns
ret - Result of the example execution. If working correctly, will execute continuously the while(1) loop and will not return.

Basic example main executiont.

Returns
ret - 0 on success.

Basic example main executiont.

Returns
ret - Result of the example execution. If working correctly, will execute continuously function iio_app_run and will not return.

Basic example main executiont.

Returns
ret - Result of the example execution. If working correctly, will execute continuously the iio_app_run and will not return.

IIO descriptor and initialization parameter.

IIO app.

Declaring iio_devices structure

Initializing IIO app init param.

Initializing IIO app.

Running the IIO app (use iio_info or osc in terminal).

Set the threshold voltage to 5V

The comparator output will be available on the GPO_A pin

Set the DAC output on channel C to 5V

Measure input current on channel D

Variable Documentation

◆ ad74413r_gpio_irq_ip

struct no_os_irq_init_param ad74413r_gpio_irq_ip
Initial value:
= {
.irq_ctrl_id = GPIO_IRQ_ID,
.platform_ops = GPIO_IRQ_OPS,
.extra = GPIO_IRQ_EXTRA,
}
#define GPIO_IRQ_EXTRA
Definition parameters.h:56
#define GPIO_IRQ_OPS
Definition parameters.h:54
#define GPIO_IRQ_ID
Definition parameters.h:19

◆ ad74413r_gpio_trig_ip

struct iio_hw_trig_init_param ad74413r_gpio_trig_ip
Initial value:
= {
.irq_trig_lvl = NO_OS_IRQ_EDGE_RISING,
.cb_info = gpio_cb_info,
}
#define AD74413R_GPIO_TRIG_NAME
Definition iio_trigger_example.c:31
const struct iio_hw_trig_cb_info gpio_cb_info
Definition iio_trigger_example.c:45
#define AD74413R_GPIO_TRIG_IRQ_ID
Definition parameters.h:45
@ NO_OS_IRQ_EDGE_RISING
Definition no_os_irq.h:50

◆ ad74413r_iio_trig_desc

struct iio_trigger ad74413r_iio_trig_desc
Initial value:
= {
.is_synchronous = true,
.enable = iio_trig_enable,
.disable = iio_trig_disable
}
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition iio_trigger.c:79
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition iio_trigger.c:96

◆ gpio_cb_info

const struct iio_hw_trig_cb_info gpio_cb_info
Initial value:
= {
.event = NO_OS_EVT_GPIO,
.peripheral = NO_OS_GPIO_IRQ,
}
#define AD74413R_GPIO_CB_HANDLE
Definition parameters.h:46
@ NO_OS_EVT_GPIO
Definition no_os_irq.h:31
@ NO_OS_GPIO_IRQ
Definition no_os_irq.h:55

◆ iio_data_buffer

uint8_t iio_data_buffer[DATA_BUFFER_SIZE *8 *sizeof(uint32_t)]