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

Basic initialization example for ADIN1320. More...

#include "adin1320.h"
#include "common_data.h"
#include "mdio_spi.h"
#include "no_os_delay.h"
#include "no_os_print_log.h"
#include "no_os_util.h"
Include dependency graph for basic_init.c:

Functions

int example_main (void)
 Basic example main executiont.
 

Detailed Description

Basic initialization example for ADIN1320.

Author
John Roed Retuya (Johnr.nosp@m.oed..nosp@m.Retuy.nosp@m.a@an.nosp@m.alog..nosp@m.com)

Copyright 2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

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.

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