Essai ds3132
essai-ds3231.cpp
- Committer:
- RCMISbed
- Date:
- 2018-10-17
- Revision:
- 0:13c98588f2fc
File content as of revision 0:13c98588f2fc:
#include "mbed.h"
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "objet.h"
#include "ds3231.h"
using namespace std;
//0- Definition/ Parametres/ Configuration/ Materiel
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
string target = "STM32F303";
DigitalIn SW0(PB_5); // Digitale/ In/ SWITCH
DigitalIn SW1(PA_7) ; // Digitale/ In/ SWITCH
DigitalIn SW2(PB_0); // Digitale/ In/ SWITCH
DigitalIn SW3(PA_8); // Digitale/ In/ SWITCH
DigitalOut RXLED(PB_3); // Digitale/ Out/ lumineux/ Led Verte Intégrée
DigitalOut BLED(PA_4); // Digitale/ Out/ lumineux/ Led Bleu
DigitalOut GLED(PA_3); // Digitale/ Out/ lumineux/ Led Verte
DigitalOut RLED(PF_1); // Digitale/ Out/ lumineux/ Led Rouge
DigitalOut SOUND(PB_4); // Digitale/ Out/ Son
AnalogIn padX(PA_0); //Analogique/ pad/ voie X
AnalogIn padY(PA_1); //Analogique/ pad/ voie Y
Serial usb(USBTX, USBRX); // Liaison UART/ Dispositif USB
Serial uart(PA_9, PA_10); // Liaison UART/ Dispositif UART
I2C i2c (PB_7, PB_6); // Liaison I2C/ Dispositif Afficheur
//CAN bCAN(p30, p29); // Liaison CAN/ Dispositif Communication Inter Systeme
//1- Definition/ Constantes Programme
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define vDEBUG true // Validation Mode DEBUG
#define vACC false // Validation Accelero
#define vSON true // Validation SON
// Definition/ Constantes/ Generale
#define ON false
#define OFF true
// Definition/ Constantes/ Caracteres Alphanumeriques ASCII
#define LF 10 // Line Feed \n
#define CR 13 // Carriage Return \r
#define BS 127 // Back Space
//Definition/ Constantes Orientation
#define bARRET 0
#define bGAUCHE 1
#define bDROITE 2
#define bAVANT 3
// Definition/ Constantes KEYBOARD
#define noKEY 0 // Clavier/ no KEY
#define lKEY 1 // Clavier/ left KEY
#define mKEY 2 // Clavier/ middle KEY
#define rKEY 4 // Clavier/ right KEY
#define razKEY 64 // Clavier/ az KEY
// Definition/ Affichage/ OLED
#define oled_addr 0x78
// Definition/ Identification/ produit
#define productName "Controleur Distant/ bluetooth"
#define versionName "v1.3"
// Definition/ Identification/ PAD
#define padName "Joystick Analogique"
#define padNbAxe 2 // PAD/ Nb Axe MAX
#define padNbSW 3 // PAD/ Nb SW
#define XAxeName "Roulis"
#define YAxeName "Tangage"
// Definition/ Identification/ TRAME
#define wdtTXMAX 100 // Watchdog Emission Trame MAX (periode)
#define wdtRXMAX 1000 // Watchdog Reception Trame MAX
// Definition/ ADC/ Dynamique Signal
#define Adcm 0 // Convertisseur ADC/ Valeur Min
#define AdcM 1023 // Convertisseur ADC/ Valeur Max
#define Adc0 512 // Convertisseur ADC/ Valeur Mediane
// Definition/ PAD/ Dynamique variable
#define Dynm -1000 // Dynamique signal/ Valeur Min
#define DynM 1000 // Dynamique signal/ Valeur Max
#define Dyn0 0 // Dynamique signal/ Valeur Moyenne
// Definition/ PAD/ nombre max géré
#define nbAxesMAX 2
// Definition/ PAD/ parametres loi de pilotage
#define dzmin 0 // Dead Zone/ valeur minimale
#define dzMAX 100 // Dead Zone/ valeur Maximale
#define znlmin 0 // Zone Non Linearite/ valeur minimale
#define znlMax 100 // Zone Non Linearite/ valeur Maximale
#define ctfmin 0.05 // Kpmin: Gain min poportionnel
#define ctfMAX 5 // KpMax: Gain Max poportionnel
#define ctimin 0.0003 // KiMax: Gain Max integral (Constante de temps Integration Max)
#define ctiMAX 0.003 // KiMax: Gain Max integral (Constante de temps Integration Max)
#define CtR 0.00003 // Constante de temps filtrage commande (filtre passe bas)
//Definition/ Constantes temporelles
#define TSample 0.01 // Periode Echantillonnage Process ( 10 ms )
#define secWDTMAX 1/ TSample // Watchdog Seconde
#define wledWDTMAX 30 // Watchdog MAX/ Led WIFI
#define ledWDTMAX 100 // Watchdog MAX/ Led
#define sonWDTMAX 500 // Watchdog MAX/ signal sonore
#define imuWDTMAX 10 // Watchdog MAX/ process IMU
#define trameWDTMAX 300 // Watchdog MAX/ Duree de vie de la Trame
#define keyWDTMAX 50 // Watchdog MAX/ Durée de vie info touche sur trame
// Definition/ Constantes materiel communication
#define usbBR 115200 // Communication/ port Serie/ UART USB Baut Rate
#define uartBR 9600 // Communication/ port Serie/ UART Baut Rate (Bluetooth)
#define i2cBR 400000 // Communication/ port Serie/ frequence bus I2C
// Definition/ Parametres Protocole Trame
#define idNULL 0
#define idMOBILE 120
#define idMOBILE1 122
#define idMOTOR 123
#define idBALANCE 543
#define idIMU 888
//2- Definition/ Type de donnees
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Voir fichier: objet.h
//3- Definition/ Variables Globales
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int16_t periode= 10;
int16_t wledWDT = 0;
int16_t rxledWDT = 0;
int16_t rledWDT = 0;
int16_t gledWDT = 0;
int16_t bledWDT = 0;
int16_t secWDT = secWDTMAX;
int16_t sonWDT = 0;
int16_t sw0WDT = 0;
int16_t sw1WDT = 0;
int16_t sw2WDT = 0;
int16_t sw3WDT = 0;
int16_t sw0MASK = 0;
int16_t sw1MASK = 0;
int16_t sw2MASK = 0;
int16_t sw3MASK = 0;
int16_t sw = 0;
int16_t pTX = 0;
int16_t pRX = 0;
int16_t op[10];
bool fINPUT = true;
int heure = 0;
int minute = 0;
int seconde = 0;
time_t epoch_time;
bool fSB = false;
bool fEB = false;
char startB = '$';
char dlB = ',';
char endB = '*';
char rx[wBUFFER];
int pcar = 0;
int pUSBRx = 0;
int pUSBTx = 0;
string sUSBRx = " ";
Ds3231 rtc(PB_7, PB_6);
PAD_t pad;
TRAME_t trame;
Ticker process;
long int nbTRM = 0;
//4- Definition/ Macro
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define RX_LED_OFF RXLED = 0;
#define RX_LED_ON RXLED = 1;
#define R_LED_OFF RLED = 1;
#define R_LED_ON RLED = 0;
#define G_LED_OFF GLED = 1;
#define G_LED_ON GLED = 0;
#define B_LED_OFF BLED = 1;
#define B_LED_ON BLED = 0;
#define SON_OFF SOUND = 0;
#define SON_ON SOUND = 1;
//5- Definition/ Procedures
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//5.1- Definition/ Procedure/ Reception UART USB (interruption)
void rx_usb_isr(){
char car;
int count = 0;
car= usb.getc();
switch((int)car){
case 97: //Touche 'a'
break;
case 122: //Touche 'z'
break;
case BS://Touche 'Back Space'
if(sUSBRx.length()> 0){
sUSBRx.erase(sUSBRx.length()-1,1);
while(count< sUSBRx.length()){usb.printf(" ");++count;};
usb.printf("\r%s",sUSBRx);
};
break;
case LF: // Touche Line Feed '\n'
break;
case CR: //Touche Carriage Return '\r'
sUSBRx+= "\r\n";
usb.printf("\r\n");
sUSBRx= "";
break;
default: //Touche Caractere ASCII
sUSBRx+= car;
usb.printf("%c",car);
break;
}; // fin switch((int)car){
}
//5.2- Definition/ Procedure/ Reception UART BT (interruption)
void rx_uart_isr(){
// __disable_irq();
char RxCar;
char stB;
string str;
int identifier;
RxCar= uart.getc();
// if(vDEBUG == true){ usb.printf("%c",RxCar); }; // DEBUG/ USB
// bledWDT= 3;
if((RxCar== startB )&& (fEB== false)){pcar= 0; fSB = true; fEB= false;}; // Synchronisation Trame (Start Beacon)
if(fSB== true){rx[pcar]= RxCar; ++pcar;};
if((RxCar== endB )&& (fSB== true)){fEB= true;};
if(pcar>= wBUFFER){fSB= false; fEB= false; pcar= 0;};
if((fSB== true)&& (fEB== true)){ // Synchronisation OK
fSB= false; fEB= false;
// usb.printf("%s\r\n", rx);
sscanf(rx,"%c,%i",&stB, &identifier);
switch(identifier){
case idMOBILE: // Trame idMOBILE
trame.wdtRX = 100;
sscanf(rx,"%c,%i,%i,%i,%i,%i,%i,%c",&trame.sb, &trame.r[0], &trame.r[1], &trame.r[2], &trame.r[3], &trame.r[4], &trame.r[5], &trame.eb); // Réception Données Trame
usb.printf("Rx from MOBILE : %s %s\r\n", rx, ctime(&epoch_time));
switch(trame.r[3]){ // Traitement rMODE
case mSTP: // mode STOP
bledWDT= 30; gledWDT= 0; rledWDT= 0;
break;
case mMAN: // mode MANUEL
bledWDT= 0; gledWDT= 30; rledWDT= 0;
break;
case mPA : // mode PA
bledWDT= 0; gledWDT= 0; rledWDT= 30;
break;
default :break;
}; // fin switch(trame.r[3]){
rxledWDT= 3;
break;
default : break;
}; // fin switch(identifier){
}; // fin if((fSRx== true)&& (fERx== true)){
// __enable_irq();
}
//5.3- Definition/ Procedure/ Process (interruption)
void process_isr(){
float aP, aI;
int ctn;
int8_t key;
// --ledWDT; if(ledWDT<= 0){ledWDT= ledWDTMAX; RX_LED_OFF; SON_OFF;}; if(ledWDT< 5){RX_LED_ON; SON_ON;};
--sw0WDT; if(sw0WDT<= 0){sw0WDT= 0;}; // wdt SW0
--sw1WDT; if(sw1WDT<= 0){sw1WDT= 0;}; // wdt SW1
--sw2WDT; if(sw2WDT<= 0){sw2WDT= 0;}; // wdt SW2
--sw3WDT; if(sw3WDT<= 0){sw3WDT= 0;}; // wdt SW3
--rxledWDT; if(rxledWDT<= 0){rxledWDT= 0; RX_LED_OFF;}else{RX_LED_ON;}; // wdt LED INTEGREE
--rledWDT; if(rledWDT<= 0){rledWDT= 0; R_LED_OFF;}else{R_LED_ON;}; // wdt LED ROUGE
--gledWDT; if(gledWDT<= 0){gledWDT= 0; G_LED_OFF;}else{G_LED_ON;}; // wdt LED VERTE
--bledWDT; if(bledWDT<= 0){bledWDT= 0; B_LED_OFF;}else{B_LED_ON;}; // wdt LED VERTE
--sonWDT; if(sonWDT<= 0){sonWDT= 0; SON_OFF;}else{SON_ON;}; // wdt son
--trame.wdtTX; if(trame.wdtTX < 0) {trame.wdtTX = 0;}; // wdt TX TRAME (periode emission)
--trame.wdtRX; if(trame.wdtRX <= 0) {trame.wdtRX = 0; ;}; // wdt RX TRAME
if(trame.wdtRX == 1 ) {ctn= wBUFFER- 1;
while(ctn>= 0){trame.rx[ctn]= '+'; --ctn;};
ctn= wBUFFER- 3; trame.rx[ctn]= '\r';
ctn= wBUFFER- 2; trame.rx[ctn]= '\n';
sonWDT= 25;
};
--secWDT; if(secWDT<= 0){secWDT= 0;}; // wdt Seconde
// a- Process/ Gestion CLAVIER
key = noKEY;
if(SW1== 1){key= lKEY;}; // appui touche RIGHT
if(SW2== 1){key= mKEY;}; // appui touche MIDDLE
if(SW3== 1){key= rKEY;}; // appui touche LEFT
if(SW0== 0){key= razKEY;}; // appui touche RAZ (touche inversée)
// b- Process/ Gestion LED
switch(key){
case lKEY : if(fINPUT== true){sonWDT= 3; sw1WDT= keyWDTMAX ; bledWDT= 10; fINPUT= false;}; break;
case mKEY : if(fINPUT== true){sonWDT= 3; sw2WDT= keyWDTMAX ; gledWDT= 10; fINPUT= false;}; break;
case rKEY : if(fINPUT== true){sonWDT= 3; sw3WDT= keyWDTMAX ; rledWDT= 10; fINPUT= false;}; break;
case razKEY : if(fINPUT== true){sonWDT= 3; sw0WDT= keyWDTMAX ;
bledWDT= 5; gledWDT= 5; rledWDT= 5; fINPUT= false;}; break;
case noKEY : fINPUT= true; break;
default : break;
};
// c- Process/ Gestion PAD
// c.1- Process/ Gestion PAD/ SW
ctn= 0;
while(ctn<= padNbSW){
switch(ctn){
case 0: // Gestion SW(0]: RAZ loi
pad.sw[0].value= OFF; if(key== razKEY){pad.sw[0].value= ON;};
if(pad.sw[0].value== ON){
pad.axe[1].in= Dyn0; pad.axe[1].i0= Dyn0; pad.axe[1].i= 0; pad.axe[1].out= 0;
pad.axe[0].in= Dyn0; pad.axe[0].i0= Dyn0; pad.axe[0].i= 0; pad.axe[0].out= 0;
};
break;
case 1: // Gestion SW(1]
break;
case 2: // Gestion SW(2]
break;
case 3: // Gestion SW(3]
break;
case 4: // Gestion SW(4]
break;
default:break;
};
++ctn;
}; // fin while(ctn<= padNbSW){
// c.2- Process/ Gestion SW
sw= mSTB;
if(sw0WDT> 0){sw= mRAZ;};
if(sw1WDT> 0){sw= mSTP;};
if(sw2WDT> 0){sw= mMAN;};
if(sw3WDT> 0){sw= mPA; };
// c.2- Process/ Gestion PAD
// c.2- Process/ Gestion PAD/ axe 1
pad.axe[0].out = 2*padX- 1;
if(pad.axe[0].out< -1){pad.axe[0].out= -1;};
if(pad.axe[0].out> 1){pad.axe[0].out= 1;};
// c.2.3- Process/ Gestion PAD/ axe Tangage
pad.axe[1].out = 2*padY- 1;
if(pad.axe[1].out< -1){pad.axe[1].out= -1;};
if(pad.axe[1].out> 1){pad.axe[1].out= 1;};
--periode;
if(periode<= 0){
sprintf(trame.tx,"%c,%d,%d,%d,%d,%d,%d,%c %d \r\n", startB, trame.id, (int)(DynM* pad.axe[1].out), (int)(DynM* pad.axe[0].out), sw, 0, 0, endB, epoch_time);
uart.printf("%s",trame.tx);
// usb.printf("Tx to MOBILE : %s",trame.tx);
periode= 10;
};
}
//5.4- Definition/ Procedures/ Initialisation
int InitProcess(void){
int cmpt= 0, ctn= 0, status= 0;
pTX= 0;
RX_LED_OFF;
R_LED_OFF;
G_LED_OFF;
B_LED_OFF;
SON_OFF;
usb.printf("\r\n\r\n\r\n");
if(vDEBUG== true){usb.printf("%s/ Initialisation ..... %s \r\n", productName, versionName); wait(1);};
// Signal Sonore et Lumineux de Bienvenue
SON_ON; wait(0.1); SON_OFF;
R_LED_ON; G_LED_ON; B_LED_ON;
// if(vDEBUG== true){usb.println(" "); usb.print(productName); usb.print(" nb axes: "); usb.println(padNbAxe);delay(10);};
cmpt= 0;
while(cmpt< padNbAxe){
// if(vDEBUG== true){usb.print("-"); delay(500);};
switch(cmpt){
case 0:// Axe Latteral (Roulis)
// pad.axe[cmpt].nom = XAxeName; // "Roulis"; // Axe/ Designation
pad.axe[cmpt].scB = 100; // Mode Commande : 100 (%: 100 -> Proportionnelle pure, 0 -> Integrale Pure)
pad.axe[cmpt].dzB = 7; // Dead Zone : 5 (% plage)
pad.axe[cmpt].znlB = 25; // Zone Non Linearite: 50 (% plage)
pad.axe[cmpt].ctfB= 20; // Gain Proportionnel: 20 (% plage)
pad.axe[cmpt].ctiB= 0; // Gain Integral : 0 (% plage)
pad.axe[cmpt].gainI= 20; // Gain Integration deuxieme zone lineaire/ Valeure
// RAZ filtre moyenneur
// pad.axe[cmpt].fm[0]= 0; pad.axe[cmpt].fm[1]= 0; pad.axe[cmpt].fm[2]= 0; pad.axe[cmpt].fm[3]= 0; pad.axe[cmpt].fm[4]= 0;
break;
case 1:// Axe Antero posterieur (Tangage)
// pad.axe[cmpt].nom = YAxeName; //"Tangage";// Axe/ Designation
pad.axe[cmpt].scB = 100; // Mode Commande : 100 (%: 100 -> Proportionnelle pure, 0 -> Integrale Pure) // Commande Integrale Pure
pad.axe[cmpt].dzB = 5; // Dead Zone : 10 (% plage)
pad.axe[cmpt].znlB = 70; // Zone Non Linearite: 40 (% plage)
pad.axe[cmpt].ctfB= 20; // Gain Proportionnel: 20 (% plage)
pad.axe[cmpt].ctiB= 0; // Gain Integral : 0 (% plage)
pad.axe[cmpt].gainI= 25; // Gain Integration deuxieme zone lineaire/ Valeure
// RAZ filtre moyenneur
// pad.axe[cmpt].fm[0]= 0; pad.axe[cmpt].fm[1]= 0; pad.axe[cmpt].fm[2]= 0; pad.axe[cmpt].fm[3]= 0; pad.axe[cmpt].fm[4]= 0;
break;
default: break;
}; // fin switch(cmpt){
pad.axe[cmpt].sc = pad.axe[cmpt].scB/ 100;
pad.axe[cmpt].dzm = pad.axe[cmpt].dzB; pad.axe[cmpt].dzm/= 100; // Dead Zone/ Valeur min
pad.axe[cmpt].dzm*= -1;
pad.axe[cmpt].dzM = pad.axe[cmpt].dzB; pad.axe[cmpt].dzM/= 100; // Dead Zone/ Valeur MAX
pad.axe[cmpt].znlm= pad.axe[cmpt].znlB; pad.axe[cmpt].znlm/= 100; // Zone Non Linearite/ Valeur min
pad.axe[cmpt].znlm*= -1;
pad.axe[cmpt].znlM= pad.axe[cmpt].znlB; pad.axe[cmpt].znlM/= 100; // Zone Non Linearite/ Valeur MAX
pad.axe[cmpt].ctf = ctfmin+ (((pad.axe[cmpt].ctfB*(ctfMAX- ctfmin))/100)); // Gain Proportionnel/ Valeur nominale
pad.axe[cmpt].cti = ctimin+ (((pad.axe[cmpt].ctiB*(ctiMAX- ctimin))/100)); // Gain Integral/ Valeur nominale
pad.axe[cmpt].l = 0;
pad.axe[cmpt].i = 0;
pad.axe[cmpt].p = 0;
pad.axe[cmpt].i0 = 0;
pad.axe[cmpt].in = 0;
pad.axe[cmpt].out = 0;
pad.axe[cmpt].x= 0; pad.axe[cmpt].dX= 0; pad.axe[cmpt].X= 0;
++cmpt;
}; // fin while(cmpt<= padNbAxe){
// if(vDEBUG== true){usb.println(" "); delay(10);};
// Initialisation/ Module/ PAD/ SW
// if(vDEBUG== true){usb.print(productName); usb.print("/ Initialisation/ PAD/ SW "); delay(10);};
cmpt= 0;
while(cmpt<= padNbSW){
// if(vDEBUG== true){usb.print("-"); delay(10);};
switch(cmpt){
case 0:// Switch SW0: RAZ
pad.sw[0].value = OFF;
break;
default: break;
}; // fin switch(cmpt){
++cmpt;
}; // fin while(cmpt<= padNbSW){
// Initialisation/ Module/ Trame emission et reception UART
// if(vDEBUG== true){usb.print(productName); usb.print("/ Initialisation/ PAD/ Trame "); delay(10);};
trame.wdtTX = wdtTXMAX;
trame.wdtRX = wdtRXMAX;
ctn= wBUFFER- 1; while(ctn>= 0){trame.rx[ctn]= ' '; --ctn;};
trame.pcar = -1;
trame.fSB = false;
trame.fEB = false;
trame.sb = startB;
trame.eb = endB;
trame.dlb = dlB;
trame.id = idMOBILE;
//Initialisation/ Materiel/ DS3231
// ds3231_time_t time = {12,0,0,0,1};
// int16_t ret_val= rtc.set_time(time);
//Initialisation/ Materiel/ Communication/ UART USB
usb.baud(usbBR); wait(0.3);
usb.attach(&rx_usb_isr, Serial::RxIrq);
// USB.attach(&Tx_USB_Isr, Serial::TxIrq);
pUSBRx= 0; pUSBTx= 0;
//Initialisation/ Materiel/ Communication/ UART BT
uart.baud(uartBR); wait(0.3);
uart.attach(&rx_uart_isr, Serial::RxIrq);
// uart.attach(&Tx_uart_Isr, Serial::TxIrq);
//Initialisation/ Materiel/ Communication/ I2C
i2c.frequency(i2cBR); wait(0.2);
//Initialisation/ Materiel/ Communication/ RTC
// epoch_time = rtc.get_epoch(); // ds3231
// Signal Sonore et Lumineux de Sortie
SON_ON; wait(0.1); SON_OFF;
R_LED_OFF; G_LED_OFF; B_LED_OFF;
//Initialisation/ Materiel/ Interruption principale
if(status ==0){process.attach(&process_isr, TSample);};
return status;
}
//5.6- Definition/ Procedure/ Alarme
void alarme(void){
while(1){
B_LED_OFF; G_LED_OFF; R_LED_OFF; wait(0.3);
B_LED_ON; G_LED_OFF; R_LED_OFF; wait(0.3);
B_LED_OFF; G_LED_ON; R_LED_OFF; wait(0.3);
B_LED_OFF; G_LED_OFF; R_LED_ON; wait(0.3);
B_LED_OFF; G_LED_OFF; R_LED_OFF; wait(0.3);
};
}
//5.6- Definition/ Procedure/ Principale
int main(){
int statusInit= 0;
string svalue = "";
statusInit= InitProcess(); // Processus Principal/ Initialisation
if(statusInit== -1){ alarme();}; // Processus Principal/ Initialisation/ Probleme/ ARRET
usb.printf("\r\n\r\n--------------------------------------------------------\r\n\r\n");
usb.printf("%s/ %s version : %s \r\n", target, productName, versionName);
usb.printf("\r\n\r\n");
usb.printf("Parametre/ TSample (ms) : %d \r\n", (int)(1000*TSample));
usb.printf("Parametre/ USB Baud Rate : %d \r\n", usbBR);
usb.printf("\r\n");
usb.printf("%s/ STATUS : Running ... \r\n\r\n", productName);
// Processus principal
while(true){
if(secWDT<= 0){
epoch_time = rtc.get_epoch();
rledWDT= 5;
secWDT= secWDTMAX;
};
/*
// 5.15.1- Gestion Bus I2C
tmp1= 888;
tmp2= 999;
tmp1= power.read_bus_voltage();
tmp2= power.read_current();
eTENSION= tmp1;
eCOURANT= tmp2;
// 5.15.2- Gestion Bus CAN
// 5.15.2.1- CAN Emission
if(sndCAN== true){ // CAN/ Emission
// CANTx.clear();
switch(processCAN){
case 0: CANTx.id= idMOBILE; processCAN= 1;break; // CAN/ demande info IMU
case 1: CANTx.id= idIMU; processCAN= 0;break;
default: break;
}; // fin switch(processCAN){
CANTx.len= 1;
CANTx.data[0]= 0;
bCAN.write(CANTx);
sndCAN= false;
}; // fin if(sndCAN== true){
// 5.15.2.2- CAN Reception
if(rcvCAN== true){ // CAN/ Reception
switch(CANRx.id){
case idIMU : // imuWDT= 100;
// led(1, d20ms);
break;
default : break;
}; // fin swith(CANRx.id){
rcvCAN= false;
}; // fin if(rcvCAN== true){
*/
}; // fin while(true){
} // Fin int main() {