79 uint16_t timer_count = 0;
83 if (
input(MISO) == 0)
break;
84 if (timer_count++>miso_timeout)
122 adc_code -= 0x00200000;
130 *LTC2422_lsb = LTC2422_reference_voltage/(1048575);
LTC2422: 1-/2-Channel 20-Bit uPower No Latency Delta-Sigma ADC in MSOP-10.
uint8_t LT_byte[4]
4 bytes (unsigned 8-bit integers) to be converted to a 32-bit signed or unsigned integer ...
float LTC2422_code_to_voltage(int32_t adc_code, float LTC2422_lsb)
Calculates the voltage given the ADC code and lsb weight.
#define output_high(pin)
Set "pin" high.
Header File for Linduino Libraries and Demo Code.
void LTC2422_adc_read(uint8_t cs, uint8_t *adc_channel, int32_t *code)
Read ADC code from the LTC2422.
union LT_union_int32_4bytes data
#define output_low(pin)
Set "pin" low.
#define input(pin)
Return the state of pin "pin".
int32_t LT_int32
32-bit signed integer to be converted to four bytes
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
void LTC2422_calculate_lsb(float LTC2422_reference_voltage, float *LTC2422_lsb)
Calculates the lsb weight from the given reference voltage.
This union splits one int32_t (32-bit signed integer) or uint32_t (32-bit unsigned integer) four uint...
#define LTC2422_CS
Define the SPI CS pin.
void spi_transfer_block(uint8_t cs_pin, uint8_t *tx, uint8_t *rx, uint8_t length)
Reads and sends a byte array.
static float LTC2422_lsb
The LTC2422 least significant bit value with 5V full-scale.
uint8_t LTC2422_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
Checks for EOC with a specified timeout.