AFE_NXP_Arduino 2.0.5 Analog Front-End (AFE) device operation sample code for Arduino

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes | List of all members
SPI_for_AFE Class Reference

`#include <SPI_for_AFE.h>`

Inheritance diagram for SPI_for_AFE:

## Public Member Functions
virtual void | txrx (uint8_t *data, int size)
virtual void | write_r16 (uint16_t reg)
virtual void | write_r16 (uint16_t reg, uint16_t val)
virtual uint16_t | read_r16 (uint16_t reg)
virtual void | write_r24 (uint16_t reg, uint32_t val)
virtual int32_t | read_r24 (uint16_t reg)
virtual void | burst (uint32_t *data, int length, int width=3)
virtual void | spi_frequency (uint32_t frequency=1000000)

## Protected Member Functions
void | init (void)

## Protected Attributes
uint32_t | frequency

## Private Member Functions
int32_t | get_data16 (uint8_t *vp)
int32_t | get_data24 (uint8_t *vp)

## Static Private Attributes
static constexpr int | command_length = 2

## Detailed Description

NXP Analog Front End class library for Arduino

Author
  Tedd OKANO

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

A SPI interface class for NXP Analog Front End: NAFE13388, NAFE33352

Definition at line 20 of file SPI_for_AFE.h.

## Member Function Documentation

## ◆ burst()

void SPI_for_AFE::burst | ( | uint32_t * | data,
|  | int | length,
|  | int | width = `3`
| ) |  |
| virtual

Burst read of consecutive channel results

Parameters

  data | pointer to buffer to store results
  length | number of words to read
  width | word width in bytes (default: 3 for 24-bit)

Definition at line 59 of file SPI_for_AFE.cpp.

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

## ◆ get_data16()

int32_t SPI_for_AFE::get_data16 | ( | uint8_t * | vp | ) |
| inline private

Definition at line 85 of file SPI_for_AFE.h.

Referenced by read_r16().

## ◆ get_data24()

int32_t SPI_for_AFE::get_data24 | ( | uint8_t * | vp | ) |
| inline private

Definition at line 90 of file SPI_for_AFE.h.

Referenced by burst(), and read_r24().

## ◆ init()

void SPI_for_AFE::init | ( | void |  | ) |
| protected

Initialize SPI peripheral and chip-select pin

Definition at line 78 of file SPI_for_AFE.cpp.

Referenced by AFE_base::begin().

## ◆ read_r16()

uint16_t SPI_for_AFE::read_r16 | ( | uint16_t | reg | ) |
| virtual

Register read, 16 bit

Parameters

  reg | register index

Returns
  data value

Definition at line 29 of file SPI_for_AFE.cpp.

Referenced by NAFE13388_Base::reg(), and NAFE33352_Base::reg().

## ◆ read_r24()

int32_t SPI_for_AFE::read_r24 | ( | uint16_t | reg | ) |
| virtual

Register read, 24 bit

Parameters

  reg | register index

Returns
  data value

Definition at line 48 of file SPI_for_AFE.cpp.

Referenced by NAFE13388_Base::reg(), and NAFE33352_Base::reg().

## ◆ spi_frequency()

void SPI_for_AFE::spi_frequency | ( | uint32_t | frequency = `1000000` | ) |
| virtual

Set SPI clock frequency

Parameters

  frequency | SPI clock in Hz (default: 1 MHz)

Definition at line 73 of file SPI_for_AFE.cpp.

Referenced by init().

## ◆ txrx()

void SPI_for_AFE::txrx | ( | uint8_t * | data,
|  | int | size
| ) |  |
| virtual

Send data

Parameters

  data | pointer to data buffer
  size | data size

Definition at line 3 of file SPI_for_AFE.cpp.

Referenced by burst(), read_r16(), read_r24(), write_r16(), write_r16(), and write_r24().

## ◆ write_r16() [1/2]

void SPI_for_AFE::write_r16 | ( | uint16_t | reg | ) |
| virtual

Command write (register address only, no data)

Parameters

  reg | register/command index

Definition at line 13 of file SPI_for_AFE.cpp.

Referenced by NAFE13388_Base::command(), NAFE33352_Base::command(), NAFE13388_Base::reg(), and NAFE33352_Base::reg().

## ◆ write_r16() [2/2]

void SPI_for_AFE::write_r16 | ( | uint16_t | reg,
|  | uint16_t | val
| ) |  |
| virtual

Register write, 16 bit

Parameters

  reg | register index
  val | data value

Definition at line 21 of file SPI_for_AFE.cpp.

## ◆ write_r24()

void SPI_for_AFE::write_r24 | ( | uint16_t | reg,
|  | uint32_t | val
| ) |  |
| virtual

Register write, 24 bit

Parameters

  reg | register index
  val | data value

Reimplemented in NAFE33352_Base.

Definition at line 40 of file SPI_for_AFE.cpp.

Referenced by NAFE13388_Base::reg().

## Member Data Documentation

## ◆ command_length

constexpr int SPI_for_AFE::command_length = 2
| static constexpr private

Definition at line 100 of file SPI_for_AFE.h.

Referenced by burst(), read_r16(), and read_r24().

## ◆ frequency

uint32_t SPI_for_AFE::frequency
| protected

Definition at line 81 of file SPI_for_AFE.h.

Referenced by spi_frequency(), txrx(), and NAFE33352_Base::txrx().

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

- SPI_for_AFE.h
- SPI_for_AFE.cpp