FifoQueue.h 1003 B

123456789101112131415161718192021222324252627282930
  1. #ifndef _FIFOQUEUE_H
  2. #define _FIFOQUEUE_H
  3. /* 包含的头文件-----------------------------------------------------------*/
  4. #include "stm32f10x.h"
  5. #include <stdbool.h>
  6. /* 宏定义 --------------------------------------------------------------------*/
  7. #define uint8 u8
  8. #define uint16 u16
  9. #define ElemType uint8
  10. #define QueueSize 20 //fifo队列的大小
  11. /* 类型定义 -----------------------------------------------------------------*/
  12. struct FifoQueue
  13. {
  14. uint16 front; //队列头
  15. uint16 rear; //队列尾
  16. uint16 count; //队列计数
  17. ElemType dat[QueueSize];
  18. };
  19. /* 常量定义 ----------------------------------------------------------------*/
  20. extern struct FifoQueue Fas_Tasks;
  21. extern struct FifoQueue Pub_Tasks;
  22. /* 函数定义---------------------------------------------------------------- */
  23. extern void QueueInit ( struct FifoQueue *Queue );
  24. extern bool QueueIn ( struct FifoQueue *Queue, ElemType sdat );
  25. extern bool QueueOut ( struct FifoQueue *Queue, ElemType *sdat );
  26. #endif