mirror of
https://gitee.com/dlmu-cone/tronone-h7-scaffold
synced 2026-07-23 19:25:09 +08:00
spring
This commit is contained in:
@@ -64,7 +64,8 @@ add_executable(${CMAKE_PROJECT_NAME})
|
||||
# 包含编译选项配置文件
|
||||
include(CompileOptions)
|
||||
# 包含查找模块(当前被注释掉)
|
||||
#include(FindModules)
|
||||
include(FindModules)
|
||||
|
||||
|
||||
# 添加STM32CubeMX生成的源码子目录
|
||||
add_subdirectory(cmake/stm32cubemx)
|
||||
@@ -73,6 +74,7 @@ add_subdirectory(cmake/stm32cubemx)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||
stm32cubemx # STM32CubeMX生成的库
|
||||
# rpl::rpl # 第三方库(当前被注释掉)
|
||||
ems
|
||||
${CMAKE_SOURCE_DIR}/Drivers/CMSIS/DSP/Lib/GCC/libarm_cortexM7lfdp_math.a
|
||||
)
|
||||
|
||||
|
||||
@@ -15,11 +15,37 @@
|
||||
*/
|
||||
|
||||
/*---------------------INCLUDES---------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#include "buzzer.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "tim.h"
|
||||
#include "delayticks.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <ems_parser.hpp>
|
||||
|
||||
|
||||
using namespace ems::literals;
|
||||
constexpr auto spring =
|
||||
R"((400)
|
||||
2s`,,1s`,7,,1s`,2s`-,3`-2s`,1s`,,,
|
||||
2s`,,1s`,7,,1s`,2s`-,3`-2s`,1s`,,,
|
||||
2s`,,1s`,7,,1s`,2s`-,3`-2s`,1s`,,,
|
||||
2s`,,1s`,7,,1s`,2s`-,3`-2s`,1s`,,7-1s`-
|
||||
2s`,2s`,1s`,3`,2s`,1s`,1s`,1s`,7,3`,2s`,1s`,
|
||||
1s`,,7-1s`-2s`,,,,,,7,4s`,7`,
|
||||
6s`,,7`,6s`,,7`,6s`-5s`-4s`,,4s`,1s`,3`,
|
||||
3`,2s`,2s`,2s`,,,3`,2s`,1s`,2s`,,4s`,
|
||||
7,,,
|
||||
)"_ems;
|
||||
|
||||
/*---------------------VARIABLES---------------------*/
|
||||
//
|
||||
// uint8_t buzzer_state = PLAYING_INIT_MUSIC; //当前蜂鸣器播放状态
|
||||
@@ -50,9 +76,11 @@
|
||||
//7 - si - 1976Hz
|
||||
|
||||
//高中低音的实际频率 Hz
|
||||
const uint16_t music_steps[3][7] = {{262, 294, 330, 349, 392, 440, 494},
|
||||
const uint16_t music_steps[3][7] = {
|
||||
{262, 294, 330, 349, 392, 440, 494},
|
||||
{523, 587, 659, 698, 784, 880, 988},
|
||||
{1046, 1175, 1318, 1397, 1568, 1760, 1976}};
|
||||
{1046, 1175, 1318, 1397, 1568, 1760, 1976}
|
||||
};
|
||||
|
||||
//乐谱1:小星星
|
||||
/*const uint16_t song_littlestar[42] = {0x1411,0x1411,0x1415,0x1415,0x1416,0x1416,0x1815,
|
||||
@@ -153,7 +181,6 @@ void SetBuzzerFrequence(uint16_t freq)
|
||||
|
||||
__HAL_TIM_SET_AUTORELOAD(&htim12, period);
|
||||
__HAL_TIM_SET_COMPARE(&htim12, TIM_CHANNEL_2, period/2);
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -286,31 +313,23 @@ void systemstart_song(void)
|
||||
// buzzer_note(120, 0.5); //高音sol
|
||||
// HAL_Delay(550);
|
||||
|
||||
SongSpring(); //为什么要演奏春日影!!!
|
||||
// SongSpring(); //为什么要演奏春日影!!!
|
||||
|
||||
// SongLaoda();
|
||||
SongLaoda();
|
||||
|
||||
buzzer_off();
|
||||
}
|
||||
|
||||
void SongSpring(void) //春日影!!!
|
||||
{
|
||||
buzzer_note(165, 0.5); //mi
|
||||
HAL_Delay(280);
|
||||
buzzer_note(150, 0.5); //re
|
||||
HAL_Delay(280);
|
||||
buzzer_note(135, 0.5); //do
|
||||
HAL_Delay(280);
|
||||
buzzer_note(150, 0.5); //re
|
||||
HAL_Delay(280);
|
||||
buzzer_note(165, 0.5); //mi
|
||||
HAL_Delay(280);
|
||||
buzzer_note(170, 0.5); //fa
|
||||
HAL_Delay(200);
|
||||
buzzer_note(165, 0.5); //mi
|
||||
HAL_Delay(200);
|
||||
buzzer_note(150, 0.5); //re
|
||||
HAL_Delay(300);
|
||||
for (auto [ratio, duration_ms]: spring)
|
||||
{
|
||||
const auto note = static_cast<uint16_t>(ratio * 50); // 523.25Hz是中音do的频率
|
||||
buzzer_note(note, 0.5f);
|
||||
HAL_Delay(duration_ms);
|
||||
// buzzer_off();
|
||||
// HAL_Delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void SongLaoda(void)
|
||||
@@ -1,2 +1,3 @@
|
||||
#include(FetchContent)
|
||||
include(FetchContent)
|
||||
#include(Modules/FindRPL)
|
||||
include(Modules/FindEMS)
|
||||
6
cmake/Modules/FindEMS.cmake
Normal file
6
cmake/Modules/FindEMS.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
FetchContent_Declare(
|
||||
ems
|
||||
GIT_REPOSITORY https://gitee.com/dlmu-cone/ems
|
||||
GIT_TAG main
|
||||
)
|
||||
FetchContent_MakeAvailable(ems)
|
||||
@@ -1,42 +1,45 @@
|
||||
|
||||
Breakpoint=D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/module/periph/buzzer/buzzer.cpp:333, State=BP_STATE_DISABLED
|
||||
GraphedExpression="(QEKF_INS).Roll", Color=#a00909
|
||||
OpenDocument="buzzer.cpp", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/module/periph/buzzer/buzzer.cpp", Line=319
|
||||
OpenDocument="rc.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/module/periph/remote_control/rc.c", Line=0
|
||||
OpenDocument="delayticks.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/bsp/delayticks/delayticks.c", Line=0
|
||||
OpenDocument="bsp_dwt.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/bsp/dwt/bsp_dwt.c", Line=93
|
||||
OpenDocument="main.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Core/Src/main.c", Line=69
|
||||
OpenDocument="robot.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/application/robot.c", Line=33
|
||||
OpenDocument="tasks.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Middlewares/Third_Party/FreeRTOS/Source/tasks.c", Line=2303
|
||||
OpenDocument="stm32h7xx_hal.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c", Line=329
|
||||
OpenDocument="tasks.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Middlewares/Third_Party/FreeRTOS/Source/tasks.c", Line=2304
|
||||
OpenDocument="stm32h7xx_hal.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c", Line=404
|
||||
OpenDocument="list.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Middlewares/Third_Party/FreeRTOS/Source/list.c", Line=144
|
||||
OpenDocument="cmsis_gcc.h", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Drivers/CMSIS/Include/cmsis_gcc.h", Line=264
|
||||
OpenDocument="cmsis_os2.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c", Line=872
|
||||
OpenDocument="stm32h7xx_it.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Core/Src/stm32h7xx_it.c", Line=99
|
||||
OpenDocument="stm32h7xx_hal_spi.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_spi.c", Line=3887
|
||||
OpenDocument="buzzer.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/module/periph/buzzer/buzzer.c", Line=191
|
||||
OpenDocument="ins_task.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/module/periph/imu/ins_task.c", Line=0
|
||||
OpenToolbar="Debug", Floating=0, x=0, y=0
|
||||
OpenToolbar="Breakpoints", Floating=0, x=1, y=0
|
||||
OpenWindow="Call Stack", DockArea=RIGHT, x=0, y=0, w=681, h=253, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Registers 1", DockArea=BOTTOM, x=1, y=0, w=361, h=181, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, FilteredItems=[], RefreshRate=1
|
||||
OpenWindow="Source Files", DockArea=LEFT, x=0, y=0, w=551, h=273, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Disassembly", DockArea=BOTTOM, x=2, y=0, w=629, h=181, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Break & Tracepoints", DockArea=LEFT, x=0, y=1, w=551, h=282, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VectorCatchIndexMask=254
|
||||
OpenWindow="Memory 1", DockArea=BOTTOM, x=3, y=0, w=465, h=181, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, EditorAddress=0x20005E30
|
||||
OpenWindow="Global Data", DockArea=RIGHT, x=0, y=2, w=681, h=417, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Watched Data 1", DockArea=LEFT, x=0, y=2, w=551, h=288, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Functions", DockArea=LEFT, x=0, y=3, w=551, h=229, TabPos=1, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Call Graph", DockArea=LEFT, x=0, y=3, w=551, h=229, TabPos=2, TopOfStack=1, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Global Data", DockArea=RIGHT, x=0, y=3, w=681, h=313, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Watched Data 1", DockArea=LEFT, x=0, y=2, w=551, h=283, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Functions", DockArea=LEFT, x=0, y=3, w=551, h=234, TabPos=1, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Call Graph", DockArea=LEFT, x=0, y=3, w=551, h=234, TabPos=2, TopOfStack=1, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Data Sampling", DockArea=BOTTOM, x=0, y=0, w=1102, h=181, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VisibleTab=0, UniformSampleSpacing=0
|
||||
OpenWindow="Timeline", DockArea=RIGHT, x=0, y=1, w=681, h=405, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=1, DataPaneShown=1, PowerPaneShown=0, CodePaneShown=0, PinCursor="Cursor Movable", TimePerDiv="1 s / Div", TimeStampFormat="Time", DataGraphDrawAsPoints=0, DataGraphLegendShown=1, DataGraphUniformSampleSpacing=0, DataGraphLegendPosition="435;0", PowerGraphDrawAsPoints=0, PowerGraphLegendShown=0, PowerGraphAvgFilterTime=Off, PowerGraphAvgFilterLen=Off, PowerGraphUniformSampleSpacing=0, PowerGraphLegendPosition="459;0", CodeGraphLegendShown=0, CodeGraphLegendPosition="475;0"
|
||||
OpenWindow="Console", DockArea=LEFT, x=0, y=3, w=551, h=229, TabPos=0, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="FreeRTOS", DockArea=RIGHT, x=0, y=0, w=681, h=271, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, Showing="Task List"
|
||||
OpenWindow="Timeline", DockArea=RIGHT, x=0, y=2, w=681, h=305, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=1, DataPaneShown=1, PowerPaneShown=0, CodePaneShown=0, PinCursor="Cursor Movable", TimePerDiv="1 s / Div", TimeStampFormat="Time", DataGraphDrawAsPoints=0, DataGraphLegendShown=1, DataGraphUniformSampleSpacing=0, DataGraphLegendPosition="435;0", PowerGraphDrawAsPoints=0, PowerGraphLegendShown=0, PowerGraphAvgFilterTime=Off, PowerGraphAvgFilterLen=Off, PowerGraphUniformSampleSpacing=0, PowerGraphLegendPosition="459;0", CodeGraphLegendShown=0, CodeGraphLegendPosition="475;0"
|
||||
OpenWindow="Console", DockArea=LEFT, x=0, y=3, w=551, h=234, TabPos=0, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="FreeRTOS", DockArea=RIGHT, x=0, y=1, w=681, h=221, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, Showing="Task List"
|
||||
TableHeader="Call Graph", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Stack Total";"Stack Local";"Code Total";"Code Local";"Depth";"Called From"], ColWidths=[384;100;100;100;100;100;118]
|
||||
TableHeader="Functions", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Address";"Size";"#Insts";"Source"], ColWidths=[1164;100;100;100;100]
|
||||
TableHeader="Global Data", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Location";"Size";"Type";"Scope"], ColWidths=[222;130;100;54;95;486]
|
||||
TableHeader="Global Data", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Location";"Size";"Type";"Scope"], ColWidths=[222;130;100;54;95;100]
|
||||
TableHeader="Vector Catches", SortCol="None", SortOrder="ASCENDING", VisibleCols=["";"Vector Catch";"Description"], ColWidths=[50;300;500]
|
||||
TableHeader="Break & Tracepoints", SortCol="None", SortOrder="ASCENDING", VisibleCols=["";"Type";"Location";"Extras"], ColWidths=[100;100;142;209]
|
||||
TableHeader="Source Files", SortCol="File", SortOrder="ASCENDING", VisibleCols=["File";"Status";"Size";"#Insts";"Path"], ColWidths=[229;100;100;100;902]
|
||||
TableHeader="Data Sampling Table", SortCol="Index", SortOrder="ASCENDING", VisibleCols=["Index";"Time";" (QEKF_INS).Roll"], ColWidths=[100;100;100]
|
||||
TableHeader="Data Sampling Setup", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Type";"Value";"Min";"Max";"Average";"# Changes";"Min. Change";"Max. Change"], ColWidths=[320;100;100;100;100;100;102;118;118]
|
||||
TableHeader="Call Stack", SortCol="Function", SortOrder="ASCENDING", VisibleCols=["Function";"Stack Frame";"Source";"PC";"Return Address";"Stack Used"], ColWidths=[110;126;190;100;190;100]
|
||||
TableHeader="Source Files", SortCol="File", SortOrder="ASCENDING", VisibleCols=["File";"Status";"Size";"#Insts";"Path"], ColWidths=[229;100;100;100;1046]
|
||||
TableHeader="Data Sampling Table", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Index";"Time";" (QEKF_INS).Roll"], ColWidths=[100;100;100]
|
||||
TableHeader="Data Sampling Setup", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Type";"Value";"Min";"Max";"Average";"# Changes";"Min. Change";"Max. Change"], ColWidths=[320;100;110;110;100;110;102;118;118]
|
||||
TableHeader="Power Sampling", SortCol="Index", SortOrder="ASCENDING", VisibleCols=["Index";"Time";"Ch 0"], ColWidths=[100;100;100]
|
||||
TableHeader="Task List", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Run Count";"Priority";"Status";"Timeout";"Stack Info (Free / Size)";"ID";"Mutex Count";"Notified Value";"Notify State"], ColWidths=[110;110;110;110;110;110;110;110;110;110]
|
||||
TableHeader="Registers 1", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Description"], ColWidths=[100;105;294]
|
||||
|
||||
Reference in New Issue
Block a user