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

Implementation of EVAL_POWRMS example for demo project. More...

#include "example.h"
#include "powrms_gpios.h"
#include "powrms_utils.h"
#include "powrms_data_processing.h"
#include "m24512.h"
#include "subscreen_blank_screen.h"
#include "no_os_alloc.h"
#include "no_os_delay.h"
#include "no_os_uart.h"
#include "no_os_print_log.h"
#include "maxim_uart_stdio.h"
#include "max32662.h"
Include dependency graph for example.c:

Macros

#define SCREEN_UPDATE_PERIOD_MS   200
 

Functions

void my_flush_cb (lv_display_t *disp, const lv_area_t *area, uint8_t *color_p)
 
int display_task ()
 Initialize the display task.
 
int configure_adc ()
 Configure the ADC.
 
int configure_display ()
 Configure the display.
 
int configure_debug_uart (void)
 Initialize the debug UART and route stdio (printf / pr_*) to it.
 
int screen_while ()
 IIO post-step callback.
 
int example_main (void)
 Main function.
 

Variables

LV_ATTRIBUTE_MEM_ALIGN uint8_t display_buffer [SSD1306_HOR_REZ *SSD1306_VER_REZ/8+8]
 
bool show_menu = 1
 
bool enter_pressed = 0
 
enum display_entry_t display_entry = DISPLAY_ENTRY_SHOW
 Display descriptor 0 -> Startup Frequency Screen 1 -> Main Screen (ADC values) 2 -> Show Screen 3 -> Settings Screen.
 

Detailed Description

Implementation of EVAL_POWRMS example for demo project.

Author
Robert Budai (rober.nosp@m.t.bu.nosp@m.dai@a.nosp@m.nalo.nosp@m.g.com)

Copyright 2025(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ SCREEN_UPDATE_PERIOD_MS

#define SCREEN_UPDATE_PERIOD_MS   200

Function Documentation

◆ configure_adc()

int configure_adc ( )

Configure the ADC.

Returns
int

◆ configure_debug_uart()

int configure_debug_uart ( void )

Initialize the debug UART and route stdio (printf / pr_*) to it.

Uses the same UART that the IIO transport runs on (iio_demo_usb_ip) so that pr_info()/pr_debug()/pr_err() messages from the whole firmware appear on the host serial console.

Returns
int - 0 on success, negative error code on failure.

◆ configure_display()

int configure_display ( )

Configure the display.

Returns
int

◆ display_task()

int display_task ( )

Initialize the display task.

Returns
int

◆ example_main()

int example_main ( void )

Main function.

Basic example main execution.

Basic example main executiont.

Returns
int

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

UART init params

IIO application descriptor

IIO application initialization parameters

iio axi adc configurations.

iio axi dac configurations.

iio instance descriptor.

iio instance descriptor.

iio device instance descriptor.

UART init params

IIO application descriptor

IIO application initialization parameters

iio axi adc configurations.

iio axi dac configurations.

iio instance descriptor.

iio instance descriptor.

iio device instance descriptor.

Negative temperature

Positive temperature

Negative temperature

Positive temperature

Switch to APG mode

Switch to AWG mode

◆ my_flush_cb()

void my_flush_cb ( lv_display_t * disp,
const lv_area_t * area,
uint8_t * color_p )

◆ screen_while()

int screen_while ( )

IIO post-step callback.

Runs after every iio_step(). The heavy screen/ADC work is rate-limited to SCREEN_UPDATE_PERIOD_MS so it does not block the IIO transport on every poll. LVGL's tick is advanced with the real elapsed time rather than a fixed value.

Returns
int - always 0; a screen-side error must never tear down the IIO app.

Variable Documentation

◆ display_buffer

◆ display_entry

enum display_entry_t display_entry = DISPLAY_ENTRY_SHOW

Display descriptor 0 -> Startup Frequency Screen 1 -> Main Screen (ADC values) 2 -> Show Screen 3 -> Settings Screen.

◆ enter_pressed

bool enter_pressed = 0

◆ show_menu

bool show_menu = 1