teste de publish
Dependencies: DS1820 HighSpeedAnalogIn devices mbed
IRPack.cpp@21:b9315cdd9275, 2018-02-06 (annotated)
- Committer:
- brunofgc
- Date:
- Tue Feb 06 16:33:51 2018 +0000
- Revision:
- 21:b9315cdd9275
- Parent:
- 20:da1b8d80ba00
- Child:
- 24:302707175ef3
Ultima vers?o antes de usar urldecode2 para parsear a string de config.bin
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
brunofgc | 0:1c0a769988ee | 1 | #include "IRPack.h" |
brunofgc | 0:1c0a769988ee | 2 | //bool dataIn[maxBytesMsg*8]; |
brunofgc | 0:1c0a769988ee | 3 | uint16_t bits[maxBitsMsg*2][2]; |
brunofgc | 5:7801f913384e | 4 | int indexIr=0,botao; |
brunofgc | 0:1c0a769988ee | 5 | int startBitAlto=0, startBitBaixo=0, bitBaixo[maxBitsMsg], bitAlto[maxBitsMsg], i; |
brunofgc | 0:1c0a769988ee | 6 | //unsigned char byte=0,msg[maxBytesMsg],msgBytes=0; |
brunofgc | 0:1c0a769988ee | 7 | |
brunofgc | 0:1c0a769988ee | 8 | Timer IrTmr; |
brunofgc | 0:1c0a769988ee | 9 | Timer IrDetect; |
brunofgc | 0:1c0a769988ee | 10 | bool irInAntes=1; |
brunofgc | 0:1c0a769988ee | 11 | CircularBuffer bufIROut(maxBitsMsg*2*4); |
brunofgc | 0:1c0a769988ee | 12 | |
brunofgc | 0:1c0a769988ee | 13 | //PwmOut IrOut(P1_18); |
brunofgc | 0:1c0a769988ee | 14 | DigitalIn IrIn(P1_24); //Não utilizado na placa |
brunofgc | 0:1c0a769988ee | 15 | |
brunofgc | 0:1c0a769988ee | 16 | int round(float in){ |
brunofgc | 0:1c0a769988ee | 17 | int x = floor(in); |
brunofgc | 0:1c0a769988ee | 18 | float y = in-x; |
brunofgc | 0:1c0a769988ee | 19 | if(y>=0.5){ |
brunofgc | 0:1c0a769988ee | 20 | x++; |
brunofgc | 0:1c0a769988ee | 21 | } |
brunofgc | 0:1c0a769988ee | 22 | return x; |
brunofgc | 0:1c0a769988ee | 23 | } |
brunofgc | 0:1c0a769988ee | 24 | |
brunofgc | 0:1c0a769988ee | 25 | uint16_t pulseDuration_us(bool high,DigitalIn pin,unsigned long int timeout){ |
brunofgc | 21:b9315cdd9275 | 26 | unsigned long int durationBefore, duration; |
brunofgc | 21:b9315cdd9275 | 27 | durationBefore = us_ticker_read(); |
brunofgc | 21:b9315cdd9275 | 28 | do{ |
brunofgc | 21:b9315cdd9275 | 29 | wait_us(1); |
brunofgc | 21:b9315cdd9275 | 30 | timeout--; |
brunofgc | 21:b9315cdd9275 | 31 | }while(timeout && (pin==high)); |
brunofgc | 21:b9315cdd9275 | 32 | duration = us_ticker_read() - durationBefore; |
brunofgc | 0:1c0a769988ee | 33 | |
brunofgc | 20:da1b8d80ba00 | 34 | //IrTmr.stop(); |
brunofgc | 21:b9315cdd9275 | 35 | if(timeout){ |
brunofgc | 0:1c0a769988ee | 36 | return duration; |
brunofgc | 0:1c0a769988ee | 37 | } |
brunofgc | 0:1c0a769988ee | 38 | else{ |
brunofgc | 0:1c0a769988ee | 39 | return 65535; |
brunofgc | 0:1c0a769988ee | 40 | } |
brunofgc | 0:1c0a769988ee | 41 | } |
brunofgc | 0:1c0a769988ee | 42 | |
brunofgc | 0:1c0a769988ee | 43 | |
brunofgc | 0:1c0a769988ee | 44 | |
brunofgc | 6:d4ebbaaba295 | 45 | void enviaComandoIR(uint8_t freq,uint8_t port){ |
brunofgc | 0:1c0a769988ee | 46 | float sd1Duty = SD1.read(); |
brunofgc | 0:1c0a769988ee | 47 | float sd2Duty = SD2.read(); |
brunofgc | 0:1c0a769988ee | 48 | float sd3Duty = SD3.read(); |
brunofgc | 0:1c0a769988ee | 49 | float sd4Duty = SD4.read(); |
brunofgc | 0:1c0a769988ee | 50 | float sd5Duty = SD5.read(); |
brunofgc | 5:7801f913384e | 51 | float sd6Duty = SD6.read(); |
brunofgc | 20:da1b8d80ba00 | 52 | unsigned long int duration; |
brunofgc | 5:7801f913384e | 53 | float frequencia = freq*1000.0; |
brunofgc | 21:b9315cdd9275 | 54 | float periodo = 1000000.0/frequencia; |
brunofgc | 21:b9315cdd9275 | 55 | PwmOut *SD; |
brunofgc | 20:da1b8d80ba00 | 56 | |
brunofgc | 21:b9315cdd9275 | 57 | SD1.write(0.0f); |
brunofgc | 21:b9315cdd9275 | 58 | SD2.write(0.0f); |
brunofgc | 21:b9315cdd9275 | 59 | SD3.write(0.0f); |
brunofgc | 21:b9315cdd9275 | 60 | SD4.write(0.0f); |
brunofgc | 21:b9315cdd9275 | 61 | SD5.write(0.0f); |
brunofgc | 21:b9315cdd9275 | 62 | SD6.write(0.0f); |
brunofgc | 21:b9315cdd9275 | 63 | |
brunofgc | 0:1c0a769988ee | 64 | switch(port){ |
brunofgc | 0:1c0a769988ee | 65 | case 0: |
brunofgc | 0:1c0a769988ee | 66 | SD = &SD1; |
brunofgc | 0:1c0a769988ee | 67 | break; |
brunofgc | 0:1c0a769988ee | 68 | case 1: |
brunofgc | 0:1c0a769988ee | 69 | SD = &SD2; |
brunofgc | 0:1c0a769988ee | 70 | break; |
brunofgc | 0:1c0a769988ee | 71 | case 2: |
brunofgc | 0:1c0a769988ee | 72 | SD = &SD3; |
brunofgc | 0:1c0a769988ee | 73 | break; |
brunofgc | 0:1c0a769988ee | 74 | case 3: |
brunofgc | 0:1c0a769988ee | 75 | SD = &SD4; |
brunofgc | 0:1c0a769988ee | 76 | break; |
brunofgc | 0:1c0a769988ee | 77 | case 4: |
brunofgc | 0:1c0a769988ee | 78 | SD = &SD5; |
brunofgc | 0:1c0a769988ee | 79 | break; |
brunofgc | 0:1c0a769988ee | 80 | case 5: |
brunofgc | 0:1c0a769988ee | 81 | SD = &SD6; |
brunofgc | 0:1c0a769988ee | 82 | break; |
brunofgc | 0:1c0a769988ee | 83 | } |
brunofgc | 0:1c0a769988ee | 84 | |
brunofgc | 6:d4ebbaaba295 | 85 | //pc.printf("Enviando o pacote IR na porta %lu com periodo %f e frequencia %f.\r\n",port,periodo,frequencia); |
brunofgc | 5:7801f913384e | 86 | |
brunofgc | 5:7801f913384e | 87 | //SD->period(1.0/(freq*1000.0)); |
brunofgc | 6:d4ebbaaba295 | 88 | SD->period_us(periodo); |
brunofgc | 5:7801f913384e | 89 | |
brunofgc | 21:b9315cdd9275 | 90 | //pc.printf("Iniciando o envio IR.\r\n"); |
brunofgc | 21:b9315cdd9275 | 91 | for(i=0;i<indexIr;i++){ |
brunofgc | 21:b9315cdd9275 | 92 | SD->write(0.5); |
brunofgc | 21:b9315cdd9275 | 93 | wait_us(bits[i][0]); |
brunofgc | 20:da1b8d80ba00 | 94 | |
brunofgc | 20:da1b8d80ba00 | 95 | SD->write(0.0); |
brunofgc | 21:b9315cdd9275 | 96 | wait_us(bits[i][1]); |
brunofgc | 20:da1b8d80ba00 | 97 | } |
brunofgc | 21:b9315cdd9275 | 98 | //pc.printf("Finalizado o envio IR.\r\n"); |
brunofgc | 21:b9315cdd9275 | 99 | |
brunofgc | 0:1c0a769988ee | 100 | SD1.period_us(pwmPeriod); |
brunofgc | 0:1c0a769988ee | 101 | SD1.write(sd1Duty); |
brunofgc | 0:1c0a769988ee | 102 | SD2.write(sd2Duty); |
brunofgc | 0:1c0a769988ee | 103 | SD3.write(sd3Duty); |
brunofgc | 0:1c0a769988ee | 104 | SD4.write(sd4Duty); |
brunofgc | 0:1c0a769988ee | 105 | SD5.write(sd5Duty); |
brunofgc | 21:b9315cdd9275 | 106 | SD6.write(sd6Duty); |
brunofgc | 0:1c0a769988ee | 107 | } |
brunofgc | 0:1c0a769988ee | 108 | |
brunofgc | 0:1c0a769988ee | 109 | |
brunofgc | 5:7801f913384e | 110 | /*static const long hextable[] = { |
brunofgc | 0:1c0a769988ee | 111 | [0 ... 255] = -1, // bit aligned access into this table is considerably |
brunofgc | 0:1c0a769988ee | 112 | ['0'] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // faster for most modern processors, |
brunofgc | 0:1c0a769988ee | 113 | ['A'] = 10, 11, 12, 13, 14, 15, // for the space conscious, reduce to |
brunofgc | 0:1c0a769988ee | 114 | ['a'] = 10, 11, 12, 13, 14, 15 // signed char. |
brunofgc | 5:7801f913384e | 115 | };*/ |
brunofgc | 5:7801f913384e | 116 | |
brunofgc | 5:7801f913384e | 117 | uint8_t hextable(char c){ |
brunofgc | 5:7801f913384e | 118 | uint8_t ret=0; |
brunofgc | 5:7801f913384e | 119 | if(c>='a'){ |
brunofgc | 5:7801f913384e | 120 | ret = c-87; |
brunofgc | 5:7801f913384e | 121 | }else if(c>='A'){ |
brunofgc | 5:7801f913384e | 122 | ret = c-55; |
brunofgc | 5:7801f913384e | 123 | }else{ |
brunofgc | 5:7801f913384e | 124 | ret = c-48; |
brunofgc | 5:7801f913384e | 125 | } |
brunofgc | 5:7801f913384e | 126 | return ret; |
brunofgc | 5:7801f913384e | 127 | } |
brunofgc | 0:1c0a769988ee | 128 | |
brunofgc | 0:1c0a769988ee | 129 | uint16_t hexdec(char *hex,uint16_t tam) { |
brunofgc | 0:1c0a769988ee | 130 | uint16_t ret = 0; |
brunofgc | 7:ae9c47f62946 | 131 | //uint8_t auxHex=0; |
brunofgc | 5:7801f913384e | 132 | uint16_t i; |
brunofgc | 0:1c0a769988ee | 133 | for(i=0;i<tam;i++){ |
brunofgc | 5:7801f913384e | 134 | //ret += hextable[hex[i]] << (i*4); |
brunofgc | 5:7801f913384e | 135 | ret += hextable(hex[i]) << (i*4); |
brunofgc | 5:7801f913384e | 136 | //pc.printf("%c",hex[i]); |
brunofgc | 5:7801f913384e | 137 | } |
brunofgc | 5:7801f913384e | 138 | //pc.printf("\r\n"); |
brunofgc | 0:1c0a769988ee | 139 | return ret; |
brunofgc | 0:1c0a769988ee | 140 | } |
brunofgc | 0:1c0a769988ee | 141 | |
brunofgc | 0:1c0a769988ee | 142 | |
brunofgc | 5:7801f913384e | 143 | void deserializaPacoteIR(char *strIr){ |
brunofgc | 5:7801f913384e | 144 | uint16_t len; |
brunofgc | 0:1c0a769988ee | 145 | uint16_t i; |
brunofgc | 5:7801f913384e | 146 | |
brunofgc | 5:7801f913384e | 147 | len = strlen(strIr); |
brunofgc | 0:1c0a769988ee | 148 | len = len/4; //Separando de quatro em quatro pra formar um uint16_t |
brunofgc | 7:ae9c47f62946 | 149 | |
brunofgc | 0:1c0a769988ee | 150 | for(i=0;i<len;i++){ |
brunofgc | 5:7801f913384e | 151 | bits[i/2][(i%2)]=hexdec(strIr,4); |
brunofgc | 5:7801f913384e | 152 | strIr = strIr+4; |
brunofgc | 5:7801f913384e | 153 | } |
brunofgc | 7:ae9c47f62946 | 154 | indexIr = len/2; |
brunofgc | 0:1c0a769988ee | 155 | } |
brunofgc | 0:1c0a769988ee | 156 | |
brunofgc | 0:1c0a769988ee | 157 | void serializaPacoteIR(uint8_t connectionID){ |
brunofgc | 2:55b7b466e742 | 158 | char aux[50]; |
brunofgc | 0:1c0a769988ee | 159 | uint32_t length; |
brunofgc | 0:1c0a769988ee | 160 | char *ptr; |
brunofgc | 0:1c0a769988ee | 161 | uint16_t i; |
brunofgc | 0:1c0a769988ee | 162 | union{ |
brunofgc | 0:1c0a769988ee | 163 | char c[2]; |
brunofgc | 0:1c0a769988ee | 164 | uint16_t v; |
brunofgc | 0:1c0a769988ee | 165 | }u; |
brunofgc | 2:55b7b466e742 | 166 | sdCardBuf.del(); |
brunofgc | 5:7801f913384e | 167 | for(i=0;i<indexIr;i++){ |
brunofgc | 0:1c0a769988ee | 168 | u.v = bits[i][0]; |
brunofgc | 0:1c0a769988ee | 169 | sprintf(aux,"%01X%01X%01X%01X" |
brunofgc | 0:1c0a769988ee | 170 | ,u.c[0]&0xF |
brunofgc | 0:1c0a769988ee | 171 | ,u.c[0]>>4 |
brunofgc | 0:1c0a769988ee | 172 | ,u.c[1]&0xF |
brunofgc | 0:1c0a769988ee | 173 | ,u.c[1]>>4 |
brunofgc | 0:1c0a769988ee | 174 | ); |
brunofgc | 0:1c0a769988ee | 175 | sdCardBuf.fill(aux,strlen(aux)); |
brunofgc | 0:1c0a769988ee | 176 | |
brunofgc | 0:1c0a769988ee | 177 | u.v = bits[i][1]; |
brunofgc | 0:1c0a769988ee | 178 | sprintf(aux,"%01X%01X%01X%01X" |
brunofgc | 0:1c0a769988ee | 179 | ,u.c[0]&0xF |
brunofgc | 0:1c0a769988ee | 180 | ,u.c[0]>>4 |
brunofgc | 0:1c0a769988ee | 181 | ,u.c[1]&0xF |
brunofgc | 0:1c0a769988ee | 182 | ,u.c[1]>>4 |
brunofgc | 0:1c0a769988ee | 183 | ); |
brunofgc | 0:1c0a769988ee | 184 | sdCardBuf.fill(aux,strlen(aux)); |
brunofgc | 0:1c0a769988ee | 185 | } |
brunofgc | 0:1c0a769988ee | 186 | length = sdCardBuf.getLength(); |
brunofgc | 0:1c0a769988ee | 187 | ptr = sdCardBuf.get(); |
brunofgc | 0:1c0a769988ee | 188 | modemCom::cipSend(connID,ptr,length); |
brunofgc | 2:55b7b466e742 | 189 | //pc.printf("Conteudo de sdCardBuf <%s>.\r\n",ptr); |
brunofgc | 0:1c0a769988ee | 190 | } |
brunofgc | 0:1c0a769988ee | 191 | |
brunofgc | 0:1c0a769988ee | 192 | bool detectaIRIn(){ |
brunofgc | 0:1c0a769988ee | 193 | bool detectado=0; |
brunofgc | 21:b9315cdd9275 | 194 | if((irInAntes!=IrIn) && (!IrIn)){ |
brunofgc | 21:b9315cdd9275 | 195 | indexIr = 0; |
brunofgc | 21:b9315cdd9275 | 196 | do{ |
brunofgc | 21:b9315cdd9275 | 197 | bits[indexIr][0] = pulseDuration_us(0,IrIn,65000); |
brunofgc | 21:b9315cdd9275 | 198 | bits[indexIr][1] = pulseDuration_us(1,IrIn,65000); |
brunofgc | 21:b9315cdd9275 | 199 | indexIr++; |
brunofgc | 21:b9315cdd9275 | 200 | }while((bits[indexIr-1][0]!=65535)&&(bits[indexIr-1][1]!=65535)); |
brunofgc | 21:b9315cdd9275 | 201 | detectado=1; |
brunofgc | 0:1c0a769988ee | 202 | } |
brunofgc | 0:1c0a769988ee | 203 | irInAntes = IrIn; |
brunofgc | 21:b9315cdd9275 | 204 | |
brunofgc | 0:1c0a769988ee | 205 | return detectado; |
brunofgc | 0:1c0a769988ee | 206 | } |
brunofgc | 0:1c0a769988ee | 207 | |
brunofgc | 0:1c0a769988ee | 208 | void pesquisaIRIn(){ |
brunofgc | 21:b9315cdd9275 | 209 | if((irInAntes!=IrIn) && (!IrIn)){ |
brunofgc | 21:b9315cdd9275 | 210 | indexIr = 0; |
brunofgc | 21:b9315cdd9275 | 211 | do{ |
brunofgc | 21:b9315cdd9275 | 212 | bitAlto[indexIr] = pulseDuration_us(0,IrIn,65000); |
brunofgc | 21:b9315cdd9275 | 213 | bitBaixo[indexIr] = pulseDuration_us(1,IrIn,65000); |
brunofgc | 21:b9315cdd9275 | 214 | //dataIn[indexIr] = (bitBaixo[indexIr] > 1000); |
brunofgc | 21:b9315cdd9275 | 215 | indexIr++; |
brunofgc | 21:b9315cdd9275 | 216 | }while((bitAlto[indexIr-1]!=65535)&&(bitBaixo[indexIr-1]!=65535)); |
brunofgc | 21:b9315cdd9275 | 217 | |
brunofgc | 21:b9315cdd9275 | 218 | pc.printf("Capturado um quadro com %lu bits. sbH %ld, sbL %ld <",indexIr,startBitAlto, startBitBaixo); |
brunofgc | 21:b9315cdd9275 | 219 | for(i=0;i<(indexIr);i++){ |
brunofgc | 21:b9315cdd9275 | 220 | pc.printf("[H%ld L%ld] ",bitAlto[i],bitBaixo[i]); |
brunofgc | 21:b9315cdd9275 | 221 | } |
brunofgc | 21:b9315cdd9275 | 222 | pc.printf(">.\n\n"); |
brunofgc | 0:1c0a769988ee | 223 | } |
brunofgc | 21:b9315cdd9275 | 224 | irInAntes = IrIn; |
brunofgc | 0:1c0a769988ee | 225 | } |
brunofgc | 0:1c0a769988ee | 226 | |
brunofgc | 0:1c0a769988ee | 227 | /* |
brunofgc | 0:1c0a769988ee | 228 | |
brunofgc | 0:1c0a769988ee | 229 | float razaoBit(int iH, int iL){ |
brunofgc | 0:1c0a769988ee | 230 | float H=(float)iH,L=(float)iL; |
brunofgc | 0:1c0a769988ee | 231 | float razao = L/H; |
brunofgc | 0:1c0a769988ee | 232 | |
brunofgc | 0:1c0a769988ee | 233 | if(razao>=1){ |
brunofgc | 0:1c0a769988ee | 234 | return (float) round(razao); |
brunofgc | 0:1c0a769988ee | 235 | }else if(razao>=0.5){ |
brunofgc | 0:1c0a769988ee | 236 | return 0.5; |
brunofgc | 0:1c0a769988ee | 237 | }else if(razao>=0.25){ |
brunofgc | 0:1c0a769988ee | 238 | return 0.25; |
brunofgc | 0:1c0a769988ee | 239 | }else if(razao>=0.125){ |
brunofgc | 0:1c0a769988ee | 240 | return 0.125; |
brunofgc | 0:1c0a769988ee | 241 | }else{ |
brunofgc | 0:1c0a769988ee | 242 | return -1; |
brunofgc | 0:1c0a769988ee | 243 | } |
brunofgc | 0:1c0a769988ee | 244 | |
brunofgc | 0:1c0a769988ee | 245 | } |
brunofgc | 0:1c0a769988ee | 246 | |
brunofgc | 0:1c0a769988ee | 247 | void descritorPacoteIR(int startBitAlto, int startBitBaixo, int *bitAlto, int *bitBaixo, int numBits){ |
brunofgc | 0:1c0a769988ee | 248 | unsigned int razao_maiorQue4=0; |
brunofgc | 0:1c0a769988ee | 249 | unsigned int razao_4=0; |
brunofgc | 0:1c0a769988ee | 250 | unsigned int razao_3=0; |
brunofgc | 0:1c0a769988ee | 251 | unsigned int razao_2=0; |
brunofgc | 0:1c0a769988ee | 252 | unsigned int razao_1=0; |
brunofgc | 0:1c0a769988ee | 253 | unsigned int razao_0_5=0; |
brunofgc | 0:1c0a769988ee | 254 | unsigned int razao_0_25=0; |
brunofgc | 0:1c0a769988ee | 255 | unsigned int razao_0_125=0; |
brunofgc | 0:1c0a769988ee | 256 | unsigned int razao_menorQue_0_125=0; |
brunofgc | 0:1c0a769988ee | 257 | |
brunofgc | 0:1c0a769988ee | 258 | //Indice 0 ALto, 1 Baixo; |
brunofgc | 0:1c0a769988ee | 259 | unsigned long int bitRazao_maiorQue4[2]= {0,0}; |
brunofgc | 0:1c0a769988ee | 260 | unsigned long int bitRazao_4[2]= {0,0}; |
brunofgc | 0:1c0a769988ee | 261 | unsigned long int bitRazao_3[2]= {0,0}; |
brunofgc | 0:1c0a769988ee | 262 | unsigned long int bitRazao_2[2]= {0,0}; |
brunofgc | 0:1c0a769988ee | 263 | unsigned long int bitRazao_1[2]= {0,0}; |
brunofgc | 0:1c0a769988ee | 264 | unsigned long int bitRazao_0_5[2]= {0,0}; |
brunofgc | 0:1c0a769988ee | 265 | unsigned long int bitRazao_0_25[2]= {0,0}; |
brunofgc | 0:1c0a769988ee | 266 | unsigned long int bitRazao_0_125[2]= {0,0}; |
brunofgc | 0:1c0a769988ee | 267 | unsigned long int bitRazao_menorQue_0_125[2]= {0,0}; |
brunofgc | 0:1c0a769988ee | 268 | |
brunofgc | 0:1c0a769988ee | 269 | unsigned long int indiceMaiorNEventos[2] = {0,0}; |
brunofgc | 0:1c0a769988ee | 270 | unsigned long int indiceSegundoMaiorNEventos[2] = {0,0}; |
brunofgc | 0:1c0a769988ee | 271 | |
brunofgc | 0:1c0a769988ee | 272 | |
brunofgc | 0:1c0a769988ee | 273 | |
brunofgc | 0:1c0a769988ee | 274 | unsigned int bitAlto_H=0; |
brunofgc | 0:1c0a769988ee | 275 | unsigned int bitAlto_L=0; |
brunofgc | 0:1c0a769988ee | 276 | unsigned int bitBaixo_H=0; |
brunofgc | 0:1c0a769988ee | 277 | unsigned int bitBaixo_L=0; |
brunofgc | 0:1c0a769988ee | 278 | |
brunofgc | 0:1c0a769988ee | 279 | unsigned int stopBitAlto = bitAlto[numBits-1]; |
brunofgc | 0:1c0a769988ee | 280 | |
brunofgc | 0:1c0a769988ee | 281 | int i; |
brunofgc | 0:1c0a769988ee | 282 | |
brunofgc | 0:1c0a769988ee | 283 | //printf("startBitAlto %d, startBitBaixo %d, stopBitAlto %d, stopBitBaixo %d numBits %d\n",startBitAlto,startBitBaixo,bitAlto[numBits-1],bitBaixo[numBits-1],numBits); |
brunofgc | 0:1c0a769988ee | 284 | |
brunofgc | 0:1c0a769988ee | 285 | //Despresando o stopBit pois esse já sabemos como faz |
brunofgc | 0:1c0a769988ee | 286 | for(i=0;i<numBits-1;i++){ |
brunofgc | 0:1c0a769988ee | 287 | //printf("Razao entre [L %05d e H %05d]=%1.2f\n",bitBaixo[i],bitAlto[i],razaoBit(bitAlto[i],bitBaixo[i])); |
brunofgc | 0:1c0a769988ee | 288 | //Detecção de padroes |
brunofgc | 0:1c0a769988ee | 289 | if(razaoBit(bitAlto[i],bitBaixo[i])>=4){ |
brunofgc | 0:1c0a769988ee | 290 | razao_maiorQue4++; |
brunofgc | 0:1c0a769988ee | 291 | bitRazao_maiorQue4[0]+= bitAlto[i]; |
brunofgc | 0:1c0a769988ee | 292 | bitRazao_maiorQue4[1]+=bitBaixo[i]; |
brunofgc | 0:1c0a769988ee | 293 | |
brunofgc | 0:1c0a769988ee | 294 | }else if(razaoBit(bitAlto[i],bitBaixo[i])==4){ |
brunofgc | 0:1c0a769988ee | 295 | razao_4++; |
brunofgc | 0:1c0a769988ee | 296 | bitRazao_4[0]+= bitAlto[i]; |
brunofgc | 0:1c0a769988ee | 297 | bitRazao_4[1]+=bitBaixo[i]; |
brunofgc | 0:1c0a769988ee | 298 | }else if(razaoBit(bitAlto[i],bitBaixo[i])==3){ |
brunofgc | 0:1c0a769988ee | 299 | razao_3++; |
brunofgc | 0:1c0a769988ee | 300 | bitRazao_3[0]+= bitAlto[i]; |
brunofgc | 0:1c0a769988ee | 301 | bitRazao_3[1]+=bitBaixo[i]; |
brunofgc | 0:1c0a769988ee | 302 | }else if(razaoBit(bitAlto[i],bitBaixo[i])==2){ |
brunofgc | 0:1c0a769988ee | 303 | razao_2++; |
brunofgc | 0:1c0a769988ee | 304 | bitRazao_2[0]+= bitAlto[i]; |
brunofgc | 0:1c0a769988ee | 305 | bitRazao_2[1]+=bitBaixo[i]; |
brunofgc | 0:1c0a769988ee | 306 | }else if(razaoBit(bitAlto[i],bitBaixo[i])==1){ |
brunofgc | 0:1c0a769988ee | 307 | razao_1++; |
brunofgc | 0:1c0a769988ee | 308 | bitRazao_1[0]+= bitAlto[i]; |
brunofgc | 0:1c0a769988ee | 309 | bitRazao_1[1]+=bitBaixo[i]; |
brunofgc | 0:1c0a769988ee | 310 | }else if(razaoBit(bitAlto[i],bitBaixo[i])==0.5){ |
brunofgc | 0:1c0a769988ee | 311 | razao_0_5++; |
brunofgc | 0:1c0a769988ee | 312 | bitRazao_0_5[0]+= bitAlto[i]; |
brunofgc | 0:1c0a769988ee | 313 | bitRazao_0_5[1]+=bitBaixo[i]; |
brunofgc | 0:1c0a769988ee | 314 | }else if(razaoBit(bitAlto[i],bitBaixo[i])==0.25){ |
brunofgc | 0:1c0a769988ee | 315 | razao_0_25++; |
brunofgc | 0:1c0a769988ee | 316 | bitRazao_0_25[0]+= bitAlto[i]; |
brunofgc | 0:1c0a769988ee | 317 | bitRazao_0_25[1]+=bitBaixo[i]; |
brunofgc | 0:1c0a769988ee | 318 | }else if(razaoBit(bitAlto[i],bitBaixo[i])==0.125){ |
brunofgc | 0:1c0a769988ee | 319 | razao_0_125++; |
brunofgc | 0:1c0a769988ee | 320 | bitRazao_0_125[0]+= bitAlto[i]; |
brunofgc | 0:1c0a769988ee | 321 | bitRazao_0_125[1]+=bitBaixo[i]; |
brunofgc | 0:1c0a769988ee | 322 | }else { |
brunofgc | 0:1c0a769988ee | 323 | razao_menorQue_0_125++; |
brunofgc | 0:1c0a769988ee | 324 | bitRazao_menorQue_0_125[0]+= bitAlto[i]; |
brunofgc | 0:1c0a769988ee | 325 | bitRazao_menorQue_0_125[1]+=bitBaixo[i]; |
brunofgc | 0:1c0a769988ee | 326 | } |
brunofgc | 0:1c0a769988ee | 327 | |
brunofgc | 0:1c0a769988ee | 328 | } |
brunofgc | 0:1c0a769988ee | 329 | printf("Razoes <0.125 = %d\n 0.125 = %d\n 0.25 = %d\n 0.5 = %d\n 1 = %d\n 2 = %d\n 3 = %d\n 4 = %d\n maior que 4 = %d\n" |
brunofgc | 0:1c0a769988ee | 330 | ,razao_menorQue_0_125 |
brunofgc | 0:1c0a769988ee | 331 | ,razao_0_125 |
brunofgc | 0:1c0a769988ee | 332 | ,razao_0_25 |
brunofgc | 0:1c0a769988ee | 333 | ,razao_0_5 |
brunofgc | 0:1c0a769988ee | 334 | ,razao_1 |
brunofgc | 0:1c0a769988ee | 335 | ,razao_2 |
brunofgc | 0:1c0a769988ee | 336 | ,razao_3 |
brunofgc | 0:1c0a769988ee | 337 | ,razao_4 |
brunofgc | 0:1c0a769988ee | 338 | ,razao_maiorQue4 |
brunofgc | 0:1c0a769988ee | 339 | ); |
brunofgc | 0:1c0a769988ee | 340 | |
brunofgc | 0:1c0a769988ee | 341 | //Buscando os dois maiores em numero de eventos por Indice; |
brunofgc | 0:1c0a769988ee | 342 | //Buscando o primeiro |
brunofgc | 0:1c0a769988ee | 343 | for(i=0;i<9;i++){ |
brunofgc | 0:1c0a769988ee | 344 | //Buscando nos indices maior numero eventos |
brunofgc | 0:1c0a769988ee | 345 | switch(i){ |
brunofgc | 0:1c0a769988ee | 346 | case 0: |
brunofgc | 0:1c0a769988ee | 347 | if(razao_maiorQue4>indiceMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 348 | indiceMaiorNEventos[0] = razao_maiorQue4; |
brunofgc | 0:1c0a769988ee | 349 | indiceMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 350 | } |
brunofgc | 0:1c0a769988ee | 351 | break; |
brunofgc | 0:1c0a769988ee | 352 | |
brunofgc | 0:1c0a769988ee | 353 | case 1: |
brunofgc | 0:1c0a769988ee | 354 | if(razao_4>indiceMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 355 | indiceMaiorNEventos[0] = razao_4; |
brunofgc | 0:1c0a769988ee | 356 | indiceMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 357 | } |
brunofgc | 0:1c0a769988ee | 358 | break; |
brunofgc | 0:1c0a769988ee | 359 | case 2: |
brunofgc | 0:1c0a769988ee | 360 | if(razao_3>indiceMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 361 | indiceMaiorNEventos[0] = razao_3; |
brunofgc | 0:1c0a769988ee | 362 | indiceMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 363 | } |
brunofgc | 0:1c0a769988ee | 364 | break; |
brunofgc | 0:1c0a769988ee | 365 | case 3: |
brunofgc | 0:1c0a769988ee | 366 | if(razao_2>indiceMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 367 | indiceMaiorNEventos[0] = razao_2; |
brunofgc | 0:1c0a769988ee | 368 | indiceMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 369 | } |
brunofgc | 0:1c0a769988ee | 370 | break; |
brunofgc | 0:1c0a769988ee | 371 | case 4: |
brunofgc | 0:1c0a769988ee | 372 | if(razao_1>indiceMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 373 | indiceMaiorNEventos[0] = razao_1; |
brunofgc | 0:1c0a769988ee | 374 | indiceMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 375 | } |
brunofgc | 0:1c0a769988ee | 376 | break; |
brunofgc | 0:1c0a769988ee | 377 | case 5: |
brunofgc | 0:1c0a769988ee | 378 | if(razao_0_5>indiceMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 379 | indiceMaiorNEventos[0] = razao_0_5; |
brunofgc | 0:1c0a769988ee | 380 | indiceMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 381 | } |
brunofgc | 0:1c0a769988ee | 382 | break; |
brunofgc | 0:1c0a769988ee | 383 | case 6: |
brunofgc | 0:1c0a769988ee | 384 | if(razao_0_25>indiceMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 385 | indiceMaiorNEventos[0] = razao_0_25; |
brunofgc | 0:1c0a769988ee | 386 | indiceMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 387 | } |
brunofgc | 0:1c0a769988ee | 388 | break; |
brunofgc | 0:1c0a769988ee | 389 | case 7: |
brunofgc | 0:1c0a769988ee | 390 | if(razao_0_125>indiceMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 391 | indiceMaiorNEventos[0] = razao_0_125; |
brunofgc | 0:1c0a769988ee | 392 | indiceMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 393 | } |
brunofgc | 0:1c0a769988ee | 394 | break; |
brunofgc | 0:1c0a769988ee | 395 | case 8: |
brunofgc | 0:1c0a769988ee | 396 | if(razao_menorQue_0_125>indiceMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 397 | indiceMaiorNEventos[0] = razao_menorQue_0_125; |
brunofgc | 0:1c0a769988ee | 398 | indiceMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 399 | } |
brunofgc | 0:1c0a769988ee | 400 | break; |
brunofgc | 0:1c0a769988ee | 401 | |
brunofgc | 0:1c0a769988ee | 402 | } |
brunofgc | 0:1c0a769988ee | 403 | } |
brunofgc | 0:1c0a769988ee | 404 | |
brunofgc | 0:1c0a769988ee | 405 | //Buscando o segundo |
brunofgc | 0:1c0a769988ee | 406 | //Buscando o primeiro |
brunofgc | 0:1c0a769988ee | 407 | for(i=0;i<9;i++){ |
brunofgc | 0:1c0a769988ee | 408 | //Buscando nos indices maior numero eventos |
brunofgc | 0:1c0a769988ee | 409 | if(i!=indiceMaiorNEventos[1]){ |
brunofgc | 0:1c0a769988ee | 410 | switch(i){ |
brunofgc | 0:1c0a769988ee | 411 | case 0: |
brunofgc | 0:1c0a769988ee | 412 | if(razao_maiorQue4>indiceSegundoMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 413 | indiceSegundoMaiorNEventos[0] = razao_maiorQue4; |
brunofgc | 0:1c0a769988ee | 414 | indiceSegundoMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 415 | } |
brunofgc | 0:1c0a769988ee | 416 | break; |
brunofgc | 0:1c0a769988ee | 417 | |
brunofgc | 0:1c0a769988ee | 418 | case 1: |
brunofgc | 0:1c0a769988ee | 419 | if(razao_4>indiceSegundoMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 420 | indiceSegundoMaiorNEventos[0] = razao_4; |
brunofgc | 0:1c0a769988ee | 421 | indiceSegundoMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 422 | } |
brunofgc | 0:1c0a769988ee | 423 | break; |
brunofgc | 0:1c0a769988ee | 424 | case 2: |
brunofgc | 0:1c0a769988ee | 425 | if(razao_3>indiceSegundoMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 426 | indiceSegundoMaiorNEventos[0] = razao_3; |
brunofgc | 0:1c0a769988ee | 427 | indiceSegundoMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 428 | } |
brunofgc | 0:1c0a769988ee | 429 | break; |
brunofgc | 0:1c0a769988ee | 430 | case 3: |
brunofgc | 0:1c0a769988ee | 431 | if(razao_2>indiceSegundoMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 432 | indiceSegundoMaiorNEventos[0] = razao_2; |
brunofgc | 0:1c0a769988ee | 433 | indiceSegundoMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 434 | } |
brunofgc | 0:1c0a769988ee | 435 | break; |
brunofgc | 0:1c0a769988ee | 436 | case 4: |
brunofgc | 0:1c0a769988ee | 437 | if(razao_1>indiceSegundoMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 438 | indiceSegundoMaiorNEventos[0] = razao_1; |
brunofgc | 0:1c0a769988ee | 439 | indiceSegundoMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 440 | } |
brunofgc | 0:1c0a769988ee | 441 | break; |
brunofgc | 0:1c0a769988ee | 442 | case 5: |
brunofgc | 0:1c0a769988ee | 443 | if(razao_0_5>indiceSegundoMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 444 | indiceSegundoMaiorNEventos[0] = razao_0_5; |
brunofgc | 0:1c0a769988ee | 445 | indiceSegundoMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 446 | } |
brunofgc | 0:1c0a769988ee | 447 | break; |
brunofgc | 0:1c0a769988ee | 448 | case 6: |
brunofgc | 0:1c0a769988ee | 449 | if(razao_0_25>indiceSegundoMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 450 | indiceSegundoMaiorNEventos[0] = razao_0_25; |
brunofgc | 0:1c0a769988ee | 451 | indiceSegundoMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 452 | } |
brunofgc | 0:1c0a769988ee | 453 | break; |
brunofgc | 0:1c0a769988ee | 454 | case 7: |
brunofgc | 0:1c0a769988ee | 455 | if(razao_0_125>indiceSegundoMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 456 | indiceSegundoMaiorNEventos[0] = razao_0_125; |
brunofgc | 0:1c0a769988ee | 457 | indiceSegundoMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 458 | } |
brunofgc | 0:1c0a769988ee | 459 | break; |
brunofgc | 0:1c0a769988ee | 460 | case 8: |
brunofgc | 0:1c0a769988ee | 461 | if(razao_menorQue_0_125>indiceSegundoMaiorNEventos[0]){ |
brunofgc | 0:1c0a769988ee | 462 | indiceSegundoMaiorNEventos[0] = razao_menorQue_0_125; |
brunofgc | 0:1c0a769988ee | 463 | indiceSegundoMaiorNEventos[1] = i; |
brunofgc | 0:1c0a769988ee | 464 | } |
brunofgc | 0:1c0a769988ee | 465 | break; |
brunofgc | 0:1c0a769988ee | 466 | |
brunofgc | 0:1c0a769988ee | 467 | } |
brunofgc | 0:1c0a769988ee | 468 | } |
brunofgc | 0:1c0a769988ee | 469 | } |
brunofgc | 0:1c0a769988ee | 470 | |
brunofgc | 0:1c0a769988ee | 471 | |
brunofgc | 0:1c0a769988ee | 472 | //printf("Indice de maior aparecimento foi o de %d.\nIndice de segundo maior aparecimento foi o de %d.\n",indiceMaiorNEventos[1],indiceSegundoMaiorNEventos[1]); |
brunofgc | 0:1c0a769988ee | 473 | |
brunofgc | 0:1c0a769988ee | 474 | //Calculando bitAlto |
brunofgc | 0:1c0a769988ee | 475 | switch(indiceMaiorNEventos[1]){ |
brunofgc | 0:1c0a769988ee | 476 | case 0: |
brunofgc | 0:1c0a769988ee | 477 | bitAlto_H = round(bitRazao_maiorQue4[0]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 478 | bitAlto_L = round(bitRazao_maiorQue4[1]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 479 | break; |
brunofgc | 0:1c0a769988ee | 480 | case 1: |
brunofgc | 0:1c0a769988ee | 481 | bitAlto_H = round(bitRazao_4[0]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 482 | bitAlto_L = round(bitRazao_4[1]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 483 | break; |
brunofgc | 0:1c0a769988ee | 484 | case 2: |
brunofgc | 0:1c0a769988ee | 485 | bitAlto_H = round(bitRazao_3[0]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 486 | bitAlto_L = round(bitRazao_3[1]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 487 | break; |
brunofgc | 0:1c0a769988ee | 488 | case 3: |
brunofgc | 0:1c0a769988ee | 489 | bitAlto_H = round(bitRazao_2[0]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 490 | bitAlto_L = round(bitRazao_2[1]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 491 | break; |
brunofgc | 0:1c0a769988ee | 492 | case 4: |
brunofgc | 0:1c0a769988ee | 493 | bitAlto_H = round(bitRazao_1[0]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 494 | bitAlto_L = round(bitRazao_1[1]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 495 | break; |
brunofgc | 0:1c0a769988ee | 496 | case 5: |
brunofgc | 0:1c0a769988ee | 497 | bitAlto_H = round(bitRazao_0_5[0]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 498 | bitAlto_L = round(bitRazao_0_5[1]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 499 | break; |
brunofgc | 0:1c0a769988ee | 500 | case 6: |
brunofgc | 0:1c0a769988ee | 501 | bitAlto_H = round(bitRazao_0_25[0]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 502 | bitAlto_L = round(bitRazao_0_25[1]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 503 | break; |
brunofgc | 0:1c0a769988ee | 504 | case 7: |
brunofgc | 0:1c0a769988ee | 505 | bitAlto_H = round(bitRazao_0_125[0]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 506 | bitAlto_L = round(bitRazao_0_125[1]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 507 | break; |
brunofgc | 0:1c0a769988ee | 508 | case 8: |
brunofgc | 0:1c0a769988ee | 509 | bitAlto_H = round(bitRazao_menorQue_0_125[0]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 510 | bitAlto_L = round(bitRazao_menorQue_0_125[1]/indiceMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 511 | break; |
brunofgc | 0:1c0a769988ee | 512 | } |
brunofgc | 0:1c0a769988ee | 513 | |
brunofgc | 0:1c0a769988ee | 514 | //Calculando bitBaixo |
brunofgc | 0:1c0a769988ee | 515 | switch(indiceSegundoMaiorNEventos[1]){ |
brunofgc | 0:1c0a769988ee | 516 | case 0: |
brunofgc | 0:1c0a769988ee | 517 | bitBaixo_H = round(bitRazao_maiorQue4[0]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 518 | bitBaixo_L = round(bitRazao_maiorQue4[1]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 519 | break; |
brunofgc | 0:1c0a769988ee | 520 | case 1: |
brunofgc | 0:1c0a769988ee | 521 | bitBaixo_H = round(bitRazao_4[0]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 522 | bitBaixo_L = round(bitRazao_4[1]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 523 | break; |
brunofgc | 0:1c0a769988ee | 524 | case 2: |
brunofgc | 0:1c0a769988ee | 525 | bitBaixo_H = round(bitRazao_3[0]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 526 | bitBaixo_L = round(bitRazao_3[1]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 527 | break; |
brunofgc | 0:1c0a769988ee | 528 | case 3: |
brunofgc | 0:1c0a769988ee | 529 | bitBaixo_H = round(bitRazao_2[0]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 530 | bitBaixo_L = round(bitRazao_2[1]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 531 | break; |
brunofgc | 0:1c0a769988ee | 532 | case 4: |
brunofgc | 0:1c0a769988ee | 533 | bitBaixo_H = round(bitRazao_1[0]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 534 | bitBaixo_L = round(bitRazao_1[1]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 535 | break; |
brunofgc | 0:1c0a769988ee | 536 | case 5: |
brunofgc | 0:1c0a769988ee | 537 | bitBaixo_H = round(bitRazao_0_5[0]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 538 | bitBaixo_L = round(bitRazao_0_5[1]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 539 | break; |
brunofgc | 0:1c0a769988ee | 540 | case 6: |
brunofgc | 0:1c0a769988ee | 541 | bitBaixo_H = round(bitRazao_0_25[0]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 542 | bitBaixo_L = round(bitRazao_0_25[1]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 543 | break; |
brunofgc | 0:1c0a769988ee | 544 | case 7: |
brunofgc | 0:1c0a769988ee | 545 | bitBaixo_H = round(bitRazao_0_125[0]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 546 | bitBaixo_L = round(bitRazao_0_125[1]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 547 | break; |
brunofgc | 0:1c0a769988ee | 548 | case 8: |
brunofgc | 0:1c0a769988ee | 549 | bitBaixo_H = round(bitRazao_menorQue_0_125[0]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 550 | bitBaixo_L = round(bitRazao_menorQue_0_125[1]/indiceSegundoMaiorNEventos[0]); |
brunofgc | 0:1c0a769988ee | 551 | break; |
brunofgc | 0:1c0a769988ee | 552 | } |
brunofgc | 0:1c0a769988ee | 553 | |
brunofgc | 0:1c0a769988ee | 554 | printf("\n\nFinalmente.\n"); |
brunofgc | 0:1c0a769988ee | 555 | printf("startBitAlto = %ld, startBitBaixo = %ld\n", startBitAlto,startBitBaixo); |
brunofgc | 0:1c0a769988ee | 556 | printf("bitAlto_H = %ld bitAlto_l = %ld\n",bitAlto_H,bitAlto_L); |
brunofgc | 0:1c0a769988ee | 557 | printf("bitBaixo_H = %ld bitBaixo_l = %ld\n",bitBaixo_H,bitBaixo_L); |
brunofgc | 0:1c0a769988ee | 558 | printf("stopBitAlto = %ld\n",stopBitAlto); |
brunofgc | 0:1c0a769988ee | 559 | |
brunofgc | 0:1c0a769988ee | 560 | return; |
brunofgc | 0:1c0a769988ee | 561 | }*/ |