Initial Commit

Committer:
EndaKilgarriff
Date:
Mon Jun 15 13:58:03 2020 +0000
Revision:
1:2ad195e1455b
AD5592R Initial Commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
EndaKilgarriff 1:2ad195e1455b 1 /***************************************************************************//**
EndaKilgarriff 1:2ad195e1455b 2 * @file ad5592r.h
EndaKilgarriff 1:2ad195e1455b 3 * @brief Header file of AD5592R driver.
EndaKilgarriff 1:2ad195e1455b 4 * @author Mircea Caprioru (mircea.caprioru@analog.com)
EndaKilgarriff 1:2ad195e1455b 5 ********************************************************************************
EndaKilgarriff 1:2ad195e1455b 6 * Copyright 2018, 2020(c) Analog Devices, Inc.
EndaKilgarriff 1:2ad195e1455b 7 *
EndaKilgarriff 1:2ad195e1455b 8 * All rights reserved.
EndaKilgarriff 1:2ad195e1455b 9 *
EndaKilgarriff 1:2ad195e1455b 10 * Redistribution and use in source and binary forms, with or without
EndaKilgarriff 1:2ad195e1455b 11 * modification, are permitted provided that the following conditions are met:
EndaKilgarriff 1:2ad195e1455b 12 * - Redistributions of source code must retain the above copyright
EndaKilgarriff 1:2ad195e1455b 13 * notice, this list of conditions and the following disclaimer.
EndaKilgarriff 1:2ad195e1455b 14 * - Redistributions in binary form must reproduce the above copyright
EndaKilgarriff 1:2ad195e1455b 15 * notice, this list of conditions and the following disclaimer in
EndaKilgarriff 1:2ad195e1455b 16 * the documentation and/or other materials provided with the
EndaKilgarriff 1:2ad195e1455b 17 * distribution.
EndaKilgarriff 1:2ad195e1455b 18 * - Neither the name of Analog Devices, Inc. nor the names of its
EndaKilgarriff 1:2ad195e1455b 19 * contributors may be used to endorse or promote products derived
EndaKilgarriff 1:2ad195e1455b 20 * from this software without specific prior written permission.
EndaKilgarriff 1:2ad195e1455b 21 * - The use of this software may or may not infringe the patent rights
EndaKilgarriff 1:2ad195e1455b 22 * of one or more patent holders. This license does not release you
EndaKilgarriff 1:2ad195e1455b 23 * from the requirement that you obtain separate licenses from these
EndaKilgarriff 1:2ad195e1455b 24 * patent holders to use this software.
EndaKilgarriff 1:2ad195e1455b 25 * - Use of the software either in source or binary form, must be run
EndaKilgarriff 1:2ad195e1455b 26 * on or directly connected to an Analog Devices Inc. component.
EndaKilgarriff 1:2ad195e1455b 27 *
EndaKilgarriff 1:2ad195e1455b 28 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
EndaKilgarriff 1:2ad195e1455b 29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
EndaKilgarriff 1:2ad195e1455b 30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
EndaKilgarriff 1:2ad195e1455b 31 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
EndaKilgarriff 1:2ad195e1455b 32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
EndaKilgarriff 1:2ad195e1455b 33 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
EndaKilgarriff 1:2ad195e1455b 34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
EndaKilgarriff 1:2ad195e1455b 35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
EndaKilgarriff 1:2ad195e1455b 36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
EndaKilgarriff 1:2ad195e1455b 37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
EndaKilgarriff 1:2ad195e1455b 38 *******************************************************************************/
EndaKilgarriff 1:2ad195e1455b 39 #ifndef AD5592R_H_
EndaKilgarriff 1:2ad195e1455b 40 #define AD5592R_H_
EndaKilgarriff 1:2ad195e1455b 41
EndaKilgarriff 1:2ad195e1455b 42 #include "stdint.h"
EndaKilgarriff 1:2ad195e1455b 43 #include "ad5592r-base.h"
EndaKilgarriff 1:2ad195e1455b 44
EndaKilgarriff 1:2ad195e1455b 45 #define AD5592R_GPIO_READBACK_EN BIT(10)
EndaKilgarriff 1:2ad195e1455b 46 #define AD5592R_LDAC_READBACK_EN BIT(6)
EndaKilgarriff 1:2ad195e1455b 47
EndaKilgarriff 1:2ad195e1455b 48 #define swab16(x) \
EndaKilgarriff 1:2ad195e1455b 49 ((((x) & 0x00ff) << 8) | \
EndaKilgarriff 1:2ad195e1455b 50 (((x) & 0xff00) >> 8))
EndaKilgarriff 1:2ad195e1455b 51
EndaKilgarriff 1:2ad195e1455b 52 int32_t ad5592r_write_dac(struct ad5592r_dev *dev, uint8_t chan,
EndaKilgarriff 1:2ad195e1455b 53 uint16_t value);
EndaKilgarriff 1:2ad195e1455b 54 int32_t ad5592r_read_adc(struct ad5592r_dev *dev, uint8_t chan,
EndaKilgarriff 1:2ad195e1455b 55 uint16_t *value);
EndaKilgarriff 1:2ad195e1455b 56 int32_t ad5592r_multi_read_adc(struct ad5592r_dev *dev,
EndaKilgarriff 1:2ad195e1455b 57 uint16_t chans, uint16_t *value);
EndaKilgarriff 1:2ad195e1455b 58 int32_t ad5592r_reg_write(struct ad5592r_dev *dev, uint8_t reg,
EndaKilgarriff 1:2ad195e1455b 59 uint16_t value);
EndaKilgarriff 1:2ad195e1455b 60 int32_t ad5592r_reg_read(struct ad5592r_dev *dev, uint8_t reg,
EndaKilgarriff 1:2ad195e1455b 61 uint16_t *value);
EndaKilgarriff 1:2ad195e1455b 62 int32_t ad5592r_gpio_read(struct ad5592r_dev *dev, uint8_t *value);
EndaKilgarriff 1:2ad195e1455b 63 int32_t ad5592r_init(struct ad5592r_dev *dev,
EndaKilgarriff 1:2ad195e1455b 64 struct ad5592r_init_param *init_param);
EndaKilgarriff 1:2ad195e1455b 65
EndaKilgarriff 1:2ad195e1455b 66 #endif /* AD5592R_H_ */