libeasymcp2221 2.0.3
mcp2221_analog.h
Go to the documentation of this file.
1
6#ifndef MCP2221_ANALOG_H
7#define MCP2221_ANALOG_H
8
9#include <stdint.h>
10
11#include "mcp2221.h"
12
14
31 mcp2221_t *dev,
32 double volts);
33
46 const mcp2221_t *dev,
47 double *volts);
48
63
80
98 mcp2221_t *dev,
99 double out[3]);
100
120 mcp2221_t *dev,
121 double out[3]);
122
139
162MCP2221_API mcp2221_error_code_t mcp2221_dac_config_out(mcp2221_t *dev, const char *ref_str, int out_code);
163
176
192 mcp2221_t *dev,
193 double normalized);
194
214 mcp2221_t *dev,
215 double volts);
216
232MCP2221_API mcp2221_error_code_t mcp2221_clock_config(mcp2221_t *dev, int duty_percent, const char *freq_str);
233
245
255
270
272#endif // MCP2221_ANALOG_H
Core MCP2221 device and I2C master API.
struct mcp2221_device mcp2221_t
Opaque MCP2221 device handle.
Definition: mcp2221.h:28
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.