mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 16:33:33 +08:00
Heavy optimizations for ROM/RAM usage in UAVCAN_TINY mode
This commit is contained in:
@@ -298,6 +298,9 @@ public:
|
||||
TransferBufferManager(IPoolAllocator& allocator)
|
||||
: TransferBufferManagerImpl(MaxBufSize, allocator)
|
||||
{
|
||||
#if UAVCAN_TINY
|
||||
StaticAssert<(NumStaticBufs == 0)>::check(); // Static buffers in UAVCAN_TINY mode are not allowed
|
||||
#endif
|
||||
StaticAssert<(MaxBufSize > 0)>::check();
|
||||
}
|
||||
};
|
||||
@@ -305,7 +308,7 @@ public:
|
||||
template <uint16_t MaxBufSize>
|
||||
class UAVCAN_EXPORT TransferBufferManager<MaxBufSize, 0> : public TransferBufferManagerImpl
|
||||
{
|
||||
StaticTransferBufferManagerEntry<MaxBufSize>* getStaticByIndex(uint16_t index) const
|
||||
StaticTransferBufferManagerEntry<MaxBufSize>* getStaticByIndex(uint16_t) const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -150,6 +150,10 @@ public:
|
||||
, bufmgr_(allocator)
|
||||
, receivers_(allocator)
|
||||
{
|
||||
#if UAVCAN_TINY
|
||||
StaticAssert<NumStaticBufs == 0>::check();
|
||||
StaticAssert<NumStaticReceivers == 0>::check();
|
||||
#endif
|
||||
StaticAssert<(NumStaticReceivers >= NumStaticBufs)>::check(); // Otherwise it would be meaningless
|
||||
}
|
||||
|
||||
@@ -164,7 +168,12 @@ public:
|
||||
* This class should be derived by callers.
|
||||
*/
|
||||
template <unsigned MaxBufSize>
|
||||
class UAVCAN_EXPORT ServiceResponseTransferListener : public TransferListener<MaxBufSize, 1, 1>
|
||||
class UAVCAN_EXPORT ServiceResponseTransferListener
|
||||
#if UAVCAN_TINY
|
||||
: public TransferListener<MaxBufSize, 0, 0>
|
||||
#else
|
||||
: public TransferListener<MaxBufSize, 1, 1>
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
struct ExpectedResponseParams
|
||||
|
||||
Reference in New Issue
Block a user