修改cmakelist中项目文件名的修改方式。
添加默认的usart的接收中断和超时中断。
This commit is contained in:
parent
b6d37fcc13
commit
1a8f1fa203
@ -1,6 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
include(cmake/toolchain.cmake)
|
||||
|
||||
set(PROJECT_NAME "gd32e23x_template")
|
||||
project(gd32e23x_template)
|
||||
|
||||
set(VERSION_MAJOR 0)
|
||||
@ -39,11 +40,11 @@ set(TARGET_C_SRC
|
||||
${CMAKE_SOURCE_DIR}/src/fwdgt.c
|
||||
)
|
||||
|
||||
add_executable(gd32e23x_template ${TARGET_C_SRC})
|
||||
add_executable(${PROJECT_NAME} ${TARGET_C_SRC})
|
||||
|
||||
target_link_libraries(gd32e23x_template GD32E23X_SDK)
|
||||
target_include_directories(gd32e23x_template PUBLIC inc)
|
||||
target_link_libraries(${PROJECT_NAME} GD32E23X_SDK)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC inc)
|
||||
|
||||
# Generate .bin and .hex
|
||||
generate_binary_file(gd32e23x_template)
|
||||
generate_hex_file(gd32e23x_template)
|
||||
generate_binary_file(${PROJECT_NAME})
|
||||
generate_hex_file(${PROJECT_NAME})
|
||||
|
@ -7,7 +7,7 @@
|
||||
### 版本号
|
||||
默认版本号为`0.0.1`,在`CMakeLists.txt`中修改`PROJECT_VERSION`即可。
|
||||
### 项目名称
|
||||
默认项目名称为`gd32e23x_template`,在`CMakeLists.txt`中修改`PROJECT_NAME`即可。请先修改项目名称再配置编译环境。
|
||||
默认项目名称为`gd32e23x_template`,在`CMakeLists.txt`中修改`set(PROJECT_NAME "gd32e23x_template")`即可。请先修改项目名称再配置编译环境。
|
||||
### 软件IIC与硬件IIC
|
||||
本项目中提供了软件IIC与硬件IIC的驱动,但是默认使用硬件IIC,如果需要使用软件IIC,请在`board_config.h`中取消注释`// #define SOFTWARE_IIC`(line 8)。
|
||||
### 编译选项
|
||||
|
@ -120,4 +120,13 @@ void TIMER16_IRQHandler(void)
|
||||
}
|
||||
led_status = !led_status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief this function handles USART0 interrupt request
|
||||
\param[in] none
|
||||
\param[out] none
|
||||
\retval none
|
||||
*/
|
||||
void USART0_IRQHandler(void) {
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
setbuf(stdout, NULL);
|
||||
/* configure systick */
|
||||
systick_config();
|
||||
/* configure USART */
|
||||
|
@ -28,6 +28,10 @@ void usart_config(void)
|
||||
usart_transmit_config(USART_PHY, USART_TRANSMIT_ENABLE);
|
||||
|
||||
usart_enable(USART_PHY);
|
||||
|
||||
nvic_irq_enable(USART0_IRQn, 0);
|
||||
usart_interrupt_enable(USART_PHY, USART_INT_RBNE);
|
||||
usart_interrupt_enable(USART_PHY, USART_INT_IDLE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user