protegemed, aquisição via A/D simples utilizando interrupção do timer

Dependencies:   EthernetInterface NTPClient mbed-rtos mbed

Fork of ptgm_semDMA by Marcelo Rebonatto

Revision:
0:fac116e94d44
diff -r 000000000000 -r fac116e94d44 Functions/Split.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Functions/Split.c	Tue Jan 05 11:47:35 2016 +0000
@@ -0,0 +1,47 @@
+/*
+ * Split.c
+ *
+ *  Created on: 12/04/2012
+ *      Author: francisco
+ */
+
+#include "Split.h"
+
+int split(char* str,char* delim,char*** ret )
+{
+    char *p = NULL;
+    char *e = NULL;
+    char **array = NULL;
+    int qty = 0;
+    int len = strlen(str);
+
+    p = str;
+
+    e = strstr(p,delim);
+
+    while( e != NULL)
+    {
+        qty++;
+        if(qty==1)
+            array = (char**)malloc(sizeof(char*)*qty);
+        else
+            array = (char**)realloc(array,sizeof(char*)*qty);
+
+        array[qty-1] = p;
+        *e = '\0';
+        p = e + strlen(delim);
+        e = strstr(p,delim);
+    }
+    if(p-str < len)
+    {
+        qty++;
+        if(qty==1)
+            array = (char**)malloc(sizeof(char*)*qty);
+        else
+            array = (char**)realloc(array,sizeof(char*)*qty);
+        array[qty-1] = p;
+    }
+
+    *ret = array;
+    return qty;
+}