Initial import of STM32 IoT sensor node

This commit is contained in:
yzfh
2026-10-19 15:47:18 +08:00
commit a51794b022
100 changed files with 46274 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
#ifndef __QUEUE_H
#define __QUEUE_H
#define QUEUE_DATA_SIZE (64) // 定义队列内存储空间
struct queue
{
char data[QUEUE_DATA_SIZE]; // 用来保存数据
unsigned short int head; // 队列头位置索引。
unsigned short int tail; // 队列尾位置索引。
};
// 1. 初始化队列
void queue_init(struct queue *pq);
// 2. 队列空判断, 空返回1, 否则返回0
int queue_is_empty(struct queue *pq);
// 3. 队列满判断, 满返回1, 否则返回0
int queue_is_full(struct queue *pq);
// 4. 入队, 成功返回1 ,失败返回0
int queue_enqueue(struct queue *pq, int value);
// 5. 出队, 成功返回1 ,失败返回0
int queue_dequeue(struct queue *pq, int *pvalue);
// 7. 清空队列
void queue_clear(struct queue *pq);
#endif // _QUEUE_H