|
AFE_NXP_Arduino 2.0.3
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 | |
| 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 |
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 MCX
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 355 of file NAFE33352.h.
| Enumerator | |
|---|---|
| G_PGA_x_1_0 | |
| G_PGA_x16_0 | |
Definition at line 249 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 227 of file NAFE33352.h.
|
strong |
Definition at line 254 of file NAFE33352.h.
|
strong |
Definition at line 295 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 |
Destractor
Definition at line 127 of file NAFE33352.cpp.
Register bit operation
overwrite bits i a register
| reg | register specified by Register16 or Register24 member |
| mask | mask bits |
| reg | value to over write |
Definition at line 435 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 131 of file NAFE33352.cpp.
Definition at line 285 of file NAFE33352.cpp.
Referenced by open_logical_channel().
Definition at line 260 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 357 of file NAFE33352.cpp.
Command
| com | "Comand" type or uint16_t value |
Definition at line 429 of file NAFE33352.cpp.
Referenced by boot(), calc_delay(), open_logical_channel(), reset(), start(), start(), and start_continuous_conversion().
Definition at line 417 of file NAFE33352.cpp.
Referenced by dac_out().
Definition at line 412 of file NAFE33352.cpp.
DRDY event select
| set | true for DRDY by sequencer is done |
Implements AFE_base.
Definition at line 387 of file NAFE33352.cpp.
Referenced by boot().
Logical channel enable
| ch | logical channel number (0 ~ 15) |
Implements AFE_base.
Definition at line 349 of file NAFE33352.cpp.
Referenced by open_logical_channel().
Definition at line 171 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 178 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 342 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 212 of file NAFE33352.h.
|
virtual |
Read ADC for single channel
| ch | logical channel number (0 ~ 15) |
Implements AFE_base.
Definition at line 392 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(), and temperature().
|
virtual |
Read ADC for all channel
| data_ptr | pointer to array to store ADC data |
Implements AFE_base.
Definition at line 397 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 402 of file NAFE33352.cpp.
|
virtual |
Read register
Reads register. Register width is selected by reg type (Register16 ot Register24)
| reg | register specified by Register16 member |
Definition at line 444 of file NAFE33352.cpp.
|
virtual |
Write register
Writes register. Register width is selected by reg type (Register16 ot Register24)
| reg | register specified by Register16 member |
Definition at line 434 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(), and temperature().
|
virtual |
Read register
Reads register. Register width is selected by reg type (Register16 ot Register24)
| reg | register specified by Register24 member |
Definition at line 449 of file NAFE33352.cpp.
|
virtual |
Write register
Writes register. Register width is selected by reg type (Register16 ot Register24)
| reg | register specified by Register24 member |
Definition at line 439 of file NAFE33352.cpp.
Read serial number
Definition at line 464 of file NAFE33352.cpp.
Referenced by serial_number().
Start ADC
| ch | logical channel number (0 ~ 15) |
Implements AFE_base.
Definition at line 371 of file NAFE33352.cpp.
| DAC NAFE33352_Base::dac |
Definition at line 143 of file NAFE33352.h.
Referenced by NAFE33352_Base().
| LogicalChannel NAFE33352_Base::logical_channel[16] |
16 LogicalChannel instance array
Definition at line 74 of file NAFE33352.h.
Referenced by NAFE33352_Base().
Definition at line 20 of file NAFE33352.h.
Referenced by raw2v().
Definition at line 225 of file NAFE33352.h.