ad7124.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. /***************************************************************************//**
  2. * @file ad7124.h
  3. * @brief AD7124 header file.
  4. * Devices AD7124-4, AD7124-8
  5. *
  6. ********************************************************************************
  7. * Copyright 2015-2019(c) Analog Devices, Inc.
  8. *
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * - Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * - Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. * - Neither the name of Analog Devices, Inc. nor the names of its
  20. * contributors may be used to endorse or promote products derived
  21. * from this software without specific prior written permission.
  22. * - The use of this software may or may not infringe the patent rights
  23. * of one or more patent holders. This license does not release you
  24. * from the requirement that you obtain separate licenses from these
  25. * patent holders to use this software.
  26. * - Use of the software either in source or binary form, must be run
  27. * on or directly connected to an Analog Devices Inc. component.
  28. *
  29. * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED
  30. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY
  31. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  32. * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  34. * INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  35. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  36. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  38. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *******************************************************************************/
  40. #ifndef __AD7124_H__
  41. #define __AD7124_H__
  42. /******************************************************************************/
  43. /***************************** Include Files **********************************/
  44. /******************************************************************************/
  45. #include <stdint.h>
  46. #include "spi.h"
  47. #include "delay.h"
  48. /******************************************************************************/
  49. /******************* Register map and register definitions ********************/
  50. /******************************************************************************/
  51. #define AD7124_RW 1 /* Read and Write */
  52. #define AD7124_R 2 /* Read only */
  53. #define AD7124_W 3 /* Write only */
  54. /* AD7124 Register Map */
  55. #define AD7124_COMM_REG 0x00
  56. #define AD7124_STATUS_REG 0x00
  57. #define AD7124_ADC_CTRL_REG 0x01
  58. #define AD7124_DATA_REG 0x02
  59. #define AD7124_IO_CTRL1_REG 0x03
  60. #define AD7124_IO_CTRL2_REG 0x04
  61. #define AD7124_ID_REG 0x05
  62. #define AD7124_ERR_REG 0x06
  63. #define AD7124_ERREN_REG 0x07
  64. #define AD7124_CH0_MAP_REG 0x09
  65. #define AD7124_CH1_MAP_REG 0x0A
  66. #define AD7124_CH2_MAP_REG 0x0B
  67. #define AD7124_CH3_MAP_REG 0x0C
  68. #define AD7124_CH4_MAP_REG 0x0D
  69. #define AD7124_CH5_MAP_REG 0x0E
  70. #define AD7124_CH6_MAP_REG 0x0F
  71. #define AD7124_CH7_MAP_REG 0x10
  72. #define AD7124_CH8_MAP_REG 0x11
  73. #define AD7124_CH9_MAP_REG 0x12
  74. #define AD7124_CH10_MAP_REG 0x13
  75. #define AD7124_CH11_MAP_REG 0x14
  76. #define AD7124_CH12_MAP_REG 0x15
  77. #define AD7124_CH13_MAP_REG 0x16
  78. #define AD7124_CH14_MAP_REG 0x17
  79. #define AD7124_CH15_MAP_REG 0x18
  80. #define AD7124_CFG0_REG 0x19
  81. #define AD7124_CFG1_REG 0x1A
  82. #define AD7124_CFG2_REG 0x1B
  83. #define AD7124_CFG3_REG 0x1C
  84. #define AD7124_CFG4_REG 0x1D
  85. #define AD7124_CFG5_REG 0x1E
  86. #define AD7124_CFG6_REG 0x1F
  87. #define AD7124_CFG7_REG 0x20
  88. #define AD7124_FILT0_REG 0x21
  89. #define AD7124_FILT1_REG 0x22
  90. #define AD7124_FILT2_REG 0x23
  91. #define AD7124_FILT3_REG 0x24
  92. #define AD7124_FILT4_REG 0x25
  93. #define AD7124_FILT5_REG 0x26
  94. #define AD7124_FILT6_REG 0x27
  95. #define AD7124_FILT7_REG 0x28
  96. #define AD7124_OFFS0_REG 0x29
  97. #define AD7124_OFFS1_REG 0x2A
  98. #define AD7124_OFFS2_REG 0x2B
  99. #define AD7124_OFFS3_REG 0x2C
  100. #define AD7124_OFFS4_REG 0x2D
  101. #define AD7124_OFFS5_REG 0x2E
  102. #define AD7124_OFFS6_REG 0x2F
  103. #define AD7124_OFFS7_REG 0x30
  104. #define AD7124_GAIN0_REG 0x31
  105. #define AD7124_GAIN1_REG 0x32
  106. #define AD7124_GAIN2_REG 0x33
  107. #define AD7124_GAIN3_REG 0x34
  108. #define AD7124_GAIN4_REG 0x35
  109. #define AD7124_GAIN5_REG 0x36
  110. #define AD7124_GAIN6_REG 0x37
  111. #define AD7124_GAIN7_REG 0x38
  112. /* Communication Register bits */
  113. #define AD7124_COMM_REG_WEN (0 << 7)
  114. #define AD7124_COMM_REG_WR (0 << 6)
  115. #define AD7124_COMM_REG_RD (1 << 6)
  116. #define AD7124_COMM_REG_RA(x) ((x) & 0x3F)
  117. /* Status Register bits */
  118. #define AD7124_STATUS_REG_RDY (1 << 7)
  119. #define AD7124_STATUS_REG_ERROR_FLAG (1 << 6)
  120. #define AD7124_STATUS_REG_POR_FLAG (1 << 4)
  121. #define AD7124_STATUS_REG_CH_ACTIVE(x) ((x) & 0xF)
  122. /* ADC_Control Register bits */
  123. #define AD7124_ADC_CTRL_REG_DOUT_RDY_DEL (1 << 12)
  124. #define AD7124_ADC_CTRL_REG_CONT_READ (1 << 11)
  125. #define AD7124_ADC_CTRL_REG_DATA_STATUS (1 << 10)
  126. #define AD7124_ADC_CTRL_REG_CS_EN (1 << 9)
  127. #define AD7124_ADC_CTRL_REG_REF_EN (1 << 8)
  128. #define AD7124_ADC_CTRL_REG_POWER_MODE(x) (((x) & 0x3) << 6)
  129. #define AD7124_ADC_CTRL_REG_MODE(x) (((x) & 0xF) << 2)
  130. #define AD7124_ADC_CTRL_REG_CLK_SEL(x) (((x) & 0x3) << 0)
  131. /* IO_Control_1 Register bits */
  132. #define AD7124_IO_CTRL1_REG_GPIO_DAT2 (1 << 23)
  133. #define AD7124_IO_CTRL1_REG_GPIO_DAT1 (1 << 22)
  134. #define AD7124_IO_CTRL1_REG_GPIO_CTRL2 (1 << 19)
  135. #define AD7124_IO_CTRL1_REG_GPIO_CTRL1 (1 << 18)
  136. #define AD7124_IO_CTRL1_REG_PDSW (1 << 15)
  137. #define AD7124_IO_CTRL1_REG_IOUT1(x) (((x) & 0x7) << 11)
  138. #define AD7124_IO_CTRL1_REG_IOUT0(x) (((x) & 0x7) << 8)
  139. #define AD7124_IO_CTRL1_REG_IOUT_CH1(x) (((x) & 0xF) << 4)
  140. #define AD7124_IO_CTRL1_REG_IOUT_CH0(x) (((x) & 0xF) << 0)
  141. /* IO_Control_1 AD7124-8 specific bits */
  142. #define AD7124_8_IO_CTRL1_REG_GPIO_DAT4 (1 << 23)
  143. #define AD7124_8_IO_CTRL1_REG_GPIO_DAT3 (1 << 22)
  144. #define AD7124_8_IO_CTRL1_REG_GPIO_DAT2 (1 << 21)
  145. #define AD7124_8_IO_CTRL1_REG_GPIO_DAT1 (1 << 20)
  146. #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL4 (1 << 19)
  147. #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL3 (1 << 18)
  148. #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL2 (1 << 17)
  149. #define AD7124_8_IO_CTRL1_REG_GPIO_CTRL1 (1 << 16)
  150. /* IO_Control_2 Register bits */
  151. #define AD7124_IO_CTRL2_REG_GPIO_VBIAS7 (1 << 15)
  152. #define AD7124_IO_CTRL2_REG_GPIO_VBIAS6 (1 << 14)
  153. #define AD7124_IO_CTRL2_REG_GPIO_VBIAS5 (1 << 11)
  154. #define AD7124_IO_CTRL2_REG_GPIO_VBIAS4 (1 << 10)
  155. #define AD7124_IO_CTRL2_REG_GPIO_VBIAS3 (1 << 5)
  156. #define AD7124_IO_CTRL2_REG_GPIO_VBIAS2 (1 << 4)
  157. #define AD7124_IO_CTRL2_REG_GPIO_VBIAS1 (1 << 1)
  158. #define AD7124_IO_CTRL2_REG_GPIO_VBIAS0 (1 << 0)
  159. /* IO_Control_2 AD7124-8 specific bits */
  160. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS15 (1 << 15)
  161. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS14 (1 << 14)
  162. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS13 (1 << 13)
  163. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS12 (1 << 12)
  164. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS11 (1 << 11)
  165. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS10 (1 << 10)
  166. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS9 (1 << 9)
  167. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS8 (1 << 8)
  168. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS7 (1 << 7)
  169. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS6 (1 << 6)
  170. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS5 (1 << 5)
  171. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS4 (1 << 4)
  172. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS3 (1 << 3)
  173. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS2 (1 << 2)
  174. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS1 (1 << 1)
  175. #define AD7124_8_IO_CTRL2_REG_GPIO_VBIAS0 (1 << 0)
  176. /* ID Register bits */
  177. #define AD7124_ID_REG_DEVICE_ID(x) (((x) & 0xF) << 4)
  178. #define AD7124_ID_REG_SILICON_REV(x) (((x) & 0xF) << 0)
  179. /* Error Register bits */
  180. #define AD7124_ERR_REG_LDO_CAP_ERR (1 << 19)
  181. #define AD7124_ERR_REG_ADC_CAL_ERR (1 << 18)
  182. #define AD7124_ERR_REG_ADC_CONV_ERR (1 << 17)
  183. #define AD7124_ERR_REG_ADC_SAT_ERR (1 << 16)
  184. #define AD7124_ERR_REG_AINP_OV_ERR (1 << 15)
  185. #define AD7124_ERR_REG_AINP_UV_ERR (1 << 14)
  186. #define AD7124_ERR_REG_AINM_OV_ERR (1 << 13)
  187. #define AD7124_ERR_REG_AINM_UV_ERR (1 << 12)
  188. #define AD7124_ERR_REG_REF_DET_ERR (1 << 11)
  189. #define AD7124_ERR_REG_DLDO_PSM_ERR (1 << 9)
  190. #define AD7124_ERR_REG_ALDO_PSM_ERR (1 << 7)
  191. #define AD7124_ERR_REG_SPI_IGNORE_ERR (1 << 6)
  192. #define AD7124_ERR_REG_SPI_SLCK_CNT_ERR (1 << 5)
  193. #define AD7124_ERR_REG_SPI_READ_ERR (1 << 4)
  194. #define AD7124_ERR_REG_SPI_WRITE_ERR (1 << 3)
  195. #define AD7124_ERR_REG_SPI_CRC_ERR (1 << 2)
  196. #define AD7124_ERR_REG_MM_CRC_ERR (1 << 1)
  197. #define AD7124_ERR_REG_ROM_CRC_ERR (1 << 0)
  198. /* Error_En Register bits */
  199. #define AD7124_ERREN_REG_MCLK_CNT_EN (1 << 22)
  200. #define AD7124_ERREN_REG_LDO_CAP_CHK_TEST_EN (1 << 21)
  201. #define AD7124_ERREN_REG_LDO_CAP_CHK(x) (((x) & 0x3) << 19)
  202. #define AD7124_ERREN_REG_ADC_CAL_ERR_EN (1 << 18)
  203. #define AD7124_ERREN_REG_ADC_CONV_ERR_EN (1 << 17)
  204. #define AD7124_ERREN_REG_ADC_SAT_ERR_EN (1 << 16)
  205. #define AD7124_ERREN_REG_AINP_OV_ERR_EN (1 << 15)
  206. #define AD7124_ERREN_REG_AINP_UV_ERR_EN (1 << 14)
  207. #define AD7124_ERREN_REG_AINM_OV_ERR_EN (1 << 13)
  208. #define AD7124_ERREN_REG_AINM_UV_ERR_EN (1 << 12)
  209. #define AD7124_ERREN_REG_REF_DET_ERR_EN (1 << 11)
  210. #define AD7124_ERREN_REG_DLDO_PSM_TRIP_TEST_EN (1 << 10)
  211. #define AD7124_ERREN_REG_DLDO_PSM_ERR_ERR (1 << 9)
  212. #define AD7124_ERREN_REG_ALDO_PSM_TRIP_TEST_EN (1 << 8)
  213. #define AD7124_ERREN_REG_ALDO_PSM_ERR_EN (1 << 7)
  214. #define AD7124_ERREN_REG_SPI_IGNORE_ERR_EN (1 << 6)
  215. #define AD7124_ERREN_REG_SPI_SCLK_CNT_ERR_EN (1 << 5)
  216. #define AD7124_ERREN_REG_SPI_READ_ERR_EN (1 << 4)
  217. #define AD7124_ERREN_REG_SPI_WRITE_ERR_EN (1 << 3)
  218. #define AD7124_ERREN_REG_SPI_CRC_ERR_EN (1 << 2)
  219. #define AD7124_ERREN_REG_MM_CRC_ERR_EN (1 << 1)
  220. #define AD7124_ERREN_REG_ROM_CRC_ERR_EN (1 << 0)
  221. /* Channel Registers 0-15 bits */
  222. #define AD7124_CH_MAP_REG_CH_ENABLE (1 << 15)
  223. #define AD7124_CH_MAP_REG_SETUP(x) (((x) & 0x7) << 12)
  224. #define AD7124_CH_MAP_REG_AINP(x) (((x) & 0x1F) << 5)
  225. #define AD7124_CH_MAP_REG_AINM(x) (((x) & 0x1F) << 0)
  226. /* Configuration Registers 0-7 bits */
  227. #define AD7124_CFG_REG_BIPOLAR (1 << 11)
  228. #define AD7124_CFG_REG_BURNOUT(x) (((x) & 0x3) << 9)
  229. #define AD7124_CFG_REG_REF_BUFP (1 << 8)
  230. #define AD7124_CFG_REG_REF_BUFM (1 << 7)
  231. #define AD7124_CFG_REG_AIN_BUFP (1 << 6)
  232. #define AD7124_CFG_REG_AINN_BUFM (1 << 5)
  233. #define AD7124_CFG_REG_REF_SEL(x) ((x) & 0x3) << 3
  234. #define AD7124_CFG_REG_PGA(x) (((x) & 0x7) << 0)
  235. /* Filter Register 0-7 bits */
  236. #define AD7124_FILT_REG_FILTER(x) (((x) & 0x7) << 21)
  237. #define AD7124_FILT_REG_REJ60 (1 << 20)
  238. #define AD7124_FILT_REG_POST_FILTER(x) (((x) & 0x7) << 17)
  239. #define AD7124_FILT_REG_SINGLE_CYCLE (1 << 16)
  240. #define AD7124_FILT_REG_FS(x) (((x) & 0x7FF) << 0)
  241. /******************************************************************************/
  242. /*************************** Types Declarations *******************************/
  243. /******************************************************************************/
  244. /*! Device register info */
  245. struct ad7124_st_reg {
  246. int32_t addr;
  247. int32_t value;
  248. int32_t size;
  249. int32_t rw;
  250. };
  251. /*! AD7124 registers list*/
  252. enum ad7124_registers {
  253. AD7124_Status = 0x00,
  254. AD7124_ADC_Control,
  255. AD7124_Data,
  256. AD7124_IOCon1,
  257. AD7124_IOCon2,
  258. AD7124_ID,
  259. AD7124_Error,
  260. AD7124_Error_En,
  261. AD7124_Mclk_Count,
  262. AD7124_Channel_0,
  263. AD7124_Channel_1,
  264. AD7124_Channel_2,
  265. AD7124_Channel_3,
  266. AD7124_Channel_4,
  267. AD7124_Channel_5,
  268. AD7124_Channel_6,
  269. AD7124_Channel_7,
  270. AD7124_Channel_8,
  271. AD7124_Channel_9,
  272. AD7124_Channel_10,
  273. AD7124_Channel_11,
  274. AD7124_Channel_12,
  275. AD7124_Channel_13,
  276. AD7124_Channel_14,
  277. AD7124_Channel_15,
  278. AD7124_Config_0,
  279. AD7124_Config_1,
  280. AD7124_Config_2,
  281. AD7124_Config_3,
  282. AD7124_Config_4,
  283. AD7124_Config_5,
  284. AD7124_Config_6,
  285. AD7124_Config_7,
  286. AD7124_Filter_0,
  287. AD7124_Filter_1,
  288. AD7124_Filter_2,
  289. AD7124_Filter_3,
  290. AD7124_Filter_4,
  291. AD7124_Filter_5,
  292. AD7124_Filter_6,
  293. AD7124_Filter_7,
  294. AD7124_Offset_0,
  295. AD7124_Offset_1,
  296. AD7124_Offset_2,
  297. AD7124_Offset_3,
  298. AD7124_Offset_4,
  299. AD7124_Offset_5,
  300. AD7124_Offset_6,
  301. AD7124_Offset_7,
  302. AD7124_Gain_0,
  303. AD7124_Gain_1,
  304. AD7124_Gain_2,
  305. AD7124_Gain_3,
  306. AD7124_Gain_4,
  307. AD7124_Gain_5,
  308. AD7124_Gain_6,
  309. AD7124_Gain_7,
  310. AD7124_REG_NO
  311. };
  312. /*
  313. * The structure describes the device and is used with the ad7124 driver.
  314. * @spi_desc: A reference to the SPI configuration of the device.
  315. * @regs: A reference to the register list of the device that the user must
  316. * provide when calling the Setup() function.
  317. * @userCRC: Whether to do or not a cyclic redundancy check on SPI transfers.
  318. * @check_ready: When enabled all register read and write calls will first wait
  319. * until the device is ready to accept user requests.
  320. * @spi_rdy_poll_cnt: Number of times the driver should read the Error register
  321. * to check if the device is ready to accept user requests,
  322. * before a timeout error will be issued.
  323. */
  324. struct ad7124_dev {
  325. /* SPI */
  326. spi_desc *spi_desc;
  327. /* Device Settings */
  328. struct ad7124_st_reg *regs;
  329. int16_t use_crc;
  330. int16_t check_ready;
  331. int16_t spi_rdy_poll_cnt;
  332. };
  333. struct ad7124_init_param {
  334. /* SPI */
  335. spi_init_param spi_init;
  336. /* Device Settings */
  337. struct ad7124_st_reg *regs;
  338. int16_t spi_rdy_poll_cnt;
  339. };
  340. /******************************************************************************/
  341. /******************* AD7124 Constants *****************************************/
  342. /******************************************************************************/
  343. #define AD7124_CRC8_POLYNOMIAL_REPRESENTATION 0x07 /* x8 + x2 + x + 1 */
  344. #define AD7124_DISABLE_CRC 0
  345. #define AD7124_USE_CRC 1
  346. /******************************************************************************/
  347. /************************ Functions Declarations ******************************/
  348. /******************************************************************************/
  349. /*! Reads the value of the specified register. */
  350. int32_t ad7124_read_register(struct ad7124_dev *dev,
  351. struct ad7124_st_reg* p_reg);
  352. /*! Writes the value of the specified register. */
  353. int32_t ad7124_write_register(struct ad7124_dev *dev,
  354. struct ad7124_st_reg reg);
  355. /*! Reads the value of the specified register without a device state check. */
  356. int32_t ad7124_no_check_read_register(struct ad7124_dev *dev,
  357. struct ad7124_st_reg* p_reg);
  358. /*! Writes the value of the specified register without a device state check. */
  359. int32_t ad7124_no_check_write_register(struct ad7124_dev *dev,
  360. struct ad7124_st_reg reg);
  361. /*! Resets the device. */
  362. int32_t ad7124_reset(struct ad7124_dev *dev);
  363. /*! Waits until the device can accept read and write user actions. */
  364. int32_t ad7124_wait_for_spi_ready(struct ad7124_dev *dev,
  365. uint32_t timeout);
  366. /*! Waits until the device finishes the power-on reset operation. */
  367. int32_t ad7124_wait_to_power_on(struct ad7124_dev *dev,
  368. uint32_t timeout);
  369. /*! Waits until a new conversion result is available. */
  370. int32_t ad7124_wait_for_conv_ready(struct ad7124_dev *dev,
  371. uint32_t timeout);
  372. /*! Reads the conversion result from the device. */
  373. int32_t ad7124_read_data(struct ad7124_dev *dev,
  374. int32_t* p_data);
  375. /*! Computes the CRC checksum for a data buffer. */
  376. uint8_t ad7124_compute_crc8(uint8_t* p_buf,
  377. uint8_t buf_size);
  378. /*! Updates the CRC settings. */
  379. void ad7124_update_crcsetting(struct ad7124_dev *dev);
  380. /*! Updates the device SPI interface settings. */
  381. void ad7124_update_dev_spi_settings(struct ad7124_dev *dev);
  382. /*! Initializes the AD7124. */
  383. int32_t ad7124_setup(struct ad7124_dev **device,
  384. struct ad7124_init_param init_param);
  385. /*! Free the resources allocated by AD7124_Setup(). */
  386. int32_t ad7124_remove(struct ad7124_dev *dev);
  387. #endif /* __AD7124_H__ */