-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simpletext support for recent wifi code examples
For #173, added putStrWithNpcVals and sscanAfterStr functions. Temperature from OpenWeathermap updated to search for an exact match to the JSON attribute.
- Loading branch information
1 parent
c9f708d
commit db3fe37
Showing
8 changed files
with
190 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+2.22 KB
(100%)
Learn/Simple Libraries/TextDevices/libsimpletext/cmm/libsimpletext.a
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
Learn/Simple Libraries/TextDevices/libsimpletext/putStrWithNpcVals.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* @file putStrWithNpCVals.c | ||
* Function to print a string to the terminal with non printable characters | ||
* displayed as decimal values in brackets. | ||
* | ||
* Copyright (c) 2018, Parallax Inc. | ||
* Written by Andy Lindsay | ||
*/ | ||
|
||
#include "simpletext.h" | ||
|
||
int putStrWithNpcVals(const char *s) | ||
{ | ||
int size = strlen(s); | ||
for(int n = 0; n <= size; n++) | ||
{ | ||
if(s[n] <= '~' && s[n] >= ' ') | ||
{ | ||
print("%c", s[n]); | ||
} | ||
else if(s[n] == 0) | ||
{ | ||
print("[%d]", s[n]); | ||
break; | ||
} | ||
else if(s[n] == '\n' || s[n] == '\r') | ||
{ | ||
print("[%d]%c", s[n], s[n]); | ||
} | ||
else | ||
{ | ||
print("[%d]", s[n]); | ||
} | ||
//pause(10); | ||
} | ||
//pause(10); | ||
return size; | ||
} | ||
|
||
/* | ||
+-------------------------------------------------------------------- | ||
| TERMS OF USE: MIT License | ||
+-------------------------------------------------------------------- | ||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files | ||
(the "Software"), to deal in the Software without restriction, | ||
including without limitation the rights to use, copy, modify, merge, | ||
publish, distribute, sublicense, and/or sell copies of the Software, | ||
and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
+-------------------------------------------------------------------- | ||
*/ | ||
|
||
|
1 change: 1 addition & 0 deletions
1
Learn/Simple Libraries/TextDevices/libsimpletext/scanAfterStr.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
Learn/Simple Libraries/TextDevices/libsimpletext/sscanAfterStr.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Super-simple text I/O for PropGCC, stripped of all stdio overhead. | ||
* Copyright (c) 2012, Ted Stefanik. Concept inspired by: | ||
* | ||
* very simple printf, adapted from one written by me [Eric Smith] | ||
* for the MiNT OS long ago | ||
* placed in the public domain | ||
* - Eric Smith | ||
* Propeller specific adaptations | ||
* Copyright (c) 2011 Parallax, Inc. | ||
* Written by Eric R. Smith, Total Spectrum Software Inc. | ||
* | ||
* MIT licensed (see terms at end of file) | ||
*/ | ||
|
||
#include <stdlib.h> | ||
#include "simpletext.h" | ||
|
||
//int sscanAfterStr(char *str, char *strAfter, char *fmt, ...) | ||
int sscanAfterStr(char *buffer, char *str, char *fmt, ...){ | ||
char *loc = strstr(buffer, str); | ||
loc += strlen(str); | ||
va_list args; | ||
va_start(args, fmt); | ||
int blocks = _doscanf(loc, fmt, args); | ||
va_end(args); | ||
return blocks; | ||
} | ||
|
||
/* +-------------------------------------------------------------------- | ||
* | TERMS OF USE: MIT License | ||
* +-------------------------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files | ||
* (the "Software"), to deal in the Software without restriction, | ||
* including without limitation the rights to use, copy, modify, merge, | ||
* publish, distribute, sublicense, and/or sell copies of the Software, | ||
* and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* +-------------------------------------------------------------------- | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v1.4.89 | ||
v1.4.94 |