Versão do protegemed que calcula o tempo em ms da fuga, calcula o numero de onverflow (valores muito baixo) e underflow (valores muito altos). Além disso, calcula um valor médio a partir dos valores capturados e não apenas pela fft.
Dependencies: EthernetInterface mbed-rtos mbed
Functions/Split.c@2:86c3cb25577b, 2014-07-21 (annotated)
- Committer:
- rebonatto
- Date:
- Mon Jul 21 00:58:34 2014 +0000
- Revision:
- 2:86c3cb25577b
- Parent:
- 0:c64e1194230b
Problemas com objeto para aquisi??o da rfid (serial)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rebonatto | 0:c64e1194230b | 1 | /* |
rebonatto | 0:c64e1194230b | 2 | * Split.c |
rebonatto | 0:c64e1194230b | 3 | * |
rebonatto | 0:c64e1194230b | 4 | * Created on: 12/04/2012 |
rebonatto | 0:c64e1194230b | 5 | * Author: francisco |
rebonatto | 0:c64e1194230b | 6 | */ |
rebonatto | 0:c64e1194230b | 7 | |
rebonatto | 0:c64e1194230b | 8 | #include "Split.h" |
rebonatto | 0:c64e1194230b | 9 | |
rebonatto | 0:c64e1194230b | 10 | int split(char* str,char* delim,char*** ret ) |
rebonatto | 0:c64e1194230b | 11 | { |
rebonatto | 0:c64e1194230b | 12 | char *p = NULL; |
rebonatto | 0:c64e1194230b | 13 | char *e = NULL; |
rebonatto | 0:c64e1194230b | 14 | char **array = NULL; |
rebonatto | 0:c64e1194230b | 15 | int qty = 0; |
rebonatto | 0:c64e1194230b | 16 | int len = strlen(str); |
rebonatto | 0:c64e1194230b | 17 | |
rebonatto | 0:c64e1194230b | 18 | p = str; |
rebonatto | 0:c64e1194230b | 19 | |
rebonatto | 0:c64e1194230b | 20 | e = strstr(p,delim); |
rebonatto | 0:c64e1194230b | 21 | |
rebonatto | 0:c64e1194230b | 22 | while( e != NULL) |
rebonatto | 0:c64e1194230b | 23 | { |
rebonatto | 0:c64e1194230b | 24 | qty++; |
rebonatto | 0:c64e1194230b | 25 | if(qty==1) |
rebonatto | 0:c64e1194230b | 26 | array = (char**)malloc(sizeof(char*)*qty); |
rebonatto | 0:c64e1194230b | 27 | else |
rebonatto | 0:c64e1194230b | 28 | array = (char**)realloc(array,sizeof(char*)*qty); |
rebonatto | 0:c64e1194230b | 29 | |
rebonatto | 0:c64e1194230b | 30 | array[qty-1] = p; |
rebonatto | 0:c64e1194230b | 31 | *e = '\0'; |
rebonatto | 0:c64e1194230b | 32 | p = e + strlen(delim); |
rebonatto | 0:c64e1194230b | 33 | e = strstr(p,delim); |
rebonatto | 0:c64e1194230b | 34 | } |
rebonatto | 0:c64e1194230b | 35 | if(p-str < len) |
rebonatto | 0:c64e1194230b | 36 | { |
rebonatto | 0:c64e1194230b | 37 | qty++; |
rebonatto | 0:c64e1194230b | 38 | if(qty==1) |
rebonatto | 0:c64e1194230b | 39 | array = (char**)malloc(sizeof(char*)*qty); |
rebonatto | 0:c64e1194230b | 40 | else |
rebonatto | 0:c64e1194230b | 41 | array = (char**)realloc(array,sizeof(char*)*qty); |
rebonatto | 0:c64e1194230b | 42 | array[qty-1] = p; |
rebonatto | 0:c64e1194230b | 43 | } |
rebonatto | 0:c64e1194230b | 44 | |
rebonatto | 0:c64e1194230b | 45 | *ret = array; |
rebonatto | 0:c64e1194230b | 46 | return qty; |
rebonatto | 0:c64e1194230b | 47 | } |