CROSS Technical Documentation User Manual and Technical Doc.
INFN Milano Bicocca
Loading...
Searching...
No Matches
main_for_CROSS_FrontEnd.c
Go to the documentation of this file.
1
2/*****DOCUMENTAZIONE DOXYGEN (premi il - a sinistra per ridurla a icona) il manuale html \'e nella cartella************/
3/// \file
4
5/*!
6
7\mainpage Introduction
8\brief <span style="color:red;"> The firmware and setup of the PostFrontend board of the CROSS experiment </span>
9
10 @author INFN Milano Bicocca
11 @date Start: November 2020
12<hr width="90%" size="10" align="left">
13
14
15 \tableofcontents
16
17 \b SUMMARY:
18*\arg \ref section0
19*\arg \ref section1
20*\arg \ref subsection2
21
22 \section section0 Information about the creation of this documentation
23 <hr width="90%" size="10" align="left">
24
25 \n This documentation is based on the Doxygen editor. The files used to run Doxygen are in the folder \b "DocumentazionePerDoxygen" which is in the folder of the
26 fw project \b "FW_CROSS_POSTFRONTEND". The repository of all the generated html files are in the sub-folder \b "html".
27 \n The configuration file that must be loaded in \b Doxywizard, the Doxygen compilator to be run, is \b "Doxyfile_CROSS_POSTFRONTEND". There is a file \b "lista_file_cartelle.txt"
28 that must be included at the end of the configuration file by the command \b "@INCLUDE = lista_file_cartelle.txt". This file allow to reduce the list of the processed files.
29 It is useful when we want to run Doxywizard faster. If the latex version of the documentation has to be generated,
30 then the order of the chapters follows the alphabetic order, unless the file order is indicated in INPUT.
31 In this case do not forget to write "../" in front of the project file name.
32
33\remark If the configuration file is saved from the \b Doxywizard the command @INCLUDE =.. or any added command of the form @... are lost and must be re-added at the end of the
34configuration fileopen in text mode.
35
36 \n The layout of this web setup is in \b "Gianlu_layoutdoxy_CROSS_POSTFRONTEND.xml".
37 \n Figures are in the sub-folder: \b "Figure".
38 \n Other files used for web are \b "new_footer_gianlu.html" for "HTML_FOOTER" and \b "doxygen_gianlu.css" for "HTML_STYLESHEET", while for Latex is: \b "new_header_gianlu.tex".
39 Best way to understand the meaning of these 3 files is to open them with a tex editor.
40 \n The \b pdf versione of this documentation is here: <a href="https://pessina.mib.infn.it/CROSS/refman.pdf" target=_blank><b>refman.pdf</b></a>
41
42 \remark After any change it is important to reload the projec file in \b Doxywizard. Sometimes, the modifications are not set
43 if \b Doxywizard is only closed and the re-open.
44
45 \section section1 General description
46 <hr width="90%" size="10" align="left">
47
48\subsection subsection1 General idea
49
50\n The PostFrontEnd board manages the FrontEnd from the detector to the antialiasing/DAQ board. It has an ARM microprocessor with which
51manages 12 channels, or 2 FrontEnd boards (6 channels each) which are located on the frdge. This split is intended for minimizing EMI disturbances close to the detectors.
52Communication from the PostFrontEnd to the FrontEnd is via \b I2C and \b SPI serial buses.
53The ARM microporcessor is a \b LPC1768 from NXP (here its user manual: <a href="./File_pdf/LPC1768_UM10360.pdf" target=_blank><b>LPC1768 UM</b></a>).
54Each element on both the FrontEnd and PostFrontEnd that has logic function has its own dedicated driver (a .c and
55its corresponding .h files), some common drivers (such as spi.c, I2c0.c, ...) are also present.
56\n Communication with the control room is via serial CAN bus, fibre optic based.
57\n There is an instruction set at <a href="_instruction_set.html">Instruction set</a>.
58
59
60 \subsection subsection2 Documentation developed so far
61
62\n This is the list of the parts documented:
63
64- \ref I2C_to_parallel
65- \ref I2C_mux_page
66- \ref Multiplexer_strutture_funzioni_definizioni_page
67- \ref I2C_0_page
68- \ref I2C_1_page
69- \ref Detector_Relays_managing_page
70- \ref Detector_Bias
71- \ref Preamplifier_Offset_Drift_Correcttion_page
72- \ref DAC_PGA_page
73- \ref Trimmer_page
74- \ref SPI_page
75- \ref Preamplifier_Gain_page
76- \ref Thermometer
77- \ref CAN
78- \ref GPIO
79- \ref Timer_
80- \ref Inizializzazione_
81
82
83
84
85
86*/
87
88#include "tutti_gli_header.h"
89
90
91// Definisco due comandi per il can
92int8_t spegnimento[8] = {6,0,0,0,0,0,0,0};
93int8_t accensione[8] = {6,1,0,0,0,0,0,0};
94
95/**************************************************************************************
96Variabili di gianlu
97***************************************************************************************/
98int wait_for_ADC_setting=100; //!< settable from the can
99volatile int8_t vettore_istruzioni[8]; //!< This is a copy of the received 8 bytes from the CAN
100unsigned int FW_version; //!< This is where the FW version is stored
101 long int risultato;
102 bool flag_power_down = false; //!< if flag_power_down is true the u-controller goes in power down after a while
103
104
105
106/**************************************************************************************
107FINE Variabili di gianlu
108***************************************************************************************/
109
110
111//extern ARM_DRIVER_CAN *CANdrv;
112
113/*****************************************************************************
114 Main function
115 *****************************************************************************/
116uint8_t tappo, per_non_ripetere=255;
117
118/*! \brief The main...
119
120 *\param[in,out] no param
121 *\return No Parameters
122 */
123int main (void)
124{
125 uint8_t canale_ ;
126 tappo=100;
127 uint32_t temperatura_in_microK;
128 uint8_t i;
129// LPC_SC->PCONP =0;
130 rx_data[6]=0;
131 instr_inizializza_tutto_da_zero_function(); //Questa va ottimizzata
132
133
136
137 NVIC_SetPriority (SysTick_IRQn, 29); /* set Priority for Systick Interrupt */
138
139
140tx_msg_info.id = ARM_CAN_EXTENDED_ID(0xff); // Viene impostato l'indirizzo esteso per il messaggio trasmesso
141tx_data[0]=1;
142tx_data[1]=2;
143tx_data[2]=3;
144tx_data[3]=4;
145tx_data[4]=5;
146tx_data[5]=6;
147tx_data[6]=7;
148tx_data[7]=8;
150evento_CAN = 5;
151CANdrv->MessageSend(tx_obj_idx, &tx_msg_info, tx_data, 8U);
152uint16_t attesa=0;
153while( (evento_CAN != CAN_EVENT_SEND_COMPLETE) && (attesa < 250) ){
155 attesa++;
156}
157if (attesa >=250) { //Spegnamo il CAN se nessuno lege il messaggio
158 CANdrv->Control(ARM_CAN_ABORT_MESSAGE_SEND, tx_obj_idx);
159 LPC_CAN1->MOD |=1; //Si annullano tutte le possibili azioni pendenti
160 LPC_CAN1->GSR &= ~CAN_GSR_TXERR_Msk; // Azzeriamo gli errori di trasmissione
161 LPC_CAN1->MOD &=~1; //Si riabilita il CAN
162 uint32_t LPC_dummy= LPC_CAN1->ICR;
163}
164
167per_non_ripetere=255;
168 while (1)
169 {
170// if(messaggio_CAN_arrivato==true) // Flag che indica se \'e stato inviato un messaggio dal CAN
171 if ( evento_CAN == ARM_CAN_EVENT_RECEIVE)
172 {
173// Spegni_led_verde();
174// Accendi_led_rosso();
177 for(i=0;i<8;++i)
178 {
180 tx_data[i]= rx_data[i];
181 }
183 tempo=0;
184 evento_CAN=10;
185 if( (per_non_ripetere == vettore_istruzioni[istruzione_codice]) ){
186 per_non_ripetere=255;
187 }else{
188
189 if( (rx_msg_info.id & maschera_togli_bit31)== indirizzo_CAN_della_scheda){
190 LPC_CAN1->IER &= ~CAN_IER_RIE; //Disabilitiamo la ricezione
192 LED_rosso_fondo_scala=LED_corto;
195 per_non_ripetere= vettore_istruzioni[istruzione_codice];
196 per_non_ripetere=255;
199 }else{
200 tx_data[7]= 255; //Errore istruzioini fuori range
201 }
202
203
204 // if( instr_NO_operation == per_non_ripetere) per_non_ripetere=255;
205 tx_msg_info.id = ARM_CAN_EXTENDED_ID(indirizzo_CAN_della_scheda); // Viene impostato l'indirizzo esteso per il messaggio trasmesso
206 CANdrv->MessageSend(tx_obj_idx, &tx_msg_info, tx_data, 8U);
207// while( evento_CAN != CAN_EVENT_SEND_COMPLETE ){}
208// Aspetta_tanti_ms(100);
209 attesa=0;
210 while( (evento_CAN != CAN_EVENT_SEND_COMPLETE) && (attesa < 500) ){
212 attesa++;
213 }
214
215// if (attesa >=500) { //Spegnamo il CAN se nessuno lege il messaggio
216 if (1) { //Spegnamo il CAN se nessuno lege il messaggio
217 CANdrv->Control(ARM_CAN_ABORT_MESSAGE_SEND, tx_obj_idx);
218 LPC_CAN1->MOD |=1; //Si annullano tutte le possibili azioni pendenti
219 LPC_CAN1->GSR &= ~CAN_GSR_TXERR_Msk; // Azzeriamo gli errori di trasmissione
220 LPC_CAN1->MOD &=~1; //Si riabilita il CAN
221 }
222 LPC_CAN1->IER |= CAN_IER_RIE; //abilitiamo la ricezione
223// Spegni_led_rosso();
224// Accendi_led_verde();
225// Aspetta_tanti_ms(10);
229// LED_accendi_spegni(LED_RED, spegni);
230 }else if ( (rx_msg_info.id & maschera_togli_bit31) == indirizzo_generico_CAN){
231 LPC_CAN1->IER &= ~CAN_IER_RIE; //Disabilitiamo la ricezione
233
236 }else{
237 tx_data[7]= 255; //Errore istruzioini fuori range
238 }
239 per_non_ripetere= vettore_istruzioni[istruzione_codice];
240 per_non_ripetere=255;
241 tx_msg_info.id = ARM_CAN_EXTENDED_ID(indirizzo_CAN_della_scheda); // Viene impostato l'indirizzo esteso per il messaggio trasmesso
242 CANdrv->MessageSend(tx_obj_idx, &tx_msg_info, tx_data, 8U);
243 attesa=0;
244 per_non_ripetere= vettore_istruzioni[istruzione_codice];
245 while( (evento_CAN != CAN_EVENT_SEND_COMPLETE) && (attesa < 500) ){
247 attesa++;
248 }
249
250 if (1) { //Spegnamo il CAN se nessuno lege il messaggio
251 CANdrv->Control(ARM_CAN_ABORT_MESSAGE_SEND, tx_obj_idx);
252 LPC_CAN1->MOD |=1; //Si annullano tutte le possibili azioni pendenti
253 LPC_CAN1->GSR &= ~CAN_GSR_TXERR_Msk; // Azzeriamo gli errori di trasmissione
254 LPC_CAN1->MOD &=~1; //Si riabilita il CAN
255 }
260 LPC_CAN1->IER |= CAN_IER_RIE; //Abilitiamo la ricezione
261 }
262 }
263
267 }
268 //else{
269 {
270/*!
271
272 */
273//! <!-- [fun_power_down_main] -->
274 //COMANDI PER IL POWER_DOWN
275 if (POWER_DOWN_TEMPO_ATTESA >= POWER_DOWN_MAX_ATTESA) // Viene incrementato tempo finch\'e non arriva a quel valore
276 {
277 per_non_ripetere = 255;
279 if((flag_power_down == true) && POWER_DOWN_ABILITA_CONTEGGIO) // Se il flag \'e true, viene attivata la modalit\'a Power Down
280 {
281 // Il micro entra nella modalit\'a Power-down
282 // POWER_DOWN_ABILITA_CONTEGGIO=0;
287// Pwd_Paolo();
288 }
289 }
290//! <!-- [fun_power_down_main] -->
291 }
292 }
293
294
295//preamplifier_set_reset_pre_gain ( scheda_su_scheda_giu_provvisorio, canale5, preamplifier_Gain_basso );
296
297//preamplifier_set_reset_pre_gain ( scheda_su_scheda_giu_provvisorio, canale6, preamplifier_Gain_basso );
298
299
300//preamplifier_set_reset_pre_gain ( scheda_su_scheda_giu_provvisorio, canale5, preamplifier_Gain_alto );
301
302
303//preamplifier_set_reset_pre_gain ( scheda_su_scheda_giu_provvisorio, canale6, preamplifier_Gain_alto );
304
305//PGA_GAIN( 0, 4 , 2);
306
307//PGA_GAIN( 0, 4 , 4);
308
309//PGA_GAIN( 0, 5 , 2);
310
311//PGA_GAIN( 0, 5 , 4);
312//
313// for( canale_=4; canale_ <6; canale_ ++ ){
314// for( trimmer_=0; trimmer_ <4; trimmer_ ++ ){
315////void preamplifier_scrittura_lettura_trimmer(uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t trimmer, uint8_t valore, uint8_t scrivi_leggi_1_leggi_0 )
316// preamplifier_scrittura_lettura_trimmer( 0, canale_, trimmer_, 132, 1 );
317// }
318//}
319
320//Connettiamo i pre a GND
321// for( canale_=0; canale_ <6; canale_ ++ ){
322// Relays_driver_set_reset_channel( canale_ , Detector_prea_to_GND);
323// }
324 while(1);
325
326//
327//
328////INIZIALIZZAZIONE PARTE QUI
329//
330//// unsigned char dati_letti[4];
331//// FW_version = __INT_DATE__;
332// //Definizione puntatore sitruzioni
333// Setting_of_the_pointer_for_command_parser ( );
334//// Configurazione del LED
335// Configure_Led_rosso(); // Viene configurato il Led rosso
336// Configure_Led_verde(); // Viene configurato il Led verde
337// Accendi_led_verde(); // Viene acceso il Led verde
338
339
340//// Configurazione del Timer
341// SystemCoreClockUpdate(); // Viene aggiornato il system core clock
342// SysTick_Config(SystemCoreClock/1000); // Viene generato l'interrupt ogni 1 ms
343
344//// Configurazione delle Periferiche
345// Configure_Bit_Address_for_CAN();
346// CAN_Inizialize(); // Viene inizializzata la periferica CAN
347// SPI_Inizialize(); // Viene inizializzata la periferica SPI
348// I2C_1_Initialize(); // Viene inizializzata la periferica I2C_A
349// I2C_0_Initialize(); // Viene inizializzata la periferica I2C_B
350// I2C_termometro_Initialize(); // Viene inizializzata la periferica I2C_termometro_Inizialize
351//
352//// importa_le_costanti_dalla_memoria();
353//
354//// CHIP SELECTOR per i multiplexer
355// Configure_Chip_Sel(); // Vengono configurati i pin del Chip Selector per i multiplexer
356// Configure_Sel_Par_Interruttori(); // Vengono configurati i pin del Sel Par Interruttori per i multiplexer
357//// Abbassa_chip_selector_multiplexer(); // Vengono abbassati tutti i pin dei quattro chip selector dei multiplexer
358//// ADC READY
359// Configure_Adc_Ready(); // Viene configurato l'ADC READY
360// GPIO_PinWrite(1, Adc_ready, 0); // Viene abbassato l'ADC READY
361//// CHIP SELECTOR dell'ADC
362// Configure_Chip_Sel_ADC(); // Viene configurato il Chip Sel dell'ADC
363// GPIO_PinWrite(0, Chip_Sel_Adc, 1); // Viene alzato il Chip_Sel_Adc
364//// CHIP SELECTOR RELE del canale 0
365// Configure_Chip_Sel_rele_ch0(); // Vengono configurati i pin del Chip Selector dei rel\'e del canale 0
366// GPIO_PinWrite(0, Chip_Sel_rele_0, 1); // Viene alzato il Chip Sel rele del canale 0
367//// RESET e SET canale 0
368// Configure_Reset_ch0(); // Vengono configurati i pin del Reset per i rel\'e del canale 0
369// Configure_Set_ch0(); // Vengono configurati i pin del Set per i rel\'e del canale 0
370// GPIO_PinWrite(1, Set_ch0, 1); // Impostando il set a 1 non vengono abbassati tutti gli interruttori
371// GPIO_PinWrite(1, Reset_ch0 ,1); // Viene impostato il Reset a 1, in questo modo non \'e pi\'u 0
372//// CHIP SELECTOR RELE del canale 1
373// Configure_Chip_Sel_rele_ch1(); // Vengono configurati i pin del Chip Selector dei rel\'e del canale 1
374// GPIO_PinWrite(0, Chip_Sel_rele_1, 1); // Viene alzato il Chip Sel rele del canale 1
375//// RESET E SET canale 1
376// Configure_Reset_ch1(); // Vengono configurati i pin del Reset per i rel\'e del canale 1
377// Configure_Set_ch1(); // Vengono configurati i pin del Set per i rel\'e del canale 1
378// GPIO_PinWrite(1, Set_ch1, 1); // Impostando il set a 1 non vengono abbassati tutti gli interruttori
379// GPIO_PinWrite(1, Reset_ch1 ,1); // Viene impostato il Reset a 1, in questo modo non \'e pi\'u 0
380//// CHIP SELECTOR DAC del canale 0
381// Configure_PGA_Chip_Sel_DAC_ch0(); // Vengono configurati i pin del Chip Selector del DAC del canale 0
382// GPIO_PinWrite(0, PGA_Chip_Sel_DAC_ch0, 1); // Viene alzato il Chip Sel del DAC del canale 0
383//// CHIP SELECTOR DAC del canale 1
384// Configure_PGA_Chip_Sel_DAC_ch1(); // Vengono configurati i pin del Chip Selector del DAC del canale 1
385// GPIO_PinWrite(0, PGA_Chip_Sel_DAC_ch1, 1); // Viene alzato il Chip Sel del DAC del canale 1
386//// RELE K2
387// Configure_PGA_rele_ch0_1(); // Vengono configurati i pin del PGA_rele_canale 0 numero 1
388// GPIO_PinWrite(1, PGA_rele_ch0_1, 0); // Viene abbassato il PGA_rele_canale 0 numero 1
389// Configure_PGA_rele_ch0_2(); // Vengono configurati i pin del PGA_rele_canale 0 numero 2
390// GPIO_PinWrite(1, PGA_rele_ch0_2, 0); // Viene abbassato il PGA_rele_canale 0 numero 2
391//// RELE K3
392// Configure_PGA_rele_ch1_1(); // Vengono configurati i pin del PGA_rele_canale 1 numero 1
393// GPIO_PinWrite(1, PGA_rele_ch1_1, 0); // Viene abbassato il PGA_rele_canale 1 numero 1
394// Configure_PGA_rele_ch1_2(); // Vengono configurati i pin del PGA_rele_canale 1 numero 2
395// GPIO_PinWrite(1, PGA_rele_ch1_2, 0); // Viene abbassato il PGA_rele_canale 1 numero 2
396//// TRIMMER canale 0 e canale 1 del Preamplificatore
397// Imposta_wiper_a_meta_scala_canale_0_I2CA(); // Vengono impostati i wiper a met\'a scala dei trimmer del preamplificatore del canale 0
398// Imposta_wiper_a_meta_scala_canale_1_I2CA(); // Vengono impostati i wiper a met\'a scala dei trimmer del preamplificatore del canale 1
399//// Trimmer del Rivelatore
400// Imposta_wiper_a_meta_scala_canale_0_I2CB(); // Vengono impostati i wiper a met\'a scala dei trimmer del rivelatore del canale 0
401// Imposta_wiper_a_meta_scala_canale_1_I2CB(); // Vengono impostati i wiper a met\'a scala dei trimmer del rivelatore del canale 1
402////Configurazione pin per alimentazione // Vengono configurati i Pin dell'alimentazione analogica
403// Configure_Pin_Alimentazione();
404/////*********************************************************************************************************************************/
405
406////Spengo e riaccendo. cos\'i resetto tutto
407//Spegni_led_verde();
408// Accendi_led_rosso();
409//// Esegui_istruzione(spegnimento);
410// Spegnimento_delle_alimentazioni_analogiche();
411// Aspetta_tanti_ms(500);
412//// Esegui_istruzione(accensione);
413// Accensione_delle_alimentazioni_analogiche();
414// Spegni_led_rosso();
415// Accendi_led_verde();
416// calibrazione_Resistenze_sterne_ADC();
417
418///* Inizializzazione canali */
419////Da completare con offset iniziale, per ora metto a met\'a scala
420//char ii;
421//for (ii =0; ii<2;ii++){
422// //preamplifier offset half scale
423//// Trimmer_offset_preampli[ii].coarse_offset = 0x80;
424// Trimmer_offset_preampli[ii].fine_offset =0x80;
425// Imposta_canale_del_trimmer_ennesimo_al_valore_I2CA (ii, preampli_fine_offset_trimmer, 0x80);
426//// Imposta_canale_del_trimmer_ennesimo_al_valore_I2CA (ii, preampli_corse_offset_trimmer, 0x80);
427//
428// //Carichiamo l'offset a zero V
429// unsigned char dati_letti[4];
430//// lettura_EPROM(ii, Memory_address_JFET_trimmer_offset , dati_letti);
431// Trimmer_offset_preampli[ii].JFET_Offset= dati_letti[0];
432// Imposta_canale_del_trimmer_ennesimo_al_valore_I2CA (ii, preampli_JFET_Offset_trimmer, Trimmer_offset_preampli[ii].JFET_Offset);
433// Trimmer_offset_preampli[ii].coarse_offset= dati_letti[1];
434// Imposta_canale_del_trimmer_ennesimo_al_valore_I2CA (ii, preampli_corse_offset_trimmer, Trimmer_offset_preampli[ii].coarse_offset);
435////
436//
437// //Trimmer thermal a met\'a scala
438// Trimmer_offset_preampli[ii].coarse_thermal =0x80;
439// //detector bias half scale
440// Imposta_canale_del_trimmer_ennesimo_al_valore_I2CB (ii, trimmer_bias_coarse_pos, 0x80); // Viene fatta una misura con entrambi i trimmer a met\'a scala per ricavare l'offset
441// detector_Trimmer_bias[ii].coarse_pos=0x80;
442// detector_Trimmer_bias[ii].fine_pos=0x80;
443// Imposta_canale_del_trimmer_ennesimo_al_valore_I2CB (ii, trimmer_bias_fine_pos, 0x80);
444// Imposta_canale_del_trimmer_ennesimo_al_valore_I2CB (ii, trimmer_bias_coarse_neg, 0x80); // Viene fatta una misura con entrambi i trimmer a met\'a scala per ricavare l'offset
445// detector_Trimmer_bias[ii].coarse_neg=0x80;
446// detector_Trimmer_bias[ii].fine_neg=0x80;
447// Imposta_canale_del_trimmer_ennesimo_al_valore_I2CB (ii, trimmer_bias_fine_neg , 0x80);
448//}
449////Preamplifiers to GND
450////vettore_istruzioni[istruzione_byte_4_e_scelta_canale]=Detector_prea_to_GND_ch0;
451////Detector_PGA_Rele(Detector_prea_to_GND_ch0);
452////vettore_istruzioni[istruzione_byte_4_e_scelta_canale]=Detector_prea_to_GND_ch1;
453////Detector_PGA_Rele(Detector_prea_to_GND_ch1);
454////Rele PGA gain=1
455////vettore_istruzioni[istruzione_byte_4_e_scelta_canale]=PGA_pre_gain_1_ch0_code;
456////Detector_PGA_Rele();
457////Detector_PGA_Rele(PGA_pre_gain_1_ch0_code);
458////vettore_istruzioni[istruzione_byte_4_e_scelta_canale]=PGA_pre_gain_1_ch1_code;
459////Detector_PGA_Rele();
460////Detector_PGA_Rele(PGA_pre_gain_1_ch1_code);
461////PGA gain =1
462////vettore_istruzioni[byte_istr_dati_0]=0;
463////vettore_istruzioni[byte_istr_dati_1]=0;
464////vettore_istruzioni[istruzione_byte_4_e_scelta_canale]=3;
465////instruction_for_PGA_GAIN_set();
466//PGA_GAIN_set(3, 1);
467
468///* FINE Inizializzazione canali */
469////INIZIALIZZAZIONE FINISCE QUI
470
471}
@ The_total_number_of_instrucions
This is the total numebr of instructions, not an instruction.
uint8_t tx_data[8]
Transmission data vector.
Definition: Can.c:321
uint32_t volatile evento_CAN
This is the variable which resembles the flags from the communication.
Definition: Can.c:326
uint32_t tx_obj_idx
This is the variable which resembles the flags from the communication.
Definition: Can.c:323
unsigned int indirizzo_CAN_della_scheda
Per ora lo assegnamo cos\i l'indirizzo della scheda.
Definition: Can.c:335
bool messaggio_CAN_arrivato
This variable is set to true as soon as a reception have been concluded.
Definition: Can.c:328
volatile uint8_t rx_data[8]
Received data vector.
Definition: Can.c:318
ARM_DRIVER_CAN * CANdrv
Definition: Can.c:333
bool messaggio_CAN_spedito
This variable is set to true as soon as a transmission have been concluded.
Definition: Can.c:329
#define indirizzo_generico_CAN
snippetlineno Can.h var_indirizzo_generico_CAN
Definition: Can.h:13
void(* ptr_istruzioni[The_total_number_of_instrucions])(void)
This is the pointer array to the instructions set: the byte istruzione_codice of the CAN message is t...
Definition: Istruzioni.c:24
#define istruzione_codice
Definition: Istruzioni.h:19
void LED_remote_ON_OFF(void)
LEDs can be set ON/OFF from remote.
Definition: Led.c:161
void LED_accendi_spegni(uint8_t LED, uint8_t accendi_1_spegni_0)
This function turns ON or OFF any of the selcted LED.
Definition: Led.c:123
volatile uint8_t LED_rosso_attivo
Definition: Led.c:57
volatile uint16_t LED_rosso_fondo_scala
Definition: Led.c:56
volatile uint8_t LED_verde_attivo
Definition: Led.c:61
#define LED_RED
Definition: Led.h:10
#define spegni
Definition: Led.h:13
#define LED_GREEN
Definition: Led.h:11
#define accendi
Definition: Led.h:12
volatile uint32_t POWER_DOWN_MAX_ATTESA
upper limit for POWER_DOWN_TEMPO_ATTESA
Definition: Power_down.c:118
volatile uint32_t POWER_DOWN_ABILITA_CONTEGGIO
Power down couter and anable is set if this variable is true.
Definition: Power_down.c:120
void PowerControl_PowerDown(void)
Power down managing function.
Definition: Power_down.c:274
volatile uint32_t POWER_DOWN_TEMPO_ATTESA
Counter to wait for power down, multiple of 10 ms.
Definition: Power_down.c:116
void Aspetta_tanti_ms(int millisecondi)
The timing function.
Definition: Timer.c:52
void instr_inizializza_tutto_da_zero_function(void)
Start-up function.
int wait_for_ADC_setting
settable from the can
bool flag_power_down
if flag_power_down is true the u-controller goes in power down after a while
int main(void)
The main...
volatile int8_t vettore_istruzioni[8]
This is a copy of the received 8 bytes from the CAN.
unsigned int FW_version
This is where the FW version is stored.