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

◆ I2C_to_Parallel_ini_PCA9554()

void I2C_to_Parallel_ini_PCA9554 ( uint8_t  scheda_su_scheda_giu,
uint8_t  select_PCA 
)

The I2C_to_Parallel_ini_PCA9554 inits the I2C_to_Parallel_ini_PCA9554 chips by setting all the outputs high, but the 2 chip select analog muxes, to disable all the chips.

Parameters
[in]scheda_su_scheda_giuone of the 2 boards that the postfrontend manages
[in]select_PCAthe channel in the mux to be enabled, 1, 2 or 3
Returns
No Parameters
170void I2C_to_Parallel_ini_PCA9554( uint8_t scheda_su_scheda_giu, uint8_t select_PCA ){
171 uint8_t indirizzo= I2C_to_Parallel_address_1; //We set the first chip; below we will see if this is true
172 uint8_t impostazione_iniziale_della_porta= I2C_to_Parallel_1_ini_set; //Default setting for first chip is this.
173 uint8_t comando[]={I2C_to_Parallel_Command_configuration_register,0}; //the value of 0 set all bits as ouput and default to 1
174
175 if ( select_PCA == I2C_to_Parallel_name_2){
176 indirizzo= I2C_to_Parallel_address_2;
177 impostazione_iniziale_della_porta=I2C_to_Parallel_2_ini_set;
178 }else if (select_PCA == I2C_to_Parallel_name_3){
179 indirizzo= I2C_to_Parallel_address_3;
180 impostazione_iniziale_della_porta=I2C_to_Parallel_3_ini_set;
181 }
182//void I2C_mux_select_ch( uint8_t scheda_su_scheda_giu, I2C_mainboard,uint8_t canale_da_abilitare)
183 I2C_mux_select_ch( scheda_su_scheda_giu, I2C_mainboard, I2C_mux_abilita_3); //I2C_mux_abilita_3= the i2C connected to the PCA's
184
185 I2C_mux -> MasterTransmit( indirizzo, comando, 2,false); //Set all bits as outputs
186 while( I2C_mux -> GetStatus().busy); // White transmission complete
187
189 comando[1]= impostazione_iniziale_della_porta; //Ouputs all high
190 I2C_mux -> MasterTransmit( indirizzo, comando, 2,false); //setbuf all bits to high
191 while( I2C_mux -> GetStatus().busy); // White transmission complete
192
194 I2C_mux -> MasterTransmit( indirizzo, comando, 1,true); //Set input register to read
195 while( I2C_mux -> GetStatus().busy); // White transmission complete
196 comando[0]=0;
197 comando[1]=0;
198 I2C_mux -> MasterReceive( indirizzo, comando, 1,false); //Read back, not needed
199 while( I2C_mux -> GetStatus().busy);
200 I2C_mux_select_ch( scheda_su_scheda_giu, I2C_mainboard, I2C_mux_disabilita_tutto); //Idle
201}
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_disabilita_tutto
i2C transmission/reception was bad
Definition: I2C_mux.h:24
#define I2C_mux_abilita_3
Enable channel 3.
Definition: I2C_mux.h:28
void I2C_to_Parallel_ini_PCA9554(uint8_t scheda_su_scheda_giu, uint8_t select_PCA)
The I2C_to_Parallel_ini_PCA9554 inits the I2C_to_Parallel_ini_PCA9554 chips by setting all the output...
#define I2C_to_Parallel_name_3
the third PCA
#define I2C_to_Parallel_Command_configuration_register
Configuration register, set to 0 for ouput of the corresponding bit.
#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_2_ini_set
#define I2C_to_Parallel_1_ini_set
#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_3_ini_set
#define I2C_to_Parallel_Command_data_to_write
Data are written in the bits set as output.

Definition at line 170 of file I2C_to_parallel.c.