doxytest
Macros | Functions
Ecran_int.c File Reference
#include <plib.h>
#include "sys_include.h"
#include "Texte.h"
Include dependency graph for Ecran_int.c:

Macros

#define PS2DAT   CLAV_I
 
#define PS2CLK   CLAV_CLK
 
#define PS2START   0
 
#define PS2BIT   1
 
#define PS2PARITY   2
 
#define PS2STOP   3
 

Functions

void CLAV_INC (int a, int e)
 

Macro Definition Documentation

◆ PS2BIT

#define PS2BIT   1

◆ PS2CLK

#define PS2CLK   CLAV_CLK

◆ PS2DAT

#define PS2DAT   CLAV_I

◆ PS2PARITY

#define PS2PARITY   2

◆ PS2START

#define PS2START   0

◆ PS2STOP

#define PS2STOP   3

Function Documentation

◆ CLAV_INC()

void CLAV_INC ( int  a,
int  e 
)
19 {
20 //incr�mente la ligne du clavier de 1*a
21 static int b;
22 static int i;
23 static int j;
24 j=1;
25 b=0;
26 for (i=CHAR_AFF-1;i>CHAR_AFF-11;--i) // Transformation en asci
27 {
28  switch (message_clavier[i])
29  {
30  case '0':
31 
32  break;
33  case '1':
34  b=b+1*j;
35  break;
36  case '2':
37  b=b+2*j;
38  break;
39  case '3':
40  b=b+3*j;
41  break;
42  case '4':
43  b=b+4*j;
44  break;
45  case '5':
46  b=b+5*j;
47  break;
48  case '6':
49  b=b+6*j;
50  break;
51  case '7':
52  b=b+7*j;
53  break;
54  case '8':
55  b=b+8*j;
56  break;
57  case '9':
58  b=b+9*j;
59  break;
60  case ' ':
61  i=0;//fait arr�ter
62  break;
63  case '-':
64  b=b*(-1);
65  i=0;//fait arr�ter
66  break;
67  default:
68  i=0;//fait arr�ter
69  break;
70  }
71  j=j*10;
72 }
73 b=b+a;
74 /*METTRE DANS LIGNE CLAVIER*/
75 static int n;
76 static int di; // diviseur
77 static int val[N_CHAR]={0}; // valeur num�rique avant conversion en ASCI
78 
79 if (b>=0) {n=b;}
80 else {n=b*(-1);}//Valeur absolue
81 
82 di=1000000000; // Extraction des chiffres d�cimaux
83 for (i=8;i<18;++i) // > 9 comme si < 0
84 {
85  val[i]=n/di;
86  n=n-(val[i]*di);
87  di=di/10;
88 }
89 
90 
91 for (i=8;i<18;++i) // Transformation en asci
92 {
93  switch (val[i])
94  {
95  case 0:
96  message_clavier[i]='0';
97  break;
98  case 1:
99  message_clavier[i]='1';
100  break;
101  case 2:
102  message_clavier[i]='2';
103  break;
104  case 3:
105  message_clavier[i]='3';
106  break;
107  case 4:
108  message_clavier[i]='4';
109  break;
110  case 5:
111  message_clavier[i]='5';
112  break;
113  case 6:
114  message_clavier[i]='6';
115  break;
116  case 7:
117  message_clavier[i]='7';
118  break;
119  case 8:
120  message_clavier[i]='8';
121  break;
122  case 9:
123  message_clavier[i]='9';
124  break;
125  }
126 }
127 
128 for (i=8;i<18;++i) // Efface les premiers z�ro, mais dans tout les cas, laissera le z�ro des unit�s.
129 {
130 
131  if (val[i]!=0) {if (b<0){message_clavier[i-1]='-';}break;} // Le code ASCI pouvant chager, il vaut mieux se r�f�rer � val[ ]
132  message_clavier[i]=' ';
133 }
134 if (b==0){message_clavier[CHAR_AFF-1]='0';}//Affiche le 0
135 
136 
137 
138 /*===========================================================================================*/
139 
140 }