KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ltc2631.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 : ltc2631.h
11  * Created : 21 jan. 2014
12  * Author : Vincent van Beveren
13  */
14 
15 #ifndef LTC2631_H_
16 #define LTC2631_H_
17 
18 /**
19  * @file
20  *
21  * @ingroup i2cdrivers
22  *
23  * Driver of the LTC2631 DAC as found on the power board.
24  */
25 
26 #include "drv/wb/i2c.h"
27 
28 
29 #define LTC2631_MAX 0xFFFF
30 
31 typedef enum {
32  ltc2631OperUpdate, //!< Adjust output voltage with value in input buffer.
33  ltc2631OperPowerDown, //!< Power down the LTC2631
34  ltc2631OperSelIntRef, //!< Select internal reference
35  ltc2631OperSelExtRef //!< Select external reference
36 } LTC2631Oper;
37 
38 /**
39  * Sets the DAC value on the input register. When update is false, the output voltage is not
40  * immediately adjusted to the value of the input register. To apply the set input value invoke the
41  * ltc2631Operation with the ltc2631OperUpdate operation.
42  *
43  * @param dev The I2C device.
44  * @param addr The I2C address
45  * @param value The DAC value to set
46  * @param update Immediately update
47  *
48  * @retval true Success
49  * @retval false Failure, see err module for error.
50  */
51 bool ltc2631Write(I2C_Device * dev, uint8_t addr, uint16_t value, bool update);
52 
53 /**
54  * Executes a DAC operation. See LTC2631Oper enumeration for possible options.
55  *
56  * @param dev The I2C device.
57  * @param addr The I2C address
58  * @param oper The operation to execute.
59  *
60  * @retval true Success
61  * @retval false Failure, see err module for error.
62  */
63 bool ltc2631Operation(I2C_Device * dev, uint8_t addr, LTC2631Oper oper);
64 
65 
66 
67 
68 
69 #endif /* LTC2631_H_ */
bool ltc2631Write(I2C_Device *dev, uint8_t addr, uint16_t value, bool update)
Sets the DAC value on the input register.
Definition: ltc2631.c:26
Select external reference.
Definition: ltc2631.h:35
bool ltc2631Operation(I2C_Device *dev, uint8_t addr, LTC2631Oper oper)
Executes a DAC operation.
Definition: ltc2631.c:37
Structure defines OpenCores I2C Device.
Definition: dev_i2c.h:55
Power down the LTC2631.
Definition: ltc2631.h:33
LTC2631Oper
Definition: ltc2631.h:31
Select internal reference.
Definition: ltc2631.h:34
Adjust output voltage with value in input buffer.
Definition: ltc2631.h:32
OpenCores I2C device driver.