|
AFE_NXP_Arduino 2.0.5
Analog Front-End (AFE) device operation sample code for Arduino
|
#include <NAFE33352.h>
Classes | |
| class | DAC |
| class | LogicalChannel |
Public Attributes | |
| LogicalChannel | logical_channel [16] |
| DAC | dac |
Static Public Attributes | |
| static constexpr double | on_board_shunt_resister = 50.00 |
| static constexpr double | pga_gain [] = { 1.00, 16.00 } |
Static Public Attributes inherited from AFE_base | |
| static AFE_base * | instance = nullptr |
Private Member Functions | |
| virtual void | txrx (uint8_t *data, int size, int cs_delay=0) |
| virtual void | write_r24 (uint16_t reg, uint32_t val) |
| double | calc_delay (int ch) |
| void | channel_info_update (uint16_t value) |
Additional Inherited Members | |
Protected Member Functions inherited from AFE_base | |
| int | bit_count (uint32_t value) |
| void | default_drdy_cb () |
| virtual void | init (void) |
| int | wait_conversion_complete (double delay=-1.0) |
Protected Member Functions inherited from SPI_for_AFE | |
| void | init (void) |
Static Protected Member Functions inherited from AFE_base | |
| static void | static_default_drdy_cb () |
| static void | DRDY_cb () |
Protected Attributes inherited from AFE_base | |
| bool | dev_add |
| bool | highspeed_variant |
| int | pin_nINT |
| int | pin_DRDY |
| int | pin_SYN |
| int | pin_nRESET |
| int | pin_DRDY_input |
| int | pin_SYNCDAC |
| int | enabled_channels |
| uint8_t | sequence_order [16] |
| double | coeff_V [16] |
| int | mux_setting [16] |
| double | ch_delay [16] |
| double | total_delay |
| uint32_t | drdy_count |
| volatile bool | drdy_flag |
Protected Attributes inherited from SPI_for_AFE | |
| uint32_t | frequency |
Static Protected Attributes inherited from AFE_base | |
| static double | delay_accuracy = 1.1 |
| static constexpr uint32_t | timeout_limit = 10000000 |
| static callback_fp_t | cbf_DRDY = nullptr |
NXP Analog Front End class library for Arduino
Copyright: 2026 Tedd OKANO Released under the MIT license
Definition at line 16 of file NAFE33352.h.
Definition at line 19 of file NAFE33352.h.
Definition at line 390 of file NAFE33352.h.
| Enumerator | |
|---|---|
| G_PGA_x_1_0 | |
| G_PGA_x16_0 | |
Definition at line 284 of file NAFE33352.h.
| Enumerator | |
|---|---|
| VCM_VCM | |
| AIP_AIN | |
| AIP_VSNS | |
| GPIO0_GPIO1 | |
| AIP | |
| AIN | |
| ISNS | |
| VSNS | |
| TIA | |
| GPIO0_VCM | |
| VCM_GPIO1 | |
| REF_BYP__VCM | |
| VCM__REF_BYP | |
| BG | |
| VADD | |
| LDO | |
| VHDD | |
| VHSS | |
| DAC_REF | |
Definition at line 262 of file NAFE33352.h.
|
strong |
Definition at line 289 of file NAFE33352.h.
|
strong |
Definition at line 330 of file NAFE33352.h.
| NAFE33352_Base::NAFE33352_Base | ( | bool | spi_addr, |
| bool | highspeed_variant, | ||
| int | nINT, | ||
| int | DRDY, | ||
| int | SYN, | ||
| int | nRESET, | ||
| int | DRDY_input, | ||
| int | SYNCDAC | ||
| ) |
Constructor to create a NAFE33352_Base instance
Definition at line 115 of file NAFE33352.cpp.
|
virtual |
Destructor
Definition at line 127 of file NAFE33352.cpp.
Register bit operation
overwrite bits in a register
| rg | register specified by Register16 or Register24 member |
| mask | mask bits |
| value | value to overwrite |
Definition at line 472 of file NAFE33352.h.
Referenced by close_logical_channel(), DRDY_by_sequencer_done(), and enable_logical_channel().
Set system-level config registers
Implements AFE_base.
Definition at line 150 of file NAFE33352.cpp.
Definition at line 304 of file NAFE33352.cpp.
Referenced by open_logical_channel().
Definition at line 279 of file NAFE33352.cpp.
Referenced by close_logical_channel(), close_logical_channel(), and enable_logical_channel().
Logical channel disable
| ch | logical channel number (0 ~ 15) |
Implements AFE_base.
Definition at line 376 of file NAFE33352.cpp.
Command
| com | "Command" type or uint16_t value |
Definition at line 448 of file NAFE33352.cpp.
Referenced by boot(), calc_delay(), open_logical_channel(), reset(), start(), start(), and start_continuous_conversion().
Write a value to the DAC output register
| vi | output value in Volt or Ampere |
| full_scale | full-scale range (e.g. 10.0 for +/-10 V) |
| bit_length | DAC resolution in bits |
Definition at line 431 of file NAFE33352.cpp.
DRDY event select
| flag | true for DRDY by sequencer is done |
Implements AFE_base.
Definition at line 406 of file NAFE33352.cpp.
Referenced by boot().
Logical channel enable
| ch | logical channel number (0 ~ 15) |
Implements AFE_base.
Definition at line 368 of file NAFE33352.cpp.
Referenced by open_logical_channel().
Configure and enable the DAC output channel
| cc | array for AIO_CONFIG, AO_CAL_COEF, AIO_PROT_CFG, AO_SLR_CTRL, AWG_PER and AO_SYSCFG register values |
Definition at line 190 of file NAFE33352.cpp.
Configure logical channel
| ch | logical channel number (0 ~ 15) |
| cc | array for AI_CONFIG0, AI_CONFIG1, AI_CONFIG2 and dummy values |
Implements AFE_base.
Definition at line 197 of file NAFE33352.cpp.
|
virtual |
Configure logical channel
| ch | logical channel number (0 ~ 15) |
| cc0 | 16bit value to be set AI_CONFIG0 register (0x20) |
| cc1 | 16bit value to be set AI_CONFIG1 register (0x21) |
| cc2 | 16bit value to be set AI_CONFIG2 register (0x22) |
| dummy | dummy variable to keep compatibility over AFE devices |
Implements AFE_base.
Definition at line 361 of file NAFE33352.cpp.
Referenced by open_logical_channel().
Convert raw output to volt
| ch | logical channel number to select its gain coefficient |
| value | ADC read value |
Implements AFE_base.
Definition at line 233 of file NAFE33352.h.
|
virtual |
Read ADC for single channel
| ch | logical channel number (0 ~ 15) |
Implements AFE_base.
Definition at line 411 of file NAFE33352.cpp.
Referenced by bit_op(), boot(), calc_delay(), channel_info_update(), close_logical_channel(), command(), NAFE33352_Base::LogicalChannel::configure(), NAFE33352_Base::DAC::configure(), NAFE33352_Base::DAC::configure(), NAFE33352_Base::DAC::configure(), NAFE33352_Base::DAC::configure(), NAFE33352_Base::LogicalChannel::configure(), dac_code(), dac_out(), DRDY_by_sequencer_done(), enable_logical_channel(), NAFE33352_Base(), open_dac_output(), open_logical_channel(), open_logical_channel(), NAFE33352_Base::DAC::operator=(), NAFE33352_Base::DAC::output(), part_number(), raw2v(), read(), read(), read(), reg(), reg(), reg(), reg(), reset(), serial_number(), start(), temperature(), txrx(), and write_r24().
|
virtual |
Read ADC for all channel
| data_ptr | pointer to array to store ADC data |
Implements AFE_base.
Definition at line 416 of file NAFE33352.cpp.
|
virtual |
Read ADC for all channel
| data_ptr | pointer to array to store ADC data |
Implements AFE_base.
Definition at line 421 of file NAFE33352.cpp.
|
virtual |
Read register
Reads register. Register width is selected by reg type (Register16 or Register24)
| r | register specified by Register16 member |
Definition at line 463 of file NAFE33352.cpp.
|
virtual |
Write register
Writes register. Register width is selected by reg type (Register16 or Register24)
| r | register specified by Register16 member |
| value | data value to write |
Definition at line 453 of file NAFE33352.cpp.
Referenced by bit_op(), boot(), calc_delay(), close_logical_channel(), dac_out(), open_dac_output(), open_logical_channel(), part_number(), read(), reset(), revision_number(), serial_number(), temperature(), and write_r24().
|
virtual |
Read register
Reads register. Register width is selected by reg type (Register16 or Register24)
| r | register specified by Register24 member |
Definition at line 468 of file NAFE33352.cpp.
|
virtual |
Write register
Writes register. Register width is selected by reg type (Register16 or Register24)
| r | register specified by Register24 member |
| value | data value to write |
Definition at line 458 of file NAFE33352.cpp.
Read serial number
Definition at line 483 of file NAFE33352.cpp.
Referenced by serial_number().
Start ADC
| ch | logical channel number (0 ~ 15) |
Implements AFE_base.
Definition at line 390 of file NAFE33352.cpp.
Send data
| data | pointer to data buffer |
| size | data size |
| cs_delay | microseconds to hold CS asserted after transfer |
Definition at line 131 of file NAFE33352.cpp.
Referenced by write_r24().
Register write, 24 bit
| reg | register index |
| val | data value |
Reimplemented from SPI_for_AFE.
Definition at line 140 of file NAFE33352.cpp.
Referenced by reg().
| DAC NAFE33352_Base::dac |
Definition at line 160 of file NAFE33352.h.
Referenced by NAFE33352_Base().
| LogicalChannel NAFE33352_Base::logical_channel[16] |
16 LogicalChannel instance array
Definition at line 91 of file NAFE33352.h.
Referenced by NAFE33352_Base().
Definition at line 20 of file NAFE33352.h.
Referenced by raw2v().
Definition at line 260 of file NAFE33352.h.