|
AFE_NXP_Arduino 2.0.3
Analog Front-End (AFE) device operation sample code for Arduino
|
#include <AFE_NXP.h>
Classes | |
| struct | _ref_points |
| struct | _reference_point |
| class | LogicalChannel |
Public Attributes | |
| LogicalChannel | logical_channel [16] |
Static Public Attributes | |
| static double | pga_gain [] = { 0.2, 0.4, 0.8, 1, 2, 4, 8, 16 } |
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 |
|
strong |
|
strong |
| NAFE13388_Base::NAFE13388_Base | ( | bool | spi_addr, |
| bool | highspeed_variant, | ||
| int | nINT, | ||
| int | DRDY, | ||
| int | SYN, | ||
| int | nRESET, | ||
| int | DRDY_input, | ||
| int | SYNCDAC | ||
| ) |
Constructor to create a AFE_base instance
Definition at line 208 of file AFE_NXP.cpp.
|
virtual |
Destractor
Definition at line 218 of file AFE_NXP.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 660 of file AFE_NXP.h.
Referenced by close_logical_channel(), DRDY_by_sequencer_done(), and enable_logical_channel().
Blinks LEDs on GPIO pins
Definition at line 611 of file AFE_NXP.cpp.
Definition at line 307 of file AFE_NXP.cpp.
Referenced by open_logical_channel().
Definition at line 282 of file AFE_NXP.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 371 of file AFE_NXP.cpp.
All logical channel disable
Implements AFE_base.
Definition at line 379 of file AFE_NXP.cpp.
Referenced by self_calibrate().
Command
| com | "Comand" type or uint16_t value |
Definition at line 426 of file AFE_NXP.cpp.
Referenced by boot(), calc_delay(), open_logical_channel(), reset(), self_calibrate(), start(), start(), and start_continuous_conversion().
DRDY event select
| set | true for DRDY by sequencer is done |
Implements AFE_base.
Definition at line 401 of file AFE_NXP.cpp.
Referenced by boot().
Logical channel enable
| ch | logical channel number (0 ~ 15) |
Implements AFE_base.
Definition at line 363 of file AFE_NXP.cpp.
Referenced by open_logical_channel().
| void NAFE13388_Base::gain_offset_coeff | ( | const ref_points & | ref | ) |
Gain and offset coefficient customization
Sets gain and offset coefficients with given target ADC read-out values at two reference voltaeg points
| ref | struct to define the target coefficient index and two reference poins and reference pre-calibrated coeffs |
Definition at line 475 of file AFE_NXP.cpp.
Configure logical channel
| ch | logical channel number (0 ~ 15) |
| cc | array for CH_CONFIG0, CH_CONFIG1, CH_CONFIG2 and CH_CONFIG3 values |
Implements AFE_base.
Definition at line 259 of file AFE_NXP.cpp.
|
virtual |
Configure logical channel
| ch | logical channel number (0 ~ 15) |
| cc0 | 16bit value to be set CH_CONFIG0 register (0x20) |
| cc1 | 16bit value to be set CH_CONFIG1 register (0x21) |
| cc2 | 16bit value to be set CH_CONFIG2 register (0x22) |
| cc3 | 16bit value to be set CH_CONFIG3 register (0x23) |
Implements AFE_base.
Definition at line 357 of file AFE_NXP.cpp.
Referenced by open_logical_channel(), and self_calibrate().
Convert raw output to volt
| ch | logical channel number to select its gain coefficient |
| value | ADC read value |
Implements AFE_base.
Definition at line 410 of file AFE_NXP.h.
Referenced by read(), and self_calibrate().
|
virtual |
Read ADC for single channel
| ch | logical channel number (0 ~ 15) |
Implements AFE_base.
Definition at line 406 of file AFE_NXP.cpp.
Referenced by bit_op(), NAFE13388_UIM::blink_leds(), boot(), calc_delay(), channel_info_update(), close_logical_channel(), command(), NAFE13388_Base::LogicalChannel::configure(), NAFE13388_Base::LogicalChannel::configure(), DRDY_by_sequencer_done(), enable_logical_channel(), gain_offset_coeff(), NAFE13388_Base(), open_logical_channel(), open_logical_channel(), part_number(), raw2v(), read(), read(), read(), reg(), reg(), reg(), reg(), reset(), self_calibrate(), 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 411 of file AFE_NXP.cpp.
|
virtual |
Read ADC for all channel
| data_ptr | pointer to array to store ADC data |
Implements AFE_base.
Definition at line 416 of file AFE_NXP.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 441 of file AFE_NXP.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 431 of file AFE_NXP.cpp.
Referenced by bit_op(), NAFE13388_UIM::blink_leds(), calc_delay(), close_logical_channel(), gain_offset_coeff(), open_logical_channel(), part_number(), read(), reset(), revision_number(), self_calibrate(), 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 446 of file AFE_NXP.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 436 of file AFE_NXP.cpp.
| int NAFE13388_Base::self_calibrate | ( | int | pga_gain_index, |
| int | channel_selection = 15, |
||
| int | input_select = 0, |
||
| double | reference_source_voltage = 0, |
||
| bool | use_positive_side = true |
||
| ) |
On-board calibration with specified input and voltage
Updates coefficients at pga_gain_index
| pga_gain_index | PGA gain index to measure and update the coefficients |
| channel_selection | Logical channel number for calibration use |
| reference_source_voltage | Reference voltage. This is not required if internal reference is used |
| input_select | Physical input channel selection. It will use internal voltage reference if this value is 0 |
| use_positive_side | Physical input channel selection AnP or AnN |
Definition at line 507 of file AFE_NXP.cpp.
Read serial number
Definition at line 461 of file AFE_NXP.cpp.
Referenced by serial_number().
Start ADC
| ch | logical channel number (0 ~ 15) |
Implements AFE_base.
Definition at line 385 of file AFE_NXP.cpp.
| LogicalChannel NAFE13388_Base::logical_channel[16] |
Definition at line 344 of file AFE_NXP.h.
Referenced by NAFE13388_Base().
|
static |
Definition at line 670 of file AFE_NXP.h.
Referenced by open_logical_channel(), and self_calibrate().