KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ltc2499.h
Go to the documentation of this file.
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2013 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : ltc2499.h
11  * Created : 14 mrt. 2013
12  * Author : Vincent van Beveren
13  */
14 
15 
16 #ifndef LTC2499_H_
17 #define LTC2499_H_
18 
19 /**
20  * @file
21  *
22  * @ingroup i2cdrivers
23  *
24  * Driver of the LTC2499 ADC as found on the power board.
25  */
26 
27 #include "drv/wb/i2c.h"
28 
29 /**
30  * The status enum, indicating any issues with the value (underflow/overflow).
31  */
32 typedef enum {
33  ltc2499StatusOk, //!< Conversion is ok
34  ltc2499StatusOverFlow, //!< Overflow
35  ltc2499StatusUnderFlow //!< Underflow
37 
38 typedef enum {
39  ltc2499Filter50Hz,
40  ltc2499Filter60Hz,
41  ltc2499Filter50And60Hz
42 } LTC2499Filter;
43 
44 #define LTC2499_MAX_VALUE 0x00FFFFFF
45 #define LTC2499_MIN_VALUE 0xFF000000
46 
47 #define LTC2499_CH_KEEPPREV 0xFF
48 
49 
50 /**
51  * Reads the LTC ADC at I2C address 'addr'.
52  *
53  * @param dev The I2C device
54  * @param addr The I2C address
55  * @param value The value as a full-range range 32 bit signed integer.
56  * @param status The conversion status.
57  *
58  * @retval true No serious errors.
59  * @retval false An error occured, check err module for error.
60  */
61 bool ltc2499Read(I2C_Device * dev, int addr, int32_t * value, LTC2499Status * result);
62 
63 /**
64  * Configure LTC2499 with external input.
65  *
66  * When selecting differential input (diff = true), you only need to specify the positive input
67  * channel. The negative input channel is the LSB's bit complement. E.g. selecting channel 0 as
68  * positive, means channel 1 is the negative input. When selecting channel as positive input,
69  * channel 4 is the negative input. Optionally you can select LTC2499_CH_KEEPPREV to keep the
70  * previous channel configuration.
71  *
72  * @param dev The I2C device
73  * @param addr The I2C address
74  * @param diff When true, use differential input
75  * @param posCh Positive input channel, or LTC2499_CH_KEEPPREV.
76  * @param fltCfg Filter configuration
77  * @param speed2x Acquire twice as fast
78  *
79  * @retval true No serious errors.
80  * @retval false An error occured, check err module for error.
81  */
82 bool ltc2499CfgExt(I2C_Device * dev, int addr,
83  bool diff, uint8_t posCh,
84  LTC2499Filter fltCfg, bool speed2x);
85 
86 /**
87  * Configure LTC2499 for temperature reading.
88  *
89  * @param dev The I2C device
90  * @param addr The I2C address
91  * @param fltCfg Filter configuration.
92  *
93  * @retval true No serious errors.
94  * @retval false An error occured, check err module for error.
95  */
96 bool ltc24499CfgTemp(I2C_Device * dev, int addr, LTC2499Filter fltCfg);
97 
98 
99 #endif /* LTC2489_H_ */
bool ltc2499Read(I2C_Device *dev, int addr, int32_t *value, LTC2499Status *result)
Reads the LTC ADC at I2C address &#39;addr&#39;.
Definition: ltc2499.c:41
bool ltc2499CfgExt(I2C_Device *dev, int addr, bool diff, uint8_t posCh, LTC2499Filter fltCfg, bool speed2x)
Configure LTC2499 with external input.
Definition: ltc2499.c:77
Structure defines OpenCores I2C Device.
Definition: dev_i2c.h:55
Underflow.
Definition: ltc2499.h:35
bool ltc24499CfgTemp(I2C_Device *dev, int addr, LTC2499Filter fltCfg)
Configure LTC2499 for temperature reading.
Conversion is ok.
Definition: ltc2499.h:33
Overflow.
Definition: ltc2499.h:34
LTC2499Status
The status enum, indicating any issues with the value (underflow/overflow).
Definition: ltc2499.h:32
OpenCores I2C device driver.