6#ifndef MCP2221_ANALOG_H
7#define MCP2221_ANALOG_H
Core MCP2221 device and I2C master API.
struct mcp2221_device mcp2221_t
Opaque MCP2221 device handle.
mcp2221_error_code_t mcp2221_dac_write_normalized(mcp2221_t *dev, double normalized)
Write a normalized DAC output value.
mcp2221_error_code_t mcp2221_analog_set_vdd(mcp2221_t *dev, double volts)
Store the externally supplied MCP2221 supply voltage.
mcp2221_error_code_t mcp2221_dac_write_raw(mcp2221_t *dev, uint8_t code)
Write a raw 5-bit DAC output code.
mcp2221_error_code_t mcp2221_analog_get_vdd(const mcp2221_t *dev, double *volts)
Return the configured MCP2221 supply voltage.
mcp2221_error_code_t mcp2221_clock_config(mcp2221_t *dev, int duty_percent, const char *freq_str)
Configure the MCP2221 clock output.
mcp2221_error_code_t mcp2221_adc_read_volts(mcp2221_t *dev, double out[3])
Read the three ADC channels as voltages.
mcp2221_error_code_t mcp2221_dac_config(mcp2221_t *dev, const char *ref_str)
Configure the DAC voltage reference while preserving its output code.
mcp2221_error_code_t mcp2221_dac_write_volts(mcp2221_t *dev, double volts)
Write a DAC output voltage.
mcp2221_error_code_t mcp2221_adc_read_raw(mcp2221_t *dev, uint16_t out[3])
Read the three MCP2221 ADC channels as raw 10-bit values.
mcp2221_error_code_t mcp2221_adc_config(mcp2221_t *dev, const char *ref_str)
Configure the ADC voltage reference.
mcp2221_error_code_t mcp2221_ioc_config(mcp2221_t *dev, const char *edge)
Configure interrupt-on-change edge detection.
mcp2221_error_code_t mcp2221_adc_read_normalized(mcp2221_t *dev, double out[3])
Read the three ADC channels as normalized values.
mcp2221_error_code_t mcp2221_ioc_read(mcp2221_t *dev, uint8_t *flag)
Read the interrupt-on-change flag.
mcp2221_error_code_t mcp2221_ioc_clear(mcp2221_t *dev)
Clear the interrupt-on-change flag.
mcp2221_error_code_t mcp2221_dac_config_out(mcp2221_t *dev, const char *ref_str, int out_code)
Configure the DAC voltage reference and optionally its raw output code.
mcp2221_error_code_t
Error codes used by libeasymcp2221.
#define MCP2221_API
Export or import a public libeasymcp2221 API symbol.
#define MCP2221_END_DECLS
End a block started by MCP2221_BEGIN_DECLS.
#define MCP2221_BEGIN_DECLS
Begin a block of declarations using C linkage.