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.
Dependencies: mbed msgpack-embedded
Revision 0:6eee3d4779f1, committed 2017-10-22
- Comitter:
- MACRUM
- Date:
- Sun Oct 22 02:10:47 2017 +0000
- Commit message:
- Initial commit
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Oct 22 02:10:47 2017 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+#include "msgpack-embedded.h"
+
+int main(void) {
+
+ /* creates buffer and serializer instance. */
+ msgpack_sbuffer* buffer = msgpack_sbuffer_new();
+ msgpack_packer* pk = msgpack_packer_new(buffer, msgpack_sbuffer_write);
+
+ msgpack_sbuffer_clear(buffer);
+ msgpack_pack_array(pk, 2); // number of array
+
+ msgpack_pack_uint8(pk, 2); // e.g. sensor ID
+ msgpack_pack_uint8(pk, 19); // e.g. distance (cm)
+
+ printf("buffer size = %d\n", buffer->size);
+
+ printf("buffer = ");
+ for(int i = 0; i < buffer->size; i++) {
+ printf("0x%02x, ", buffer->data[i]);
+ }
+ printf("\n");
+
+ /* cleaning */
+ msgpack_sbuffer_free(buffer);
+ msgpack_packer_free(pk);
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Oct 22 02:10:47 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b484a57bc302 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/msgpack-embedded.lib Sun Oct 22 02:10:47 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/hideakitai/code/msgpack-embedded/#bd0c06dd6e92