diff --git a/docs/代码规范/代码规范.md b/docs/代码规范/代码规范.md index 3ceaf3b..b35f1fe 100644 --- a/docs/代码规范/代码规范.md +++ b/docs/代码规范/代码规范.md @@ -43,7 +43,7 @@ lv_input_device_driver_t mouse_input; **所有**函数采用驼峰命名法。 ```C -int strLength(char* str); +int StrLength(char* str); ``` ### 代码风格 diff --git a/include/bus.h b/include/bus.h index ff85bc1..514afd9 100644 --- a/include/bus.h +++ b/include/bus.h @@ -5,7 +5,7 @@ #include "rail.h" #include "query.h" -struct { +struct bus { /** * 指向站点的指针 */ @@ -14,7 +14,7 @@ struct { * 当前行进的距离 */ int distance; -} bus; +}; /** * 表示公交车的结构体 diff --git a/include/bus_io.h b/include/bus_io.h index a140e72..3775d66 100644 --- a/include/bus_io.h +++ b/include/bus_io.h @@ -11,11 +11,11 @@ enum read_state{ /** * 时钟 */ - clock = 0, + io_clock = 0, /** * 读取中 */ - reading, + io_reading, /** * 结束 */ diff --git a/include/query.h b/include/query.h index 68c1c91..7e672c4 100644 --- a/include/query.h +++ b/include/query.h @@ -4,9 +4,10 @@ #ifndef AUTO_PILOT_BUS_QUERY_H #define AUTO_PILOT_BUS_QUERY_H +#include "stdlib.h" #include "rail.h" -struct { +struct up_bus { /** * 请求的序号 */ @@ -20,9 +21,9 @@ struct { */ rail_node_t* target; struct up_bus* next; -} up_bus; +}; -struct { +struct down_bus { /** * 请求的序号 */ @@ -32,7 +33,7 @@ struct { */ rail_node_t* target; struct down_bus* next; -} down_bus; +}; /** * 表示上车请求的结构体 diff --git a/include/rail.h b/include/rail.h index 8f98f75..8b460ec 100644 --- a/include/rail.h +++ b/include/rail.h @@ -1,7 +1,8 @@ #ifndef AUTO_PILOT_BUS_RAIL_H #define AUTO_PILOT_BUS_RAIL_H +#include "stdlib.h" -struct { +struct rail_node { /** * 站点的编号 */ @@ -22,7 +23,7 @@ struct { * 指向下一个站点的指针 */ struct rail_node* next_node; -} rail_node; +}; /** * 表示轨道上的一个站点的结构体 diff --git a/src/query.c b/src/query.c index e3e149e..c705912 100644 --- a/src/query.c +++ b/src/query.c @@ -3,6 +3,6 @@ // #include "query.h" -up_bus_t* up_queries; -down_bus_t *down_queries; +up_bus_t* up_queries = NULL; +down_bus_t *down_queries = NULL; diff --git a/src/rail.c b/src/rail.c index 0dd3efd..721e09f 100644 --- a/src/rail.c +++ b/src/rail.c @@ -1,6 +1,6 @@ #include "rail.h" -rail_node_t *rails; +rail_node_t *rails = NULL; int add(int a, int b) {