pflib v2.7.0-1-gd371ab6a
Polarfire Interaction Library
Bias.h
1#ifndef PFLIB_MAX5825_H_
2#define PFLIB_MAX5825_H_
3
4#include "pflib/I2C.h"
5#include <vector>
6
7namespace pflib {
8
26class MAX5825 {
27 public:
28 // Board Commands
29 static const uint8_t WDOG;
30
31 // DAC Commands
32 // add the DAC selection to these commands
33 // to get the full command byte
34 static const uint8_t RETURNn;
35 static const uint8_t CODEn;
36 static const uint8_t LOADn;
37 static const uint8_t CODEn_LOADALL;
38 static const uint8_t CODEn_LOADn;
39 static const uint8_t REFn;
40 static const uint8_t POWERn;
41 public:
46 MAX5825(I2C& i2c, uint8_t max_addr, int bus = 4);
47
56 std::vector<uint8_t> get(uint8_t cmd, int n_return_bytes = 2);
57
70 void set(uint8_t cmd, uint16_t data_bytes);
71
86 std::vector<uint16_t> getByDAC(uint8_t i_dac, uint8_t cmd);
87
101 void setByDAC(uint8_t i_dac, uint8_t cmd, uint16_t twelve_bit_setting);
102
103
110 void setRefVoltage(int level);
111
112 private:
116 uint8_t our_addr_;
118 int bus_;
119}; // MAX5825
120
133class Bias {
134 public:
136 static const uint8_t ADDR_LED_0;
137 static const uint8_t ADDR_LED_1;
138 static const uint8_t ADDR_SIPM_0;
139 static const uint8_t ADDR_SIPM_1;
140 public:
147 Bias(I2C& i2c, int bus = 4);
148
153 void initialize();
154
158 void cmdLED(uint8_t i_led, uint8_t cmd, uint16_t twelve_bit_setting);
159
163 void cmdSiPM(uint8_t i_sipm, uint8_t cmd, uint16_t twelve_bit_setting);
164
173 void setLED(uint8_t i_led, uint16_t code);
174
183 void setSiPM(uint8_t i_sipm, uint16_t code);
184
185 private:
190}; // Bias
191
192}
193
194#endif // PFLIB_MAX5825_H_
The HGC ROC has 4 MAX5825 chips doing the DAC for the bias voltages.
Definition: Bias.h:133
void setSiPM(uint8_t i_sipm, uint16_t code)
Set and load the passed CODE for an SiPM bias.
Definition: Bias.cxx:124
Bias(I2C &i2c, int bus=4)
Wrap an I2C class for communicating with all the DAC chips.
Definition: Bias.cxx:94
std::vector< MAX5825 > led_
LED bias chips.
Definition: Bias.h:187
void setLED(uint8_t i_led, uint16_t code)
Set and load the passed CODE for an LED bias.
Definition: Bias.cxx:120
std::vector< MAX5825 > sipm_
SiPM bias chips.
Definition: Bias.h:189
void initialize()
Initialize to standard settings Reference voltage - 4.096V.
Definition: Bias.cxx:101
static const uint8_t ADDR_LED_0
DAC chip addresses.
Definition: Bias.h:136
void cmdSiPM(uint8_t i_sipm, uint8_t cmd, uint16_t twelve_bit_setting)
Pass a setting to one SiPM DAC.
Definition: Bias.cxx:115
void cmdLED(uint8_t i_led, uint8_t cmd, uint16_t twelve_bit_setting)
Pass a setting to one LED DAC.
Definition: Bias.cxx:110
Class which encapsulates the I2C controller in the Polarfire.
Definition: I2C.h:13
Class representing communication with the Digital-Analog Converter on the HGC ROC.
Definition: Bias.h:26
uint8_t our_addr_
our addr on the chip
Definition: Bias.h:116
void setByDAC(uint8_t i_dac, uint8_t cmd, uint16_t twelve_bit_setting)
set by DAC index
Definition: Bias.cxx:80
std::vector< uint8_t > get(uint8_t cmd, int n_return_bytes=2)
Get the settings for the DACs on this MAX.
Definition: Bias.cxx:24
void set(uint8_t cmd, uint16_t data_bytes)
Write a setting for the DACs on this MAX.
Definition: Bias.cxx:40
MAX5825(I2C &i2c, uint8_t max_addr, int bus=4)
Wrap an I2C class for communicating with the MAX5825.
Definition: Bias.cxx:22
void setRefVoltage(int level)
Set reference voltage 0 - external 1 - 2.5V 2 - 2.048V 3 - 4.096V.
Definition: Bias.cxx:61
I2C & i2c_
our connection
Definition: Bias.h:114
int bus_
our bus
Definition: Bias.h:118
std::vector< uint16_t > getByDAC(uint8_t i_dac, uint8_t cmd)
get by DAC index
Definition: Bias.cxx:66
Polarfire Interaction Library.
Definition: Backend.h:8