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

◆ I2C_to_Parallel_set_PCA9554_outputs_values()

void I2C_to_Parallel_set_PCA9554_outputs_values ( uint8_t  scheda_su_scheda_giu,
uint8_t  select_PCA,
uint8_t  value 
)

The function I2C_to_Parallel_set_PCA9554_outputs_values allow to set the output pin of the I2C to parallel, there are structures for this. The detector: detector_chip_select_bias, the PGA_DAC.

Parameters
[in]scheda_su_scheda_giuone of the 2 boards that the postfrontend manages
[in]select_PCAthe mux to be enabled, 1, 2 or 3
[in]valuethe vlue to be set
Returns
No Parameters
217void I2C_to_Parallel_set_PCA9554_outputs_values( uint8_t scheda_su_scheda_giu, uint8_t select_PCA, uint8_t value ){
218 uint8_t indirizzo= I2C_to_Parallel_address_1; //Indirizzo di default
219 uint8_t comando[]={I2C_to_Parallel_Command_data_to_write, value }, scheda_su_scheda_giu_qui; //All bits set to ouput and to 1
220
221 if ( select_PCA == I2C_to_Parallel_name_2){
222 indirizzo= I2C_to_Parallel_address_2;
223 }else if (select_PCA == I2C_to_Parallel_name_3){
224 indirizzo= I2C_to_Parallel_address_3;
225 }
226
227
228//void I2C_mux_select_ch( uint8_t scheda_su_scheda_giu, uint8_t canale_da_abilitare)
229 I2C_mux_select_ch( scheda_su_scheda_giu, I2C_mainboard, I2C_mux_abilita_3);
230
231 I2C_mux -> MasterTransmit( indirizzo, comando, 2,false); //Set all bits as outputs
232 while( I2C_mux -> GetStatus().busy); // White transmission complete
233
234
236 I2C_mux -> MasterTransmit( indirizzo, comando, 1,true); //Set input register to read
237 while( I2C_mux -> GetStatus().busy); // White transmission complete
239 comando[0]=0;
240 comando[1]=0;
241 I2C_mux -> MasterReceive( indirizzo, comando, 1,false); //Read back, not needed
242 while( I2C_mux -> GetStatus().busy);
244}
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_I2C_to_parallel_PCA9554_0
I2C to parallel conversion ch0.
@ error_address_I2C0
Error register A for I2C0.
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
#define I2C_mux_abilita_3
Enable channel 3.
Definition: I2C_mux.h:28
void I2C_to_Parallel_set_PCA9554_outputs_values(uint8_t scheda_su_scheda_giu, uint8_t select_PCA, uint8_t value)
The function I2C_to_Parallel_set_PCA9554_outputs_values allow to set the output pin of the I2C to par...
#define I2C_to_Parallel_name_3
the third PCA
#define I2C_to_Parallel_Command_read_output
Read output pin, either if they are inputs or outpus.
#define I2C_to_Parallel_address_2
address of the second I2C to parallel
#define I2C_to_Parallel_address_3
address of the third I2C to parallel
#define I2C_to_Parallel_address_1
address of the first I2C to parallel
#define I2C_to_Parallel_name_2
the second PCA
#define I2C_to_Parallel_Command_data_to_write
Data are written in the bits set as output.

Definition at line 217 of file I2C_to_parallel.c.