2 * Copyright © 2019 Bdale Garbee <bdale@gag.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
15 #ifndef _AO_ADS131A0X_H_
16 #define _AO_ADS131A0X_H_
18 /* control commands */
19 #define AO_ADS131A0X_NOP 0x00
20 #define AO_ADS131A0X_WAKEUP 0x02
21 #define AO_ADS131A0X_POWERDOWN 0x04
22 #define AO_ADS131A0X_RESET 0x06
23 #define AO_ADS131A0X_START 0x08
24 #define AO_ADS131A0X_STOP 0x0a
26 /* calibration commands */
27 #define AO_ADS131A0X_SYOCAL 0x16
28 #define AO_ADS131A0X_SYGCAL 0x17
29 #define AO_ADS131A0X_SFOCAL 0x19
31 /* data read command */
32 #define AO_ADS131A0X_RDATA 0x12
34 /* register read and write commands */
35 #define AO_ADS131A0X_RREG 0x20
36 #define AO_ADS131A0X_WREG 0x40
38 /* configuration register map */
39 #define AO_ADS131A0X_ID 0x00
40 #define AO_ADS131A0X_ID_ADS131A08 0x00
41 #define AO_ADS131A0X_ID_ADS131A06 0x01
42 #define AO_ADS131A0X_STATUS 0x01
43 #define AO_ADS131A0X_INPMUX 0x02
44 #define AO_ADS131A0X_PGA 0x03
45 #define AO_ADS131A0X_DATARATE 0x04
46 #define AO_ADS131A0X_REF 0x05
47 #define AO_ADS131A0X_IDACMAG 0x06
48 #define AO_ADS131A0X_IDACMUX 0x07
49 #define AO_ADS131A0X_VBIAS 0x08
50 #define AO_ADS131A0X_SYS 0x09
51 #define AO_ADS131A0X_OFCAL0 0x0a
52 #define AO_ADS131A0X_OFCAL1 0x0b
53 #define AO_ADS131A0X_OFCAL2 0x0c
54 #define AO_ADS131A0X_FSCAL0 0x0d
55 #define AO_ADS131A0X_FSCAL1 0x0e
56 #define AO_ADS131A0X_FSCAL2 0x0f
57 #define AO_ADS131A0X_GPIODAT 0x10
58 #define AO_ADS131A0X_GPIOCON 0x11
60 struct ao_ads131a0x_sample {
61 int32_t ain[AO_ADS131A0X_CHANNELS];
64 extern struct ao_ads131a0x_sample ao_ads131a0x_current;
67 ao_ads131a0x_init(void);
69 #endif /* _AO_ADS131A0X_H_ */