LCDDriver_NXP_Arduino 0.7.6
Analog Front-End (AFE) device operation sample code for Arduino
Loading...
Searching...
No Matches
AFE_base Class Referenceabstract

#include <AFE_NXP.h>

Inheritance diagram for AFE_base:
SPI_for_AFE NAFE13388_Base NAFE13388 NAFE13388_UIM

Public Types

using raw_t = int32_t
 
using microvolt_t = double
 

Public Member Functions

 AFE_base (int nINT, int DRDY, int SYN, int nRESET)
 
virtual ~AFE_base ()
 
virtual void begin (void)
 
virtual void boot (void)=0
 
virtual void reset (bool hardware_reset=false)=0
 
virtual void logical_ch_config (int ch, uint16_t cc0, uint16_t cc1, uint16_t cc2, uint16_t cc3)=0
 
virtual void logical_ch_config (int ch, const uint16_t(&cc)[4])=0
 
virtual void logical_ch_disable (int ch)=0
 
virtual int32_t adc_read (int ch)=0
 
template<class T>
read (int ch, float delay=default_delay)
 
virtual void start (int ch)=0
 
template<>
int32_t read (int ch, float delay)
 
template<>
double read (int ch, float delay)
 
- Public Member Functions inherited from SPI_for_AFE
void txrx (uint8_t *data, int size)
 
void write_r16 (uint16_t reg)
 
void write_r16 (uint16_t reg, uint16_t val)
 
uint16_t read_r16 (uint16_t reg)
 
void write_r24 (uint16_t reg, uint32_t val)
 
int32_t read_r24 (uint16_t reg)
 

Public Attributes

int enabled_channels
 
double coeff_uV [16]
 
double ch_delay [16]
 

Static Public Attributes

static constexpr float immidiate_read = -1.0
 
static constexpr float default_delay = INFINITY
 
static double delay_accuracy = 1.1
 

Protected Member Functions

int bit_count (uint32_t value)
 

Protected Attributes

int pin_nINT
 
int pin_DRDY
 
int pin_SYN
 
int pin_nRESET
 

Private Member Functions

void start_and_delay (int ch, float delay)
 

Detailed Description

NXP Analog Front End class library for Arduino

Copyright: 2023 - 2024 Tedd OKANO Released under the MIT license

A simple class library for NXP Analog Front End: NAFE13388 evaluation boards

Definition at line 17 of file AFE_NXP.h.

Member Typedef Documentation

◆ microvolt_t

using AFE_base::microvolt_t = double

Definition at line 23 of file AFE_NXP.h.

◆ raw_t

using AFE_base::raw_t = int32_t

ADC readout types

Definition at line 22 of file AFE_NXP.h.

Constructor & Destructor Documentation

◆ AFE_base()

AFE_base::AFE_base ( int nINT,
int DRDY,
int SYN,
int nRESET )

Constructor to create a AFE_base instance

Definition at line 16 of file AFE_NXP.cpp.

Referenced by NAFE13388_Base::NAFE13388_Base().

◆ ~AFE_base()

AFE_base::~AFE_base ( )
virtual

Destractor

Definition at line 31 of file AFE_NXP.cpp.

Member Function Documentation

◆ adc_read()

virtual int32_t AFE_base::adc_read ( int ch)
pure virtual

ADC channel read

Parameters
chlogical channel number (0 ~ 15)

Implemented in NAFE13388_Base.

Referenced by read().

◆ begin()

void AFE_base::begin ( void )
virtual

Begin the device operation

NAFE13388 initialization. It does following steps (1) Call reset() (2) Call boot()

Definition at line 35 of file AFE_NXP.cpp.

◆ bit_count()

int AFE_base::bit_count ( uint32_t value)
protected

◆ boot()

virtual void AFE_base::boot ( void )
pure virtual

Set system-level config registers

Implemented in NAFE13388_Base.

Referenced by begin().

◆ logical_ch_config() [1/2]

virtual void AFE_base::logical_ch_config ( int ch,
const uint16_t(&) cc[4] )
pure virtual

Configure logical channel

Parameters
chlogical channel number (0 ~ 15)
ccarray for CH_CONFIG0, CH_CONFIG1, CH_CONFIG2 and CH_CONFIG3 values

Implemented in NAFE13388_Base.

◆ logical_ch_config() [2/2]

virtual void AFE_base::logical_ch_config ( int ch,
uint16_t cc0,
uint16_t cc1,
uint16_t cc2,
uint16_t cc3 )
pure virtual

Configure logical channel

Parameters
chlogical channel number (0 ~ 15)
cc016bit value to be set CH_CONFIG0 register (0x20)
cc116bit value to be set CH_CONFIG1 register (0x21)
cc216bit value to be set CH_CONFIG2 register (0x22)
cc316bit value to be set CH_CONFIG3 register (0x23)

Implemented in NAFE13388_Base.

◆ logical_ch_disable()

virtual void AFE_base::logical_ch_disable ( int ch)
pure virtual

Logical channel disable

Parameters
chlogical channel number (0 ~ 15)

Implemented in NAFE13388_Base.

◆ read() [1/3]

template<>
int32_t AFE_base::read ( int ch,
float delay )

Definition at line 42 of file AFE_NXP.cpp.

◆ read() [2/3]

template<>
double AFE_base::read ( int ch,
float delay )

Definition at line 52 of file AFE_NXP.cpp.

◆ read() [3/3]

template<class T>
T AFE_base::read ( int ch,
float delay = default_delay )

Read ADC Performs ADC read. If the delay is not given, just the ADC register is read. If the delay is given, measurement is started in this method and read-out after delay. The delay between start and read-out is specified in seconds.

This method need to be called with return type as double value = read<NAFE13388::microvolt_t>( 0, 0.01 ); int32_t value = read<NAFE13388::raw_t>( 0, 0.01 );

Parameters
chlogical channel number (0 ~ 15)
delayADC result read-out delay after measurement start if given
Returns
ADC readout value

Referenced by read(), and NAFE13388_Base::recalibrate().

◆ reset()

virtual void AFE_base::reset ( bool hardware_reset = false)
pure virtual

Issue RESET command

Implemented in NAFE13388_Base.

Referenced by begin().

◆ start()

virtual void AFE_base::start ( int ch)
pure virtual

Start ADC

Parameters
chlogical channel number (0 ~ 15)

Implemented in NAFE13388_Base.

Referenced by start_and_delay().

◆ start_and_delay()

void AFE_base::start_and_delay ( int ch,
float delay )
private

Definition at line 57 of file AFE_NXP.cpp.

Referenced by read().

Member Data Documentation

◆ ch_delay

double AFE_base::ch_delay[16]

Channel delay

Definition at line 106 of file AFE_NXP.h.

Referenced by NAFE13388_Base::calc_delay(), NAFE13388_Base::logical_ch_config(), and read().

◆ coeff_uV

double AFE_base::coeff_uV[16]

Coefficient to convert from ADC read value to micro-volt

Definition at line 103 of file AFE_NXP.h.

Referenced by NAFE13388_Base::logical_ch_config(), and read().

◆ default_delay

float AFE_base::default_delay = INFINITY
staticconstexpr

Definition at line 25 of file AFE_NXP.h.

Referenced by read().

◆ delay_accuracy

double AFE_base::delay_accuracy = 1.1
static

NXP Analog Front End class library for MCX

Author
Tedd OKANO

Copyright: 2023 - 2025 Tedd OKANO Released under the MIT license

Definition at line 107 of file AFE_NXP.h.

Referenced by read().

◆ enabled_channels

int AFE_base::enabled_channels

Number of enabled logical channels

Definition at line 100 of file AFE_NXP.h.

Referenced by AFE_base(), NAFE13388_Base::logical_ch_config(), and NAFE13388_Base::logical_ch_disable().

◆ immidiate_read

float AFE_base::immidiate_read = -1.0
staticconstexpr

Definition at line 24 of file AFE_NXP.h.

◆ pin_DRDY

int AFE_base::pin_DRDY
protected

Definition at line 116 of file AFE_NXP.h.

Referenced by AFE_base().

◆ pin_nINT

int AFE_base::pin_nINT
protected

Definition at line 115 of file AFE_NXP.h.

Referenced by AFE_base().

◆ pin_nRESET

int AFE_base::pin_nRESET
protected

Definition at line 118 of file AFE_NXP.h.

Referenced by AFE_base(), and NAFE13388_Base::reset().

◆ pin_SYN

int AFE_base::pin_SYN
protected

Definition at line 117 of file AFE_NXP.h.

Referenced by AFE_base().


The documentation for this class was generated from the following files: