diff --git a/.idea/misc.xml b/.idea/misc.xml index 35b6f9f..bce41e5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -21,4 +21,5 @@ + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f3f4cb1..094b935 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,6 +165,8 @@ target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE target_sources(${CMAKE_PROJECT_NAME} PRIVATE User_Code/bsp/fdcan/bsp_fdcan.c User_Code/bsp/spi/bsp_spi.c + User_Code/bsp/delayticks/delayticks.c + User_Code/module/periph/ws2812/ws2812.c # Add user sources here ) @@ -172,6 +174,9 @@ target_sources(${CMAKE_PROJECT_NAME} PRIVATE target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE User_Code/bsp/fdcan User_Code/bsp/spi + User_Code/bsp/delayticks + User_Code/module/periph/ws2812 + User_Code/module/paramdef # Add user defined include paths ) diff --git a/User_Code/application/indicator_app/ws2812status.c b/User_Code/application/indicator_app/ws2812status.c index e56eebb..7ca6064 100644 --- a/User_Code/application/indicator_app/ws2812status.c +++ b/User_Code/application/indicator_app/ws2812status.c @@ -17,7 +17,7 @@ //真的有点抽象了不太清楚什么问题,24V的时候用16的分频器可以 5V时候就只能用32的分频器了 spi6的 这个之后注意一下吧 如果要开发还是用32的分频器。 /*---------------------INCLUDES----------------------*/ -#include "ws2812Task.h" +#include "ws2812status.h" #include "ws2812.h" #include "cmsis_os.h" #include "tim.h" @@ -37,21 +37,6 @@ uint8_t b = 0; */ void ws2812Task(void const *argument) { while (1) { - ////Test for mode changes - // if(HAL_GPIO_ReadPin(USER_KEY_GPIO_Port, USER_KEY_Pin) == 0) // 读取用户按键状态,可以用于调试或其他功能 - // { - // delay_ticks(50); - // if(HAL_GPIO_ReadPin(USER_KEY_GPIO_Port, USER_KEY_Pin) == 0) - // { - // RobotMode ++; - // if (RobotMode > 5) - // { - // RobotMode = 0; // 如果超过最大模式,则重置为0 - // } - // } - // } - // else{} - switch (RobotMode) { case NORMAL_MODE: BlinkGreen(); @@ -74,7 +59,6 @@ void ws2812Task(void const *argument) { default: BlinkYellow(); } - osDelay(10); // 每个任务最后都要写在while里,要不然会导致任务切换失败 } } diff --git a/User_Code/application/indicator_app/ws2812status.h b/User_Code/application/indicator_app/ws2812status.h index 214f13a..d803b2a 100644 --- a/User_Code/application/indicator_app/ws2812status.h +++ b/User_Code/application/indicator_app/ws2812status.h @@ -1,5 +1,5 @@ -#ifndef ws2812Task_H -#define ws2812Task_H +#ifndef ws2812status_H +#define ws2812status_H /*---------------------INCLUDES----------------------*/ #include "main.h" @@ -24,5 +24,4 @@ void BlinkCyan(void); void BlinkPurple(void); - #endif diff --git a/User_Code/module/periph/ws2812/ws2812.h b/User_Code/module/periph/ws2812/ws2812.h index c8db4b1..4e9cbd1 100644 --- a/User_Code/module/periph/ws2812/ws2812.h +++ b/User_Code/module/periph/ws2812/ws2812.h @@ -1,11 +1,9 @@ #ifndef WS2812_H #define WS2812_H - #include "main.h" - -#define WS2812_SPI_UNIT hspi6 +#define WS2812_SPI_UNIT hspi6 extern SPI_HandleTypeDef WS2812_SPI_UNIT; void WS2812_Ctrl(uint8_t r, uint8_t g, uint8_t b);