This function allows to read a whatver regsiter of the ADC.
595 long int risultato=0;
596 uint8_t byte_da_trasmettere_ricevere=2;
597 if(up_down>1)up_down=1;
598 if( (registro_ch0>=5) && (registro_ch0<=0x18) ) byte_da_trasmettere_ricevere=4;
600 uint8_t ii=0,scelta_ADC=ADC_mode_reg_ch0, valore_da_ricevere[4]={0,0,0,0}, registro_lettura=read_from_CH0 ;
610 if (registro_ch0 ==0x38){
611 registro_lettura= registro_ch0 +0x40;
613 registro_lettura= registro_ch0 + ADC_0_o_1*2 +0x40;
617GPIO_PinWrite(ref_locale->porta_num, ref_locale->pin_num, 0);
620 uint8_t istruzione[]={registro_lettura,0,0,0};
621 SPIdrv->Transfer (&istruzione, &valore_da_ricevere ,byte_da_trasmettere_ricevere);
624 uint8_t troppa_attesa=0;
625 while( (SPIdrv->GetStatus().busy) && (troppa_attesa <250) ){
631GPIO_PinWrite(ref_locale->porta_num, ref_locale->pin_num, 1);
632 if( byte_da_trasmettere_ricevere ==4){
633 risultato = (valore_da_ricevere[1]<<16) + (valore_da_ricevere[2]<<8) + (valore_da_ricevere[3]);
635 risultato = (valore_da_ricevere[1]);
uint32_t ADC_lettura_registro(char ADC_0_o_1, uint8_t up_down, uint8_t registro_ch0)
This function allows to read a whatver regsiter of the ADC.
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.
@ error_address_SPI
Error register for SPI.
@ SPI_error_EVENT_DATA_LOST
This is ARM_SPI_EVENT_DATA_LOST.
const porta_pin_def ADC_Chip_Sel_up
Configuration ADC pin.
const porta_pin_def ADC_Chip_Sel_down
Configuration ADC pin.
#define I2C_mux_Scheda_giu
Selection of the I2C1 for lower board (purtroppo \'e contorto)
void Aspetta_tanti_ms(int millisecondi)
The timing function.