Skip to content

Add tinycbor #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc
# See: https://github.com/codespell-project/codespell#using-a-config-file
[codespell]
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
ignore-words-list = ,
skip = ./.git,./.licenses,__pycache__,node_modules,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock,./src/tinycbor
builtin = clear,informal,en-GB_to_en-US
check-filenames =
check-hidden =
12 changes: 12 additions & 0 deletions src/Arduino_TinyCBOR.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
This file is part of the Arduino_CloudUtils library.

Copyright (c) 2024 Arduino SA

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once

#include "./tinycbor/cbor-lib.h"
5 changes: 5 additions & 0 deletions src/tinycbor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TinyCBOR

This folder contains a copy of the externally managed Intel TinyCBOR repository

The code is based on https://github.com/intel/tinycbor/releases/tag/v0.5.2 with some minor [modifications](patch/patch.diff).
38 changes: 38 additions & 0 deletions src/tinycbor/cbor-lib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* cbor implementation based on Intel tinycbor under MIT license */

#ifndef CBOR_LIB_H
#define CBOR_LIB_H

/******************************************************************************
INCLUDE
******************************************************************************/

#include "src/cbor.h"

/******************************************************************************
* DEFINE
******************************************************************************/

#ifndef CHECK_CBOR
#define CHECK_CBOR(expr) \
do { \
CborError error = CborNoError; \
error = (expr); \
if (CborNoError != error) \
return error; \
} while(0);
#endif /* CHECK_CBOR */

#ifndef CHECK_CBOR_MULTI
#define CHECK_CBOR_MULTI(expr) \
do { \
CborError error = CborNoError; \
error = (expr); \
if (CborErrorOutOfMemory == error) \
return CborErrorSplitItems; \
if (CborNoError != error) \
return error; \
} while(0);
#endif /* CHECK_CBOR_MULTI */

#endif
Loading
Loading