Skip to content
Snippets Groups Projects
Commit d1782a3d authored by Jedian's avatar Jedian
Browse files

Starting enbeautylizing


Signed-off-by: default avatarJedian <jmb15@c3sl.ufpr.br>
parent 3f25a0d9
No related branches found
No related tags found
No related merge requests found
0 00000001
00000002
fffff
1 1
2 2
3 3
ffffff
4 4
5 5
6 6
......
...@@ -101,6 +101,8 @@ int hex2int (int tam, char *hex) { ...@@ -101,6 +101,8 @@ int hex2int (int tam, char *hex) {
if(hex[i] < 0) if(hex[i] < 0)
hex[i]=0; hex[i]=0;
ans += hex[i] * pow16(tam-(i+1)); ans += hex[i] * pow16(tam-(i+1));
if(ans > 46)
return -1;
} }
return ans; return ans;
} }
...@@ -129,8 +131,8 @@ int int2hex (char *c, int i) { ...@@ -129,8 +131,8 @@ int int2hex (char *c, int i) {
int main(void) { // receive a string through the UART serial interface int main(void) { // receive a string through the UART serial interface
int i, j; int i, j; // and responds with the i-eth hex-based fibonacci sequence number
volatile int state; volatile int state = 0;
volatile Tstatus status; volatile Tstatus status;
char filona[145], c; char filona[145], c;
int hdona = 0; int hdona = 0;
...@@ -143,11 +145,11 @@ int main(void) { // receive a string through the UART serial interface ...@@ -143,11 +145,11 @@ int main(void) { // receive a string through the UART serial interface
uart = (void *)IO_UART_ADDR; // bottom of UART address range uart = (void *)IO_UART_ADDR; // bottom of UART address range
i = -1; i = -1;
ioctl(ctrl_util(2, 1, 1, 1));
Ud.ntx = 16; Ud.ntx = 16;
ioctl(ctrl_util(2, 1, 1, 1)); // Speed = 2, intRX = 1, intTX = 1, rts = 1
do { do {
state = i = i+1; state++;
// se tirar fode (b520 vira 15) // se tirar fode (b520 vira 15)
while(!proberx()) to_stdout('-');//i = 1 - i; while(!proberx()) to_stdout('-');//i = 1 - i;
//to_stdout('\0'); //to_stdout('\0');
...@@ -155,7 +157,8 @@ int main(void) { // receive a string through the UART serial interface ...@@ -155,7 +157,8 @@ int main(void) { // receive a string through the UART serial interface
while((c=Getc()) != -1){ while((c=Getc()) != -1){
filona[tlona] = c; filona[tlona] = c;
// se tirar fode (b520 vira 15) // se tirar fode (b520 vira 15)
to_stdout('*'); //to_stdout('*');
// cmips_delay(1);
//to_stdout('\0'); //to_stdout('\0');
// es // es
tlona++; tlona++;
...@@ -168,6 +171,7 @@ int main(void) { // receive a string through the UART serial interface ...@@ -168,6 +171,7 @@ int main(void) { // receive a string through the UART serial interface
while(filonx > 0){ while(filonx > 0){
qt = Strlen(filona+hdona); qt = Strlen(filona+hdona);
valfib = hex2int(qt, (filona+hdona)); valfib = hex2int(qt, (filona+hdona));
if(valfib != -1)
valfib = buf[valfib]; valfib = buf[valfib];
hdona += qt+1; hdona += qt+1;
hdona %= 145; hdona %= 145;
...@@ -190,13 +194,11 @@ int main(void) { // receive a string through the UART serial interface ...@@ -190,13 +194,11 @@ int main(void) { // receive a string through the UART serial interface
} while (p[j] != 0); } while (p[j] != 0);
filonx--; filonx--;
if(!filonx)
return state;
} }
if(filonx == 0 && !fim) } while (state);
fim = 1;
else if (filonx == 0 && fim)
return state+i;
} while (i<20);
return(state+i); return state;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment