-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
729 additions
and
299 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ unishox | |
unishox1 | ||
!unishox1/ | ||
usx3 | ||
u3b | ||
tex/.* | ||
unishox2 | ||
unishox++_0_1_0 | ||
|
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,22 @@ | ||
// Example sketch to demonstrate use of buffer size limiting for compression and decompression | ||
#include "unishox2.h" | ||
#include <Arduino.h> | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
char cbuf[8]; // Restrict buffer size to check that it does not overflow | ||
char dbuf[8]; | ||
int clen, dlen; | ||
clen = unishox2_compress_lines("Hello World", 11, cbuf, sizeof(cbuf) - 1, USX_PSET_DFLT, NULL); | ||
clen = 8; // clen would have been -1 since buffer was not sufficient | ||
dlen = unishox2_decompress_lines(cbuf, clen, dbuf, sizeof(dbuf) - 1, USX_PSET_DFLT, NULL); | ||
dlen = 7; | ||
dbuf[dlen] = '\0'; | ||
Serial.print("Decompressed output: "); | ||
Serial.println(dbuf); | ||
} | ||
|
||
void loop() { | ||
// put your main code here, to run repeatedly: | ||
|
||
} |
Oops, something went wrong.