Device interface library for multiple platforms including Mbed.

Dependents:   DeepCover Embedded Security in IoT MaximInterface MAXREFDES155#

Maxim Interface is a library framework focused on providing flexible and expressive hardware interfaces. Both communication interfaces such as I2C and 1-Wire and device interfaces such as DS18B20 are supported. Modern C++ concepts are used extensively while keeping compatibility with C++98/C++03 and requiring no external dependencies. The embedded-friendly design does not depend on exceptions or RTTI.

The full version of the project is hosted on GitLab: https://gitlab.com/iabenz/MaximInterface

Committer:
IanBenzMaxim
Date:
Tue Dec 03 10:52:28 2019 -0600
Revision:
11:3f3bf6bf5e6c
Parent:
10:947d3f44e0a0
Updated to version 2.1.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IanBenzMaxim 8:5ea891c7d1a1 1 /*******************************************************************************
IanBenzMaxim 8:5ea891c7d1a1 2 * Copyright (C) Maxim Integrated Products, Inc., All Rights Reserved.
IanBenzMaxim 8:5ea891c7d1a1 3 *
IanBenzMaxim 8:5ea891c7d1a1 4 * Permission is hereby granted, free of charge, to any person obtaining a
IanBenzMaxim 8:5ea891c7d1a1 5 * copy of this software and associated documentation files (the "Software"),
IanBenzMaxim 8:5ea891c7d1a1 6 * to deal in the Software without restriction, including without limitation
IanBenzMaxim 8:5ea891c7d1a1 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
IanBenzMaxim 8:5ea891c7d1a1 8 * and/or sell copies of the Software, and to permit persons to whom the
IanBenzMaxim 8:5ea891c7d1a1 9 * Software is furnished to do so, subject to the following conditions:
IanBenzMaxim 8:5ea891c7d1a1 10 *
IanBenzMaxim 8:5ea891c7d1a1 11 * The above copyright notice and this permission notice shall be included
IanBenzMaxim 8:5ea891c7d1a1 12 * in all copies or substantial portions of the Software.
IanBenzMaxim 8:5ea891c7d1a1 13 *
IanBenzMaxim 8:5ea891c7d1a1 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
IanBenzMaxim 8:5ea891c7d1a1 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
IanBenzMaxim 8:5ea891c7d1a1 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IanBenzMaxim 8:5ea891c7d1a1 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
IanBenzMaxim 8:5ea891c7d1a1 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
IanBenzMaxim 8:5ea891c7d1a1 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
IanBenzMaxim 8:5ea891c7d1a1 20 * OTHER DEALINGS IN THE SOFTWARE.
IanBenzMaxim 8:5ea891c7d1a1 21 *
IanBenzMaxim 8:5ea891c7d1a1 22 * Except as contained in this notice, the name of Maxim Integrated
IanBenzMaxim 8:5ea891c7d1a1 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
IanBenzMaxim 8:5ea891c7d1a1 24 * Products, Inc. Branding Policy.
IanBenzMaxim 8:5ea891c7d1a1 25 *
IanBenzMaxim 8:5ea891c7d1a1 26 * The mere transfer of this software does not imply any licenses
IanBenzMaxim 8:5ea891c7d1a1 27 * of trade secrets, proprietary technology, copyrights, patents,
IanBenzMaxim 8:5ea891c7d1a1 28 * trademarks, maskwork rights, or any other form of intellectual
IanBenzMaxim 8:5ea891c7d1a1 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
IanBenzMaxim 8:5ea891c7d1a1 30 * ownership rights.
IanBenzMaxim 8:5ea891c7d1a1 31 *******************************************************************************/
IanBenzMaxim 8:5ea891c7d1a1 32
IanBenzMaxim 8:5ea891c7d1a1 33 #ifndef MaximInterfaceCore_HexString_hpp
IanBenzMaxim 8:5ea891c7d1a1 34 #define MaximInterfaceCore_HexString_hpp
IanBenzMaxim 8:5ea891c7d1a1 35
IanBenzMaxim 8:5ea891c7d1a1 36 #include <stdint.h>
IanBenzMaxim 8:5ea891c7d1a1 37 #include <string>
IanBenzMaxim 8:5ea891c7d1a1 38 #include <vector>
IanBenzMaxim 8:5ea891c7d1a1 39 #include "Config.hpp"
IanBenzMaxim 8:5ea891c7d1a1 40 #include "Optional.hpp"
IanBenzMaxim 8:5ea891c7d1a1 41 #include "span.hpp"
IanBenzMaxim 8:5ea891c7d1a1 42
IanBenzMaxim 8:5ea891c7d1a1 43 namespace MaximInterfaceCore {
IanBenzMaxim 8:5ea891c7d1a1 44
IanBenzMaxim 8:5ea891c7d1a1 45 /// Convert a byte array to a hex string.
IanBenzMaxim 8:5ea891c7d1a1 46 MaximInterfaceCore_EXPORT std::string
IanBenzMaxim 8:5ea891c7d1a1 47 toHexString(span<const uint_least8_t> byteArray);
IanBenzMaxim 8:5ea891c7d1a1 48
IanBenzMaxim 10:947d3f44e0a0 49 /// @brief Convert a hex string to a byte array.
IanBenzMaxim 10:947d3f44e0a0 50 /// @details Discards whitespace and null characters within the input string.
IanBenzMaxim 8:5ea891c7d1a1 51 MaximInterfaceCore_EXPORT Optional<std::vector<uint_least8_t> >
IanBenzMaxim 10:947d3f44e0a0 52 fromHexString(span<const char> hexString);
IanBenzMaxim 8:5ea891c7d1a1 53
IanBenzMaxim 8:5ea891c7d1a1 54 } // namespace MaximInterfaceCore
IanBenzMaxim 8:5ea891c7d1a1 55
IanBenzMaxim 8:5ea891c7d1a1 56 #endif