21#ifndef DETERMINISTICESPASYNCWEBSERVER_LDC1614_H
22#define DETERMINISTICESPASYNCWEBSERVER_LDC1614_H
28#define LDC1614_REG_DATA_CH0_MSB 0x00
29#define LDC1614_REG_DATA_CH0_LSB 0x01
30#define LDC1614_REG_RCOUNT_CH0 0x08
31#define LDC1614_REG_SETTLECOUNT_CH0 0x10
32#define LDC1614_REG_CLOCK_DIVIDERS_CH0 0x14
33#define LDC1614_REG_STATUS 0x18
34#define LDC1614_REG_ERROR_CONFIG 0x19
35#define LDC1614_REG_CONFIG 0x1A
36#define LDC1614_REG_MUX_CONFIG 0x1B
37#define LDC1614_REG_DRIVE_CURRENT_CH0 0x1E
38#define LDC1614_REG_MANUFACTURER_ID 0x7E
39#define LDC1614_REG_DEVICE_ID 0x7F
41#define LDC1614_MANUFACTURER_ID 0x5449
42#define LDC1614_DEVICE_ID 0x3055
45#define LDC1614_CONFIG_MAX 21
size_t ldc1614_build_config(uint8_t *buf, size_t cap, uint16_t rcount, uint16_t settlecount)
Emit a single-channel (CH0) continuous-conversion bring-up as (reg, val_msb, val_lsb) triples.
uint64_t ldc1614_sensor_freq_hz(uint32_t data28, uint32_t fref_hz)
Sensor frequency in Hz for a 28-bit result against a reference clock: data / 2^28 * fref.
bool ldc1614_begin(uint8_t addr, uint16_t rcount, uint16_t settlecount)
Verify the device id and apply the CH0 config at addr.
bool ldc1614_read_ch0(uint32_t *out)
Read channel 0's 28-bit conversion result into out.
uint8_t ldc1614_error(uint16_t msb_reg)
The 4 error flags from the top of a DATA MSB register (bits 15:12).
uint32_t ldc1614_data(uint16_t msb_reg, uint16_t lsb_reg)
Combine a DATA MSB register (low 12 bits) and DATA LSB register into the 28-bit result.