Skip to content

Commit b9b8137

Browse files
authored
Merge pull request #5 from pennam/cbor
Add tinycbor
2 parents d6d4547 + 1cbabf2 commit b9b8137

21 files changed

+6267
-0
lines changed

.codespellrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc
2+
# See: https://github.com/codespell-project/codespell#using-a-config-file
3+
[codespell]
4+
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
5+
ignore-words-list = ,
6+
skip = ./.git,./.licenses,__pycache__,node_modules,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock,./src/tinycbor
7+
builtin = clear,informal,en-GB_to_en-US
8+
check-filenames =
9+
check-hidden =

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/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# TinyCBOR
2+
3+
This folder contains a copy of the externally managed Intel TinyCBOR repository
4+
5+
The code is based on https://github.com/intel/tinycbor/releases/tag/v0.5.2 with some minor [modifications](patch/patch.diff).

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)