CROSS Technical Documentation User Manual and Technical Doc.
INFN Milano Bicocca
Loading...
Searching...
No Matches

◆ detector_scrittura_lettura_trimmer_bias()

void detector_scrittura_lettura_trimmer_bias ( uint8_t  scheda_su_scheda_giu,
uint8_t  canale,
uint8_t  trimmer,
uint8_t  valore,
uint8_t  scrivi_1_leggi_0 
)

Setting the value of any trimmer for detector biasing, the contents of the trimmers are stored in the matrix contenuto_trimmer_detector[canale][trimmer]

Parameters
[in]scheda_su_scheda_giuone of the 2 boards that the postfrontend manages
[in]canalethe channel for which we need to manage the trimmer
[in]trimmerthe trimmer to select in the chip, from 0 to 3
[in]valorethe value to be written to.
[in]scrivi_1_leggi_0if 1 we write and read, if 0 we read only and the contenis in the global contenuto_trimmer_detector[canale][trimmer]
Returns
No Parameters
238void detector_scrittura_lettura_trimmer_bias(uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t trimmer, uint8_t valore, uint8_t scrivi_1_leggi_0 ){
239
240 //Attenzione: canale deve essere < 6
241
242 uint8_t spedizione[2]={ ( (trimmer << 5) & maschera_solo_bit_di_scrittura_trimmer), valore}; //The trimmer and what to write
243
244 if( scheda_su_scheda_giu) scheda_su_scheda_giu =6;
245
246
247 I2C_mux_select_ch( scheda_su_scheda_giu, I2C_mainboard, address_detector_bias_trimmer[canale].quale_I2C); //Select the I2C to be used
248
249 if (scrivi_1_leggi_0){
250
251 I2C_mux->MasterTransmit( (uint8_t) address_detector_bias_trimmer[canale].indirizzo_I2C , spedizione, 2,false); //Write to the selected trimmer of the selcted channel
252
253 }else{
254
255 I2C_mux->MasterTransmit( (uint8_t) address_detector_bias_trimmer[canale].indirizzo_I2C , spedizione, 1,false); //set the channel to read only
256 }
257
258 while( I2C_mux->GetStatus().busy){}; // Write transmission complete
260
261 I2C_mux->MasterReceive( address_detector_bias_trimmer[canale].indirizzo_I2C, &tappo, 1,false); //Read back, the trimmer value
262
263 while( I2C_mux->GetStatus().busy){};
264
265 contenuto_trimmer_detector[canale + scheda_su_scheda_giu][trimmer] = tappo; //Tappo is global
266}
volatile uint32_t Error_bad_operation
exploited to mark the errors
void ERROR_codifica_errore(uint8_t scheda_su_scheda_giu, unsigned char error_addres, unsigned char code_to_shift, uint8_t reset_count_se_0)
If an error is found its flag is codified here.
@ I2C_error_trimmer_bias_0
trimmer_bias ch0
@ error_address_I2C1_B
Error register B for I2C1
void I2C_mux_select_ch(uint8_t scheda_su_scheda_giu, uint8_t mainboard_postmainboard, uint8_t canale_da_abilitare)
The I2C mux.
Definition: I2C_mux.c:100
const struct address_detector_bias_trimmer_type address_detector_bias_trimmer[6]
Detector trimmer addresses.
Definition: Trimmer.c:129
uint8_t contenuto_trimmer_detector[12][4]
Content of the trimmer for detector bias system.
Definition: Trimmer.c:161
void detector_scrittura_lettura_trimmer_bias(uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t trimmer, uint8_t valore, uint8_t scrivi_1_leggi_0)
Setting the value of any trimmer for detector biasing, the contents of the trimmers are stored in the...
Definition: Trimmer.c:238
#define maschera_solo_bit_di_scrittura_trimmer
Mask for command of the trimmer.
Definition: Trimmer.h:76

Definition at line 238 of file Trimmer.c.