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

Source file for iio example. More...

#include "parameters.h"
#include "common.h"
#include "common_data.h"
#include "iio_admt4000.h"
#include "iio_admt_evb.h"
#include "iio_trigger.h"
#include "iio_app.h"
Include dependency graph for iio_trigger_example.c:

Macros

#define DATA_BUFFER_SIZE   200
 
#define ADMT4000_GPIO_TRIG_NAME   "admt4000-dev0"
 

Functions

int example_main ()
 Basic example main executiont.
 

Variables

uint8_t iio_data_buffer [DATA_BUFFER_SIZE *ADMT4000_NUM_CHANNELS *sizeof(uint16_t)]
 
struct no_os_irq_init_param admt4000_gpio_irq_ip
 
struct iio_hw_trig_init_param admt4000_gpio_trig_ip
 

Detailed Description

Source file for iio example.

Author
Kister Genesis Jimenez (kiste.nosp@m.r.ji.nosp@m.menez.nosp@m.@ana.nosp@m.log.c.nosp@m.om)

Copyright 2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ ADMT4000_GPIO_TRIG_NAME

#define ADMT4000_GPIO_TRIG_NAME   "admt4000-dev0"

◆ DATA_BUFFER_SIZE

#define DATA_BUFFER_SIZE   200

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.

Basic example main executiont.

Returns
ret - Result of the example execution. If working correctly, will measure active and reactive energy and RMS for channel A and for voltage stopping whenever an interrupt occurs and resulting in a stoppage of the measurement.

Basic example main executiont.

Returns
ret - Result of the example execution.

Basic example main executiont.

This example demonstrates basic ADMT4000 functionality by continuously reading sensor values and displaying them on the console.

Returns
0 in case of success, negative error code otherwise.

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

GPIO Pin Interrupt Controller

Variable Documentation

◆ admt4000_gpio_irq_ip

struct no_os_irq_init_param admt4000_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

◆ admt4000_gpio_trig_ip

struct iio_hw_trig_init_param admt4000_gpio_trig_ip
Initial value:
= {
.irq_trig_lvl = NO_OS_IRQ_EDGE_FALLING,
.cb_info = {
.event = NO_OS_EVT_GPIO,
.peripheral = NO_OS_GPIO_IRQ,
},
}
#define ADMT4000_GPIO_TRIG_NAME
Definition iio_trigger_example.c:27
#define ADMT4000_GPIO_CB_HANDLE
Definition parameters.h:84
#define ADMT4000_GPIO_TRIG_IRQ_ID
Definition parameters.h:85
@ NO_OS_IRQ_EDGE_FALLING
Definition no_os_irq.h:49
@ 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 *ADMT4000_NUM_CHANNELS *sizeof( uint16_t)]