Skip to content

ad7768 librairy

Arnaud Mercier edited this page Mar 25, 2022 · 1 revision

Homemade librairy to configure ad7768 with arduino SPI

This librairy is adapted from the original ad7768 librairy from Analog device ad7768. It implements the same logic but adapted with he arduino SPI function.

All functions are based on a ad7768_chip object:

typedef struct {
    ad7768_chip_select_pin chipSelectPin = 10; //teensy 4.0 CS pin
    ad7768_power_mode	power_mode;
    ad7768_mclk_div		mclk_div;
    ad7768_dclk_div		dclk_div;
    ad7768_dec_rate		dec_rate;
    ad7768_filt_type	filt_type;
} ad7768_chip;

This object contains a list parameters of a type enum. This makes it easier and cleaner when configuring a new chip. For exemple, in the declaration of a new chip, one can decide to set the power mode to only theses values:

typedef enum {
    AD7768_ECO = 0,
    AD7768_MEDIAN = 2,
    AD7768_FAST = 3,
} ad7768_power_mode;

Some functions have a mask input parameter. This allows to write in only a specific part of a registry without changing the allready in place values. The function print_config has a steram input parameter. This allows to print the configurations in a specific Serial port.

A list of the registrey address is define in the .h file. Thoses are taken from the datasheet. This librairy is dependant on the arduino SPI librairy and Stream librairy only.

Clone this wiki locally