|
| enum | ERROR_CODES { STATUS_OK = 0
, INVALID_CHANNEL = 10
, INVALID_REGISTER = 20
, NULL_POINTER = 30
} |
|
| | 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.
|
|
void | activateExternalChipSelect () |
|
void | setCSControlCallback (std::function< void(bool)> callback) |
|
void | setCSPin (int csPin) |
|
|
| SPIChip (uint8_t csPin) |
|
void | selectChip () |
|
void | deselectChip () |
|
int | _csPin |
|
bool | useExternalChipSelect = false |
|
std::function< void(bool)> | csControl = nullptr |
◆ MAX22531()
| MAX22531::MAX22531 |
( |
uint8_t | csPin, |
|
|
uint8_t | intPin ) |
Constructs a MAX22531 object with specified chip select and interrupt pins.
- Parameters
-
| csPin | Chip select pin for SPI communication. |
| intPin | Interrupt pin (optional, set to -1 if unused). |
◆ begin()
Initializes the MAX22531 chip and confirms communication.
- Returns
- true if initialization and communication are successful, false otherwise.
◆ burstRead()
Performs a burst read of ADC channels and interrupt status from the MAX22531.
- Parameters
-
| filtered | If true, reads filtered ADC values; if false, reads unfiltered values. |
- Returns
- BurstResponse struct containing ADC and interrupt data.
◆ HWreset()
| uint8_t MAX22531::HWreset |
( |
| ) |
|
Performs a hardware reset of the MAX22531 via the CONTROL register.
- Returns
- STATUS_OK on success, error code otherwise.
◆ readAllChannels()
Reads all filtered ADC channels and interrupt status from the MAX22531.
- Returns
- BurstResponse struct containing ADC and interrupt data.
◆ 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
-
| channel | The ADC channel to read (0-3). |
| data | Pointer to store the read ADC value. Must not be null. |
| filtered | If 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.
◆ readRegister()
| uint16_t MAX22531::readRegister |
( |
uint8_t | address, |
|
|
uint16_t * | data = nullptr ) |
Reads a 16-bit value from a register on the MAX22531.
- Parameters
-
| address | Register address to read from. |
| data | Pointer 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.
◆ writeRegister()
| uint8_t MAX22531::writeRegister |
( |
uint8_t | address, |
|
|
uint16_t | data ) |
Writes a 16-bit value to a register on the MAX22531.
- Parameters
-
| address | Register address to write to. |
| data | 16-bit data to write. |
- Returns
- STATUS_OK on success, INVALID_REGISTER if address is invalid.
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