Révision 450
Ajouté par nodaoud il y a plus de 6 ans
branch/daoud/Emb_App/programme_principal_etud.c | ||
---|---|---|
|
||
|
||
|
||
void det_capteur(){
|
||
//lecture du capteur
|
||
CanFrame req;
|
||
UINT flag;
|
||
while(1){
|
||
req.data.id='C';
|
||
req.data.rtr=1;
|
||
periph[ADDR('C')].ev=0x03;
|
||
snd_dtq(CanTx, req.msg);
|
||
//Attente de la r?ponse
|
||
wai_flg (ev_periph, 0x03, TWF_ANDW, &flag);
|
||
capteur=periph[ADDR('C')].val;
|
||
dly_tsk(20);
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
short calcul_vitesse(short distance){}
|
||
/*while(1){
|
||
if(distance>=700){
|
||
... | ... | |
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
void det_saut(){
|
||
while(1){
|
||
if(capteur_num==0x0088){
|
||
if(capteur==0x7688){
|
||
distance=700;
|
||
alpha=450;
|
||
|
||
... | ... | |
|
||
req.data.id='D';
|
||
req.data.rtr=0;
|
||
if(capteur_num==0x5611){
|
||
if(capteur_num==0x7601){
|
||
req.data.val=0;
|
||
snd_dtq(CanTx, req.msg);}
|
||
else{
|
||
... | ... | |
vite.data.id='V';
|
||
vite.data.rtr=0;
|
||
|
||
if(capteur_num==0x5611)
|
||
if(capteur==0x7601)
|
||
{
|
||
// debut de saut
|
||
|
||
... | ... | |
snd_dtq(CanTx, vite.msg);
|
||
}
|
||
else{
|
||
if(capteur_num==0x5612)
|
||
if(capteur==0x7602)
|
||
{//apr?s le saut
|
||
vite.data.val=7;
|
||
snd_dtq(CanTx, vite.msg);
|
||
}
|
||
if(capteur_num==0x7613)
|
||
if(capteur==0x7603)
|
||
{
|
||
vite.data.val=3;
|
||
snd_dtq(CanTx, vite.msg);
|
||
... | ... | |
sta_tsk(ID_dist);
|
||
sta_tsk( ID_roue_reg);
|
||
sta_tsk( ID_afficher);
|
||
// sta_tsk( ID_clavier);
|
||
sta_tsk( ID_det_capteur);
|
||
sta_tsk (ID_det_saut);
|
||
|
||
|
branch/daoud/Emb_App/conf_noyau.cfg | ||
---|---|---|
initial_start = OFF;
|
||
exinf = 0x0;
|
||
};
|
||
task[]{
|
||
entry_address = det_capteur();
|
||
name = ID_det_capteur;
|
||
stack_size = 512;
|
||
stack_section = stack;
|
||
priority =5;
|
||
initial_start = OFF;
|
||
exinf = 0x0;
|
||
};
|
||
|
||
|
||
|
Formats disponibles : Unified diff
h