Skip to content

Commit 3824df1

Browse files
committed
Add tinycbor
1 parent 5e0e737 commit 3824df1

18 files changed

+5846
-0
lines changed

src/Arduino_TinyCBOR.h

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
This file is part of the Arduino_CloudUtils library.
3+
4+
Copyright (c) 2024 Arduino SA
5+
6+
This Source Code Form is subject to the terms of the Mozilla Public
7+
License, v. 2.0. If a copy of the MPL was not distributed with this
8+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
9+
*/
10+
#pragma once
11+
12+
#include "./tinycbor/cbor-lib.h"

src/tinycbor/cbor-lib.h

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* cbor implementation based on Intel tinycbor under MIT license */
2+
3+
#ifndef CBOR_LIB_H
4+
#define CBOR_LIB_H
5+
6+
/******************************************************************************
7+
INCLUDE
8+
******************************************************************************/
9+
10+
#include "src/cbor.h"
11+
12+
/******************************************************************************
13+
* DEFINE
14+
******************************************************************************/
15+
16+
#ifndef CHECK_CBOR
17+
#define CHECK_CBOR(expr) \
18+
do { \
19+
CborError error = CborNoError; \
20+
error = (expr); \
21+
if (CborNoError != error) \
22+
return error; \
23+
} while(0);
24+
#endif /* CHECK_CBOR */
25+
26+
#ifndef CHECK_CBOR_MULTI
27+
#define CHECK_CBOR_MULTI(expr) \
28+
do { \
29+
CborError error = CborNoError; \
30+
error = (expr); \
31+
if (CborErrorOutOfMemory == error) \
32+
return CborErrorSplitItems; \
33+
if (CborNoError != error) \
34+
return error; \
35+
} while(0);
36+
#endif /* CHECK_CBOR_MULTI */
37+
38+
#endif

0 commit comments

Comments
 (0)