/** * @file * @brief RTOS MemPool implementation. */ #ifndef STA_RTOS_MEMPOOL_HPP #define STA_RTOS_MEMPOOL_HPP #include #include namespace sta { /** * @brief Interface object for using CMSIS RTOS2 MemPool. * * @tparam Message type * * @ingroup STA_RTOS_API */ template class RtosMemPool { public: using Message = T; /**< Queue message type */ public: // Default Constructor RtosMemPool(); /** * @brief Create a memory pool. * * @param block_count names the amount of blocks. * @param block_size names the size of each block. */ RtosMemPool(uint32_t block_count, uint32_t block_size); /** * @brief Allocate a new Memory Block. * * @param timeout names the timeout in milliseconds. */ void * alloc(uint32_t timeout); /** * @brief Free a Memory Block. * * @param block names the block to free. */ void free(void *block); private: osMemoryPoolId_t handle_; /**< CMSIS RTOS2 queue handle */ }; } // namespace sta #include #endif // STA_RTOS_MEMPOOL_HPP