project de marde si tu touch le no-homo s'applique pas

Fork of XBeeLib by Digi International Inc.

Committer:
Spip2401
Date:
Tue Apr 10 17:46:50 2018 +0000
Revision:
10:6621b0299d89
Parent:
4:629712865107
project de marde pas touche

Who changed what in which revision?

UserRevisionLine numberNew contents of line
spastor 0:fcaad0dfa051 1 /**
spastor 0:fcaad0dfa051 2 * Copyright (c) 2015 Digi International Inc.,
spastor 0:fcaad0dfa051 3 * All rights not expressly granted are reserved.
spastor 0:fcaad0dfa051 4 *
spastor 0:fcaad0dfa051 5 * This Source Code Form is subject to the terms of the Mozilla Public
spastor 0:fcaad0dfa051 6 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
spastor 0:fcaad0dfa051 7 * You can obtain one at http://mozilla.org/MPL/2.0/.
spastor 0:fcaad0dfa051 8 *
spastor 0:fcaad0dfa051 9 * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
spastor 0:fcaad0dfa051 10 * =======================================================================
spastor 0:fcaad0dfa051 11 */
spastor 4:629712865107 12
spastor 0:fcaad0dfa051 13 #include "Utils.h"
hbujanda 2:2ee1b6d51df2 14 #include <string.h>
spastor 0:fcaad0dfa051 15
spastor 0:fcaad0dfa051 16 void rmemcpy(uint8_t * const dest, const uint8_t * const src, uint16_t bytes)
spastor 0:fcaad0dfa051 17 {
spastor 0:fcaad0dfa051 18 uint8_t *destp = dest + bytes - 1;
spastor 0:fcaad0dfa051 19 uint8_t *srcp = (uint8_t *)src;
spastor 0:fcaad0dfa051 20
spastor 0:fcaad0dfa051 21 while (destp >= dest)
spastor 0:fcaad0dfa051 22 *destp-- = *srcp++;
spastor 0:fcaad0dfa051 23 }
spastor 0:fcaad0dfa051 24
spastor 0:fcaad0dfa051 25 uint64_t addr64_from_uint8_t(const uint8_t * const data, bool big_endian = true)
spastor 0:fcaad0dfa051 26 {
spastor 0:fcaad0dfa051 27 int64_t addr64;
spastor 0:fcaad0dfa051 28 if (big_endian) {
spastor 0:fcaad0dfa051 29 rmemcpy((uint8_t *)&addr64, data, 8);
spastor 0:fcaad0dfa051 30 } else {
spastor 0:fcaad0dfa051 31 memcpy((uint8_t *)&addr64, data, 8);
spastor 0:fcaad0dfa051 32 }
spastor 0:fcaad0dfa051 33 return addr64;
spastor 0:fcaad0dfa051 34 }