firmware
IEM Firmware Documentation
Loading...
Searching...
No Matches
isoADC.c File Reference

Driver for AMC131M03-Q1. More...

#include "isoADC.h"
Include dependency graph for isoADC.c:

Macros

#define ADC_BITS   24
#define ADC_SCALER   (1 << ADC_BITS)
#define VBUS_RESISTANCE   4000000
#define VBUS_SENSE_RESISTANCE   1000
#define MASK_TO_INT(x)
#define ISO_ADC_ID   0x23
#define ADC_RANGE   2.4
#define WORD_PER_XMISSION   5
#define WORD_SIZE   3
#define XMISSION_SIZE   (WORD_PER_XMISSION * WORD_SIZE)
#define REG_SIZE   2
#define SPI_WAIT_TIME   2

Functions

uint8_t wakeup_isoADC (isoADCConfig_t const *cfg_ptr, isoADCData_t *data_ptr)
uint8_t read_isoADC_register (isoADCRegisterAddr_e address, uint8_t *response_buffer)
uint8_t write_isoADC_register (isoADCRegisterAddr_e address, uint8_t *response_buffer, uint8_t const *write_bits)
uint8_t read_isoADC_ID (void)
uint8_t read_isoADC_ADCs (isoADCConfig_t const *cfg_ptr, isoADCData_t *data_ptr)
uint8_t read_isoADC_status (isoADCData_t *data_ptr)
uint16_t calculate_crc (uint8_t *data, uint8_t length)
uint8_t write_isoADC_reg_with_crc (isoADCRegisterAddr_e address, uint8_t *response_buffer, uint8_t const *write_bits)
bool convert_raw_to_actual (isoADCConfig_t *config, isoADCData_t *data_ptr)
uint8_t read_isoADC_reg_with_crc (isoADCRegisterAddr_e address, uint8_t *response_buffer)

Variables

isoADCConfig_t gIsoADCConfig
isoADCData_t gIsoADCData

Detailed Description

Driver for AMC131M03-Q1.

Author
cjlam2
Note
the way this chip works, after every command, the 3 channels of ADC readings will be spit onto the MISO line (5 words total per command).

Macro Definition Documentation

◆ ADC_BITS

#define ADC_BITS   24

◆ ADC_RANGE

#define ADC_RANGE   2.4

◆ ADC_SCALER

#define ADC_SCALER   (1 << ADC_BITS)

◆ ISO_ADC_ID

#define ISO_ADC_ID   0x23

◆ MASK_TO_INT

#define MASK_TO_INT ( x)
Value:
(1 << (x))

◆ REG_SIZE

#define REG_SIZE   2

◆ SPI_WAIT_TIME

#define SPI_WAIT_TIME   2

◆ VBUS_RESISTANCE

#define VBUS_RESISTANCE   4000000

◆ VBUS_SENSE_RESISTANCE

#define VBUS_SENSE_RESISTANCE   1000

◆ WORD_PER_XMISSION

#define WORD_PER_XMISSION   5

◆ WORD_SIZE

#define WORD_SIZE   3

◆ XMISSION_SIZE

#define XMISSION_SIZE   (WORD_PER_XMISSION * WORD_SIZE)

Function Documentation

◆ calculate_crc()

uint16_t calculate_crc ( uint8_t * data,
uint8_t length )
Here is the caller graph for this function:

◆ convert_raw_to_actual()

bool convert_raw_to_actual ( isoADCConfig_t * config,
isoADCData_t * data_ptr )
Here is the caller graph for this function:

◆ read_isoADC_ADCs()

uint8_t read_isoADC_ADCs ( isoADCConfig_t const * cfg_ptr,
isoADCData_t * data_ptr )
Here is the caller graph for this function:

◆ read_isoADC_ID()

uint8_t read_isoADC_ID ( void )
Here is the call graph for this function:

◆ read_isoADC_reg_with_crc()

uint8_t read_isoADC_reg_with_crc ( isoADCRegisterAddr_e address,
uint8_t * response_buffer )
Here is the call graph for this function:

◆ read_isoADC_register()

uint8_t read_isoADC_register ( isoADCRegisterAddr_e address,
uint8_t * response_buffer )
Here is the caller graph for this function:

◆ read_isoADC_status()

uint8_t read_isoADC_status ( isoADCData_t * data_ptr)
Here is the call graph for this function:

◆ wakeup_isoADC()

uint8_t wakeup_isoADC ( isoADCConfig_t const * cfg_ptr,
isoADCData_t * data_ptr )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_isoADC_reg_with_crc()

uint8_t write_isoADC_reg_with_crc ( isoADCRegisterAddr_e address,
uint8_t * response_buffer,
uint8_t const * write_bits )
Here is the call graph for this function:

◆ write_isoADC_register()

uint8_t write_isoADC_register ( isoADCRegisterAddr_e address,
uint8_t * response_buffer,
uint8_t const * write_bits )
Here is the caller graph for this function:

Variable Documentation

◆ gIsoADCConfig

isoADCConfig_t gIsoADCConfig

◆ gIsoADCData

isoADCData_t gIsoADCData
Initial value:
= {
.raw_shunt_voltage = 0,
.raw_scaled_bus_voltage = 0,
.raw_thermistor_voltage = 0,
.shunt_temp = 0,
.adjusted_shunt_voltage = 0,
.reset = true,
.fuse_fail = true,
.sec_fail = true,
.abort_fault = true,
}