pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
Bias.h
1#ifndef PFLIB_MAX5825_H_
2#define PFLIB_MAX5825_H_
3
4#include <unistd.h>
5
6#include <vector>
7
8#include "pflib/I2C.h"
9
10namespace pflib {
11
29class MAX5825 {
30 public:
31 // Board Commands
32 static const uint8_t WDOG;
33
34 // DAC Commands
35 // add the DAC selection to these commands
36 // to get the full command byte
37 static const uint8_t RETURNn;
38 static const uint8_t CODEn;
39 static const uint8_t LOADn;
40 static const uint8_t CODEn_LOADALL;
41 static const uint8_t CODEn_LOADn;
42 static const uint8_t REFn;
43 static const uint8_t POWERn;
44
45 public:
50 MAX5825(std::shared_ptr<I2C> i2c, uint8_t max_addr);
51
60 std::vector<uint8_t> get(uint8_t channel);
61
62 void set(uint8_t channel, uint16_t data_bytes);
63
76 // void set(uint8_t cmd, uint16_t data_bytes);
77
92 // std::vector<uint16_t> getByDAC(uint8_t i_dac, uint8_t cmd);
93
107 // void setByDAC(uint8_t i_dac, uint8_t cmd, uint16_t twelve_bit_setting);
108
115 // void setRefVoltage(int level);
116
117 private:
121 uint8_t our_addr_;
123 // int bus_;
124}; // MAX5825
125
138class Bias {
139 public:
141 static const uint8_t ADDR_LED_0;
142 static const uint8_t ADDR_LED_1;
143 static const uint8_t ADDR_SIPM_0;
144 static const uint8_t ADDR_SIPM_1;
145
146 public:
154
159 void initialize();
160 double readTemp();
161
162 int readSiPM(uint8_t i_sipm);
163 int readLED(uint8_t i_led);
164 void setSiPM(uint8_t i_sipm, uint16_t code);
165 void setLED(uint8_t i_led, uint16_t code);
166
167 private:
168 std::shared_ptr<I2C> i2c_bias_;
169 std::shared_ptr<I2C> i2c_board_;
170
175}; // Bias
176
177} // namespace pflib
178
179#endif // PFLIB_MAX5825_H_
The HGC ROC has 4 MAX5825 chips doing the DAC for the bias voltages.
Definition Bias.h:138
std::vector< MAX5825 > led_
LED bias chips.
Definition Bias.h:172
std::vector< MAX5825 > sipm_
SiPM bias chips.
Definition Bias.h:174
void initialize()
Initialize to standard settings Reference voltage - 4.096V.
Definition Bias.cxx:59
static const uint8_t ADDR_LED_0
DAC chip addresses.
Definition Bias.h:141
Bias(std::shared_ptr< I2C > bias_i2c, std::shared_ptr< I2C > board_i2c)
Wrap an I2C class for communicating with all the DAC chips.
Definition Bias.cxx:49
Class representing communication with the Digital-Analog Converter on the HGC ROC.
Definition Bias.h:29
uint8_t our_addr_
our addr on the chip
Definition Bias.h:121
std::shared_ptr< I2C > i2c_
Write a setting for the DACs on this MAX.
Definition Bias.h:119
std::vector< uint8_t > get(uint8_t channel)
Get the settings for the DACs on this MAX.
Definition Bias.cxx:25
MAX5825(std::shared_ptr< I2C > i2c, uint8_t max_addr)
Wrap an I2C class for communicating with the MAX5825.
Definition Bias.cxx:22
This version of the fast control code interfaces with the CMS Fast control library which can be contr...
Definition Backend.cxx:3