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

BJT Curve tracer example for AD5592R (NPN) and AD5593R (PNP). More...

#include "example.h"
#include "common_data.h"
#include "no_os_delay.h"
#include "no_os_print_log.h"
#include "no_os_uart.h"
#include "ad5592r.h"
#include "ad5593r.h"
#include "lm75.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for curvetrace_example.c:

Classes

struct  curve_trace_cfg
 

Macros

#define DEFINE_AD5592R_IP()
 
#define DEFINE_AD5593R_IP()
 
#define NUM_CURVES   5
 
#define NUM_POINTS   50
 
#define GRAPH_HEIGHT   20
 
#define GRAPH_WIDTH   60
 

Typedefs

typedef int32_t(* ad559xr_init_fn) (struct ad5592r_dev **, struct ad5592r_init_param *)
 
typedef int32_t(* ad559xr_remove_fn) (struct ad5592r_dev *)
 
typedef int32_t(* ad559xr_write_dac_fn) (struct ad5592r_dev *, uint8_t, uint16_t)
 
typedef int32_t(* ad559xr_read_adc_fn) (struct ad5592r_dev *, uint8_t, uint16_t *)
 

Functions

int ad5592r_curve_example (struct no_os_uart_desc *uart_desc)
 
int ad5593r_curve_example (struct no_os_uart_desc *uart_desc)
 
int lm75_example (struct no_os_uart_desc *uart_desc)
 
int curvetrace_example (void)
 
 example_main ("curvetrace_example")
 

Detailed Description

BJT Curve tracer example for AD5592R (NPN) and AD5593R (PNP).

Author
Sean Bono Macariola (SeanB.nosp@m.ono..nosp@m.Macar.nosp@m.iola.nosp@m.@anal.nosp@m.og.c.nosp@m.om)
Marc Paolo Sosa (MarcP.nosp@m.aolo.nosp@m..Sosa.nosp@m.@ana.nosp@m.log.c.nosp@m.om)

Copyright 2026(c) Analog Devices, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ DEFINE_AD5592R_IP

#define DEFINE_AD5592R_IP ( )
Value:
{ \
.int_ref = true, \
.spi_init = &ad5592r_spi_ip, \
.i2c_init = NULL, \
.ss_init = &ad5592r_spi_ss_ip, \
.channel_modes = { \
CH_MODE_DAC, /* channel 0 */ \
CH_MODE_ADC, /* channel 1 */ \
CH_MODE_DAC_AND_ADC, /* channel 2 */ \
CH_MODE_DAC, /* channel 3 For green LED */ \
CH_MODE_UNUSED, /* channel 4 */ \
CH_MODE_UNUSED, /* channel 5 */ \
CH_MODE_UNUSED, /* channel 6 */ \
CH_MODE_UNUSED, /* channel 7 */ \
}, \
.channel_offstate = { \
CH_OFFSTATE_OUT_TRISTATE, /* channel 0 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 1 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 2 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 3 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 4 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 5 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 6 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 7 */ \
}, \
.adc_range = ZERO_TO_VREF, \
.dac_range = ZERO_TO_VREF, \
.adc_buf = false, \
}
#define CH_MODE_ADC
Definition ad5592r-base.h:47
@ ZERO_TO_VREF
Definition ad5592r-base.h:121
#define CH_OFFSTATE_OUT_TRISTATE
Definition ad5592r-base.h:56
#define CH_MODE_DAC
Definition ad5592r-base.h:48
#define CH_MODE_UNUSED
Definition ad5592r-base.h:46
#define CH_MODE_DAC_AND_ADC
Definition ad5592r-base.h:49
struct no_os_spi_init_param ad5592r_spi_ip
Definition common_data.c:36
struct no_os_gpio_init_param ad5592r_spi_ss_ip
Definition common_data.c:47
#define NULL
Definition wrapper.h:64

◆ DEFINE_AD5593R_IP

#define DEFINE_AD5593R_IP ( )
Value:
{ \
.int_ref = true, \
.spi_init = NULL, \
.i2c_init = &ad5593r_i2c_ip, \
.ss_init = NULL, \
.channel_modes = { \
CH_MODE_DAC, /* channel 0 - Base drive */ \
CH_MODE_ADC, /* channel 1 - Collector sense */ \
CH_MODE_DAC_AND_ADC, /* channel 2 - Collector drive */ \
CH_MODE_DAC, /* channel 3 - Emitter drive (PNP needs high-side supply) */ \
CH_MODE_UNUSED, /* channel 4 */ \
CH_MODE_UNUSED, /* channel 5 */ \
CH_MODE_UNUSED, /* channel 6 */ \
CH_MODE_UNUSED, /* channel 7 */ \
}, \
.channel_offstate = { \
CH_OFFSTATE_OUT_TRISTATE, /* channel 0 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 1 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 2 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 3 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 4 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 5 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 6 */ \
CH_OFFSTATE_OUT_TRISTATE, /* channel 7 */ \
}, \
.adc_range = ZERO_TO_VREF, \
.dac_range = ZERO_TO_VREF, \
.adc_buf = false, \
}
struct no_os_i2c_init_param ad5593r_i2c_ip
Definition common_data.c:87

◆ GRAPH_HEIGHT

#define GRAPH_HEIGHT   20

◆ GRAPH_WIDTH

#define GRAPH_WIDTH   60

◆ NUM_CURVES

#define NUM_CURVES   5

◆ NUM_POINTS

#define NUM_POINTS   50

Typedef Documentation

◆ ad559xr_init_fn

typedef int32_t(* ad559xr_init_fn) (struct ad5592r_dev **, struct ad5592r_init_param *)

Function pointer types for AD559xR device operations

◆ ad559xr_read_adc_fn

typedef int32_t(* ad559xr_read_adc_fn) (struct ad5592r_dev *, uint8_t, uint16_t *)

◆ ad559xr_remove_fn

typedef int32_t(* ad559xr_remove_fn) (struct ad5592r_dev *)

◆ ad559xr_write_dac_fn

typedef int32_t(* ad559xr_write_dac_fn) (struct ad5592r_dev *, uint8_t, uint16_t)

Function Documentation

◆ ad5592r_curve_example()

int ad5592r_curve_example ( struct no_os_uart_desc * uart_desc)
Here is the caller graph for this function:

◆ ad5593r_curve_example()

int ad5593r_curve_example ( struct no_os_uart_desc * uart_desc)
Here is the caller graph for this function:

◆ curvetrace_example()

int curvetrace_example ( void )

◆ example_main()

example_main ( "curvetrace_example" )

◆ lm75_example()

int lm75_example ( struct no_os_uart_desc * uart_desc)
Here is the caller graph for this function: