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

◆ preamplifier_scrittura_lettura_trimmer()

void preamplifier_scrittura_lettura_trimmer ( 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 preamplifier trimmer, the contents of the trimmers are stored in the matrix contenuto_trimmer_preamplifier[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
283void preamplifier_scrittura_lettura_trimmer(uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t trimmer, \
284 uint8_t valore, uint8_t scrivi_1_leggi_0 ){
285
286 if( scheda_su_scheda_giu >=1) scheda_su_scheda_giu=6;
287
288 uint8_t spedizione[2]={ ( (trimmer << 5) & maschera_solo_bit_di_scrittura_trimmer), valore}; //The trimmer and what to write
289
290 I2C_mux_select_ch( scheda_su_scheda_giu, I2C_mainboard, address_preamplifier_trimmer[canale].quale_I2C); //Select the I2C to be used
291
292 if (scrivi_1_leggi_0){
293
294 I2C_mux->MasterTransmit( (uint8_t) address_preamplifier_trimmer[canale].indirizzo_I2C , spedizione, 2,false); //Write to the selected trimmer of the selcted channel
295
296 }else{
297
298 I2C_mux->MasterTransmit( (uint8_t) address_preamplifier_trimmer[canale].indirizzo_I2C , spedizione, 1,false); //set the channel to read only
299 }
300
301 while( I2C_mux->GetStatus().busy){}; // Write transmission complete
302
303 I2C_mux->MasterReceive( address_preamplifier_trimmer[canale].indirizzo_I2C, &tappo, 1,false); //Read back, the trimmer value
304
305 while( I2C_mux->GetStatus().busy){};
307
308 contenuto_trimmer_preamplifier[canale + scheda_su_scheda_giu][trimmer] = tappo;
309}
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_termometro_0
termometro 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_preamplifier_trimmer[6]
Preamplifier trimmer addresses
Definition: Trimmer.c:139
uint8_t volatile contenuto_trimmer_preamplifier[12][4]
Definition: Trimmer.c:179
void preamplifier_scrittura_lettura_trimmer(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 preamplifier trimmer, the contents of the trimmers are stored in...
Definition: Trimmer.c:283
#define maschera_solo_bit_di_scrittura_trimmer
Mask for command of the trimmer.
Definition: Trimmer.h:76

Definition at line 283 of file Trimmer.c.