CANTram Framework 1.0.1
Dieses Framework ermöglicht die Nutzung der CANTram Hardware, einer Mikrocontroller basierten mdoularen Steuerung.
Loading...
Searching...
No Matches
MAX22531 Class Reference
Inheritance diagram for MAX22531:
Collaboration diagram for MAX22531:

Classes

struct  BurstResponse

Public Types

enum  ERROR_CODES { STATUS_OK = 0 , INVALID_CHANNEL = 10 , INVALID_REGISTER = 20 , NULL_POINTER = 30 }

Public Member Functions

 MAX22531 (uint8_t csPin, uint8_t intPin)
 Constructs a MAX22531 object with specified chip select and interrupt pins.
bool begin ()
 Initializes the MAX22531 chip and confirms communication.
uint8_t writeRegister (uint8_t address, uint16_t data)
 Writes a 16-bit value to a register on the MAX22531.
uint16_t readRegister (uint8_t address, uint16_t *data=nullptr)
 Reads a 16-bit value from a register on the MAX22531.
BurstResponse burstRead (bool filtered=true)
 Performs a burst read of ADC channels and interrupt status from the MAX22531.
uint16_t readChannel (uint8_t channel, uint16_t *data=nullptr, bool filtered=true)
 Reads a specific ADC channel from the MAX22531 and returns the 12-bit ADC value.
BurstResponse readAllChannels ()
 Reads all filtered ADC channels and interrupt status from the MAX22531.
uint8_t HWreset ()
 Performs a hardware reset of the MAX22531 via the CONTROL register.
Public Member Functions inherited from SPIChip
void activateExternalChipSelect ()
void setCSControlCallback (std::function< void(bool)> callback)
void setCSPin (int csPin)

Additional Inherited Members

Protected Member Functions inherited from SPIChip
 SPIChip (uint8_t csPin)
void selectChip ()
void deselectChip ()
Protected Attributes inherited from SPIChip
int _csPin
bool useExternalChipSelect = false
std::function< void(bool)> csControl = nullptr

Constructor & Destructor Documentation

◆ MAX22531()

MAX22531::MAX22531 ( uint8_t csPin,
uint8_t intPin )

Constructs a MAX22531 object with specified chip select and interrupt pins.

Parameters
csPinChip select pin for SPI communication.
intPinInterrupt pin (optional, set to -1 if unused).

Member Function Documentation

◆ begin()

bool MAX22531::begin ( )

Initializes the MAX22531 chip and confirms communication.

Returns
true if initialization and communication are successful, false otherwise.
Here is the call graph for this function:

◆ burstRead()

MAX22531::BurstResponse MAX22531::burstRead ( bool filtered = true)

Performs a burst read of ADC channels and interrupt status from the MAX22531.

Parameters
filteredIf true, reads filtered ADC values; if false, reads unfiltered values.
Returns
BurstResponse struct containing ADC and interrupt data.
Here is the caller graph for this function:

◆ HWreset()

uint8_t MAX22531::HWreset ( )

Performs a hardware reset of the MAX22531 via the CONTROL register.

Returns
STATUS_OK on success, error code otherwise.
Here is the call graph for this function:

◆ readAllChannels()

MAX22531::BurstResponse MAX22531::readAllChannels ( )

Reads all filtered ADC channels and interrupt status from the MAX22531.

Returns
BurstResponse struct containing ADC and interrupt data.
Here is the call graph for this function:

◆ readChannel()

uint16_t MAX22531::readChannel ( uint8_t channel,
uint16_t * data = nullptr,
bool filtered = true )

Reads a specific ADC channel from the MAX22531 and returns the 12-bit ADC value.

Parameters
channelThe ADC channel to read (0-3).
dataPointer to store the read ADC value. Must not be null.
filteredIf true, reads from the filtered ADC register; if false, reads from the unfiltered ADC register.
Returns
STATUS_OK on success, INVALID_CHANNEL if the channel is out of range, NULL_POINTER if data is null.
Here is the call graph for this function:

◆ readRegister()

uint16_t MAX22531::readRegister ( uint8_t address,
uint16_t * data = nullptr )

Reads a 16-bit value from a register on the MAX22531.

Parameters
addressRegister address to read from.
dataPointer to store the read 16-bit value. Must not be null.
Returns
STATUS_OK on success, INVALID_REGISTER if address is invalid, NULL_POINTER if data is null.
Here is the caller graph for this function:

◆ writeRegister()

uint8_t MAX22531::writeRegister ( uint8_t address,
uint16_t data )

Writes a 16-bit value to a register on the MAX22531.

Parameters
addressRegister address to write to.
data16-bit data to write.
Returns
STATUS_OK on success, INVALID_REGISTER if address is invalid.
Here is the caller graph for this function:

The documentation for this class was generated from the following files:
  • C:/Users/leowa/Documents/PlatformIO/Projects/CANTramFrameworkUsage/lib/CANTramFramework/include/MAX22531.h
  • C:/Users/leowa/Documents/PlatformIO/Projects/CANTramFrameworkUsage/lib/CANTramFramework/src/chips/MAX22531/MAX22531.cpp