Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Branch:
- RF24_library_test_tx
- Revision:
- 17:6ae73e8943ce
- Parent:
- 16:7a78838b3b8a
- Child:
- 18:2342aa54dc9b
--- a/main.cpp Sat Dec 01 17:29:32 2018 +0000
+++ b/main.cpp Sat Dec 01 17:40:15 2018 +0000
@@ -39,16 +39,17 @@
printf("I'm Master\r\n");
initNRF();
dumpRFInfo();
-
+
memset(buffer, NULL, BUFFER_SIZE);
while(1) {
int result = readSerialUntil(buffer, BUFFER_SIZE, DATA_PROTOCOL_END);
if(result>0) {
char *data = inspectData(buffer, BUFFER_SIZE);
- printf("Data: %s\r\n", data);
- free(data);
-
+ if(*data == DATA_PROTOCOL_BEGIN) {
+ printf("Data: %s\r\n", data);
+ free(data);
+ }
}
/*
while(pc.readable()) {
@@ -81,10 +82,10 @@
if(i==buf_len) return 0;
}
int data_len = end-start+1;
-
+
char *str = (char*)malloc(sizeof(char)*(data_len+1));
memset(str, NULL, data_len+1);
- for(int i=0; i<data_len+1; i++){
+ for(int i=0; i<data_len; i++) {
*(str+i) = buffer[start+i];
}
return str;