Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: UAVCAN UAVCAN_Subscriber
uc_transfer.cpp
00001 /* 00002 * Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com> 00003 */ 00004 00005 #include <uavcan/transport/transfer.hpp> 00006 #include <uavcan/transport/frame.hpp> 00007 #include <uavcan/transport/can_io.hpp> 00008 00009 namespace uavcan 00010 { 00011 /** 00012 * TransferPriority 00013 */ 00014 const uint8_t TransferPriority::BitLen; 00015 const uint8_t TransferPriority::NumericallyMax; 00016 const uint8_t TransferPriority::NumericallyMin; 00017 00018 const TransferPriority TransferPriority::Default((1U << BitLen) / 2); 00019 const TransferPriority TransferPriority::MiddleLower((1U << BitLen) / 2 + (1U << BitLen) / 4); 00020 const TransferPriority TransferPriority::OneHigherThanLowest(NumericallyMax - 1); 00021 const TransferPriority TransferPriority::OneLowerThanHighest(NumericallyMin + 1); 00022 const TransferPriority TransferPriority::Lowest(NumericallyMax); 00023 00024 /** 00025 * TransferID 00026 */ 00027 const uint8_t TransferID::BitLen; 00028 const uint8_t TransferID::Max; 00029 const uint8_t TransferID::Half; 00030 00031 /** 00032 * NodeID 00033 */ 00034 const uint8_t NodeID::ValueBroadcast; 00035 const uint8_t NodeID::ValueInvalid; 00036 const uint8_t NodeID::BitLen; 00037 const uint8_t NodeID::Max; 00038 const uint8_t NodeID::MaxRecommendedForRegularNodes; 00039 const NodeID NodeID::Broadcast(ValueBroadcast); 00040 00041 /** 00042 * TransferID 00043 */ 00044 int TransferID::computeForwardDistance(TransferID rhs) const 00045 { 00046 int d = int(rhs.get()) - int(get()); 00047 if (d < 0) 00048 { 00049 d += 1 << BitLen; 00050 } 00051 00052 UAVCAN_ASSERT(((get() + d) & Max) == rhs.get()); 00053 return d; 00054 } 00055 00056 }
Generated on Tue Jul 12 2022 17:17:35 by
