feat: 接口更新

This commit is contained in:
bmy
2024-06-02 17:01:35 +08:00
parent 682f479771
commit 0517164e42
7 changed files with 227 additions and 72 deletions

View File

@@ -70,10 +70,10 @@
/* add user code end external variables */
/**
* @brief this function handles nmi exception.
* @param none
* @retval none
*/
* @brief this function handles nmi exception.
* @param none
* @retval none
*/
void NMI_Handler(void)
{
/* add user code begin NonMaskableInt_IRQ 0 */
@@ -86,17 +86,18 @@ void NMI_Handler(void)
}
/**
* @brief this function handles hard fault exception.
* @param none
* @retval none
*/
* @brief this function handles hard fault exception.
* @param none
* @retval none
*/
void HardFault_Handler(void)
{
/* add user code begin HardFault_IRQ 0 */
/* add user code end HardFault_IRQ 0 */
/* go to infinite loop when hard fault exception occurs */
while (1) {
while (1)
{
/* add user code begin W1_HardFault_IRQ 0 */
/* add user code end W1_HardFault_IRQ 0 */
@@ -104,17 +105,18 @@ void HardFault_Handler(void)
}
/**
* @brief this function handles memory manage exception.
* @param none
* @retval none
*/
* @brief this function handles memory manage exception.
* @param none
* @retval none
*/
void MemManage_Handler(void)
{
/* add user code begin MemoryManagement_IRQ 0 */
/* add user code end MemoryManagement_IRQ 0 */
/* go to infinite loop when memory manage exception occurs */
while (1) {
while (1)
{
/* add user code begin W1_MemoryManagement_IRQ 0 */
/* add user code end W1_MemoryManagement_IRQ 0 */
@@ -122,17 +124,18 @@ void MemManage_Handler(void)
}
/**
* @brief this function handles bus fault exception.
* @param none
* @retval none
*/
* @brief this function handles bus fault exception.
* @param none
* @retval none
*/
void BusFault_Handler(void)
{
/* add user code begin BusFault_IRQ 0 */
/* add user code end BusFault_IRQ 0 */
/* go to infinite loop when bus fault exception occurs */
while (1) {
while (1)
{
/* add user code begin W1_BusFault_IRQ 0 */
/* add user code end W1_BusFault_IRQ 0 */
@@ -140,17 +143,18 @@ void BusFault_Handler(void)
}
/**
* @brief this function handles usage fault exception.
* @param none
* @retval none
*/
* @brief this function handles usage fault exception.
* @param none
* @retval none
*/
void UsageFault_Handler(void)
{
/* add user code begin UsageFault_IRQ 0 */
/* add user code end UsageFault_IRQ 0 */
/* go to infinite loop when usage fault exception occurs */
while (1) {
while (1)
{
/* add user code begin W1_UsageFault_IRQ 0 */
/* add user code end W1_UsageFault_IRQ 0 */
@@ -158,10 +162,10 @@ void UsageFault_Handler(void)
}
/**
* @brief this function handles svcall exception.
* @param none
* @retval none
*/
* @brief this function handles svcall exception.
* @param none
* @retval none
*/
void SVC_Handler(void)
{
/* add user code begin SVCall_IRQ 0 */
@@ -173,10 +177,10 @@ void SVC_Handler(void)
}
/**
* @brief this function handles debug monitor exception.
* @param none
* @retval none
*/
* @brief this function handles debug monitor exception.
* @param none
* @retval none
*/
void DebugMon_Handler(void)
{
/* add user code begin DebugMonitor_IRQ 0 */
@@ -188,10 +192,10 @@ void DebugMon_Handler(void)
}
/**
* @brief this function handles pendsv_handler exception.
* @param none
* @retval none
*/
* @brief this function handles pendsv_handler exception.
* @param none
* @retval none
*/
void PendSV_Handler(void)
{
/* add user code begin PendSV_IRQ 0 */
@@ -203,10 +207,10 @@ void PendSV_Handler(void)
}
/**
* @brief this function handles USB Low Priority or CAN1 RX0 handler.
* @param none
* @retval none
*/
* @brief this function handles USB Low Priority or CAN1 RX0 handler.
* @param none
* @retval none
*/
void USBFS_L_CAN1_RX0_IRQHandler(void)
{
/* add user code begin USBFS_L_CAN1_RX0_IRQ 0 */
@@ -223,10 +227,10 @@ void USBFS_L_CAN1_RX0_IRQHandler(void)
}
/**
* @brief this function handles USART1 handler.
* @param none
* @retval none
*/
* @brief this function handles USART1 handler.
* @param none
* @retval none
*/
void USART1_IRQHandler(void)
{
/* add user code begin USART1_IRQ 0 */
@@ -241,10 +245,10 @@ void USART1_IRQHandler(void)
}
/**
* @brief this function handles USART2 handler.
* @param none
* @retval none
*/
* @brief this function handles USART2 handler.
* @param none
* @retval none
*/
void USART2_IRQHandler(void)
{
/* add user code begin USART2_IRQ 0 */
@@ -262,10 +266,10 @@ void USART2_IRQHandler(void)
}
/**
* @brief this function handles USART3 handler.
* @param none
* @retval none
*/
* @brief this function handles USART3 handler.
* @param none
* @retval none
*/
void USART3_IRQHandler(void)
{
/* add user code begin USART3_IRQ 0 */
@@ -281,10 +285,10 @@ void USART3_IRQHandler(void)
}
/**
* @brief this function handles TMR6 handler.
* @param none
* @retval none
*/
* @brief this function handles TMR6 handler.
* @param none
* @retval none
*/
void TMR6_GLOBAL_IRQHandler(void)
{
/* add user code begin TMR6_GLOBAL_IRQ 0 */
@@ -299,10 +303,10 @@ void TMR6_GLOBAL_IRQHandler(void)
}
/**
* @brief this function handles CAN2 RX0 handler.
* @param none
* @retval none
*/
* @brief this function handles CAN2 RX0 handler.
* @param none
* @retval none
*/
void CAN2_RX0_IRQHandler(void)
{
/* add user code begin CAN2_RX0_IRQ 0 */

View File

@@ -268,9 +268,9 @@ void wk_gpio_config(void)
gpio_init(GPIOB, &gpio_init_struct);
/* gpio output config */
gpio_bits_reset(GPIOC, GPIO_PINS_0 | GPIO_PINS_1 | GPIO_PINS_2 | GPIO_PINS_3);
gpio_bits_set(GPIOC, GPIO_PINS_0 | GPIO_PINS_1 | GPIO_PINS_2 | GPIO_PINS_3);
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
gpio_init_struct.gpio_pins = GPIO_PINS_0 | GPIO_PINS_1 | GPIO_PINS_2 | GPIO_PINS_3;

View File

@@ -69,10 +69,10 @@
/* add user code end 0 */
/**
* @brief main function.
* @param none
* @retval none
*/
* @brief main function.
* @param none
* @retval none
*/
int main(void)
{
/* add user code begin 1 */
@@ -152,8 +152,12 @@ int main(void)
/* add user code end 2 */
while (1) {
while(1)
{
/* add user code begin 3 */
// gpio_bits_write(GPIOC, GPIO_PINS_3, !gpio_output_data_bit_read(GPIOC, GPIO_PINS_3));
// gpio_bits_write(GPIOC, GPIO_PINS_2, !gpio_output_data_bit_read(GPIOC, GPIO_PINS_2));
// DWT_Delay(1000000);
by_messy_loop();
by_motion_loop();
/* add user code end 3 */