当前位置: 首页 > news >正文

GD - EmbeddedBuilder - 用DMA进行串口发送接收,支持接收不定长包

文章目录

    • GD - EmbeddedBuilder - 用DMA进行串口发送接收,支持接收不定长包
    • 概述
    • 笔记
    • 硬件连接
    • 图形化配置
      • 485EN的配置
      • 串口的图形化配置
    • 代码实现
      • main.c
      • gd32f3x0_hal_it.c
      • gd32f3x0_hal_init.c
      • gd32f3x0_hal_init.h
      • gd32f3x0_hal_it.h
      • gd32f3x0_libopt.h
    • 备注
    • END

GD - EmbeddedBuilder - 用DMA进行串口发送接收,支持接收不定长包

概述

看了EmbeddedBuilder_v1.4.1.23782自带的官方例子工程,将串口的发送接收的DMA操作摘出来,做了个实验,细节都弄清楚了。
官方给的demo只演示一个知识点,演示的比较简单,如果自己不参照官方demo做个实验,细节不清楚。
有些细节,官方demo也没提到。(e.g. 如何正确判断串口DMA发送完成? 看官方demo, 只能看到,进了DMA发送完成回调,就算发送完成了。但是自己做了实验才能知道,只有串口中断发生时,进了DMA发送完成回调,才算是发送完成,接收方才能收到我们发给上位机的完整回包。如果是在DMA中断时,进了发送完成回调算为发送完成,就会导致接收方接受的最后一个字节内容错误)。

接收不定长包用到了接收空闲回调。如果本MCU的串口被其他人发了内容,在进入接收空闲回调后,只要收到的字节数 > 0, 就可以直接处理了,此时,收到的东西就是对方发来的整个buffer的内容。
比中断方式,一个一个字节的匹配协议,效率要高很多。
进了接收空闲回调,对方发来的东西就都全了,一起来判断协议,要方便很多。
串口的收发用了DMA, 可以使一部分工作由DMA硬件自己做,减轻MCU的负担, 提高固件运行的速度。

注意,在接收空闲回调函数中时,这时还是在中断中,这时如果直接判断协议并发回包,可能让接收方接收的最后一个字节错误. 原因是不方便判断是否DMA发送完成了(因为根本等不到发送完成回调函数的执行)。
这时,可以在接收中断空闲回调中,将收到的数据拷贝出来,做个接收完成的标记,在主循环中判断协议并发送回包。

笔记

硬件连接

MCU端采用GD的,UART0的收发 + 一个GPIO控制485EN.
在这里插入图片描述

调试时,将保护的那几个TVS拿掉了。485电路外围的电路和元件如下。
在这里插入图片描述

图形化配置

将SWD和串口配置上
在这里插入图片描述
时钟没改,默认的是用内部晶振,8MHZ的时钟。
在这里插入图片描述

485EN的配置

在这里插入图片描述
在这里插入图片描述
默认状态为推挽输出,下拉。这样默认就是接收状态。

串口的图形化配置

在这里插入图片描述
在这里插入图片描述
设好通讯参数为115200, 其他默认。
在这里插入图片描述
产生UART0中断代码。
在这里插入图片描述
收发管脚都用DMA, 通道选挨着的2个通道。TX是从内存到设备,RX是从设备到内存。
在这里插入图片描述
串口TX/RX的2个GPIO配置为上拉,可以防止小信号干扰,节省了外接在TX,RX上的2个外部上拉电阻。

代码实现

图形化配置完,生成HAL库实现。
在EmbeddedBuilder生成的框架代码中添加自己的代码。自己所有的代码都写在begin x和end x之间,防止图形化参数修改后,重新生成框架代码时,冲掉自己的手写代码。

main.c

/*\file  main.c*/
/*Copyright (c) 2024, GigaDevice Semiconductor Inc.All rights reserved.Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the copyright holder nor the names of its contributorsmay be used to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUTNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITYOF SUCH DAMAGE.*/
#include "gd32f3x0_hal.h"
#include "gd32f3x0_hal_init.h"
/* user code [global 0] begin */#include <assert.h> // for assert
#include <stdbool.h> // for bool#define ARRAYNUM(arr_nanme)    (uint32_t)(sizeof(arr_nanme) / sizeof(*(arr_nanme)))
#define TRANSMIT_SIZE (ARRAYNUM(transmitter_buffer) - 1)int g_is_from_DMA_Channel1_2_IRQHandler_1_or_0 = 0;
int g_is_from_USART0_IRQHandler_1_or_0 = 0;uint8_t transmitter_buffer[256]; // DMA用的发送区char g_need_tx_buffer[0x100]; // 决定发送的内容
bool g_b_can_modify_g_need_tx_buffer = true;
uint8_t g_need_tx_cnt = 0;uint8_t receiver_buffer[256];
__IO uint8_t rx_count = 0;__IO FlagStatus tx_end = RESET;
__IO FlagStatus rx_end = RESET;hal_uart_user_callback_struct user_tx_cb;
hal_uart_user_callback_struct user_rx_cb;hal_uart_irq_struct irq_struct;void tx_test(int cnt);void rx_idle(void *ptr);
void recv_proc(uint8_t *ptr, int cnt);void error_tx_cb(hal_uart_dev_struct *uart);
void tx_complete(hal_uart_dev_struct *uart);void error_rx_cb(hal_uart_dev_struct *uart);
void rx_complete(hal_uart_dev_struct *uart);/* user code [global 0] end *//*!\brief      main function\param[in]  none\param[out] none\retval     none*/
int main(void) {/* user code [local 0] begin */int test_cnt = 0;/* user code [local 0] end */msd_system_init();msd_clock_init();/* user code [local 1] begin *//* user code [local 1] end */msd_gpio_init();msd_dma_init();msd_usart0_init();/* user code [local 2] begin *//* wait IDLEF set and clear it */while (RESET == hals_uart_flag_get(USART0, USART_FLAG_IDLE)) {}hals_uart_flag_clear(USART0, USART_FLAG_IDLE);/* enable idle line detected interrupt and callback function */hal_uart_struct_init(HAL_UART_IRQ_INIT_STRUCT, &irq_struct);irq_struct.idle_line_detected_handle = rx_idle;hal_uart_irq_handle_set(&uart0_info, &irq_struct);// test GPIO - 485 EN Vhal_gpio_bit_reset(EN_485_GPIO_PORT, EN_485_PIN); // 485接收使能/* receive data using DMA mode */hal_uart_struct_init(HAL_UART_USER_CALLBCAK_STRUCT, &user_rx_cb);user_rx_cb.error_func = error_rx_cb;user_rx_cb.complete_func = rx_complete;hal_uart_receive_dma(&uart0_info, receiver_buffer, 256, &user_rx_cb);// 如果没开UART0 485接收使能,上位机发来东西,过�?会也能进接收空闲,但是没收到东西�?hal_uart_struct_init(HAL_UART_USER_CALLBCAK_STRUCT, &user_tx_cb);user_tx_cb.error_func = error_tx_cb;user_tx_cb.complete_func = tx_complete;// 不主动发东西,一问一答/* user code [local 2] end */while (1) {/* user code [local 3] begin */hal_sys_basetick_delay_ms(1);// char g_need_tx_buffer[0x100]; // 决定发送的内容// bool g_b_can_modify_g_need_tx_buffer = true;// uint8_t g_need_tx_cnt = 0;// 串口回包优先if (!g_b_can_modify_g_need_tx_buffer) {// 串口中断已经收到了命令,需要处理if (g_need_tx_cnt > 0) {// 将第一个字节++, 然后回包(假设回包逻辑就是这样的)g_need_tx_buffer[0]++;hal_gpio_bit_set(EN_485_GPIO_PORT, EN_485_PIN); // 485发送使能tx_end = RESET;hal_uart_transmit_dma(&uart0_info, g_need_tx_buffer,g_need_tx_cnt, &user_tx_cb);// 需要等DMA发送完成。while (RESET == tx_end) {};hal_gpio_bit_reset(EN_485_GPIO_PORT, EN_485_PIN); // 485接收使能}// 回包完成g_b_can_modify_g_need_tx_buffer = true;g_need_tx_cnt = 0;}/* user code [local 3] end */}
}
/* user code [global 1] begin */
void rx_idle(void *ptr) {hal_uart_dev_struct *temp_ptr = (hal_uart_dev_struct*) ptr;/* number of data received */rx_count = 256- (hals_dma_transfer_number_get(temp_ptr->p_dma_rx->channel));// hals_dma_transfer_number_config(temp_ptr->p_dma_rx->channel, DMA_CHCNT_RESET_VALUE);rx_end = SET;if (rx_count > 0) {// disable DMAhal_uart_receive_stop(temp_ptr); // 必须要先停止,否则计数和内容还是累计的// 如果不先停止,就会出现虚假内容(将上次收到的内容当作这次的,收到的内容越来越多)// e.g. 第1次对方发来2个字节, aa bb// 自己也收到aa bb// 但是第2次对方发来3个字节, 11 22 33// 自己收到的却是 aa bb 11 22 33// proc recv data now// recv data ptr = receiver_buffer// recv byte cnt = rx_countrecv_proc(receiver_buffer, rx_count);}rx_end = RESET;// DMA reconfigurehal_uart_receive_dma(&uart0_info, receiver_buffer, 256, &user_rx_cb);
}void safe_copy(uint8_t *ptr, int cnt) {int cpy_len = ((sizeof(g_need_tx_buffer) > cnt) ? cnt : sizeof(g_need_tx_buffer));memcpy(g_need_tx_buffer, ptr, cpy_len);g_b_can_modify_g_need_tx_buffer = false;g_need_tx_cnt = cpy_len;
}void recv_proc(uint8_t *ptr, int cnt) {// e.g. 回点东西/* transimt data using DMA mode */// sprintf((char*)transmitter_buffer, "cnt=%d\r\n", cnt);// tx_end = RESET;// hal_gpio_bit_set(EN_485_GPIO_PORT, EN_485_PIN); // 485发送使能// hal_uart_transmit_dma(&uart0_info, ptr, cnt, &user_tx_cb);// 在这里直接等发送完成,等不到,估计是在中断中的原因// 不过发送已经完成了,且上位机已经收到。// 已经实验过了,确定不能在接收中断中等发送中断回调中赋值的数据。// 发送完成回调的时机比接收空闲的时机晚,// 根本等不到发送完成回调中的变量赋值//   while(RESET == tx_end) {//   }// 对于半双工通讯,直接或间接在接收中断中发送内容是有风险的。// 假设就在这里发送,那么发送完,出了这个函数,就切到接收状态了,// 有可能导致发送的内容不对(接收方收的内容不对,少东西或内容不对)// 接收处理,只能将收到的东西存起来,或者决定要发什么东西,放到g_need_tx_buffer中// 真正发送,要在主程序循环中做。if (!g_b_can_modify_g_need_tx_buffer || (g_need_tx_cnt > 0)) {// 主程序没处理上一个要发送的内容,这次收到的东西只能丢弃了} else {safe_copy(ptr, cnt); // 将接收到的内容给主程序循环处理}
}void error_tx_cb(hal_uart_dev_struct *uart) {// 发送错误// printf("\n\rUSART error state: %u\n\r", uart->error_state);// printf("USART last error state: %u\n\r", uart->last_error);assert(false);
}void tx_complete(hal_uart_dev_struct *uart) {// 发送完成// 如果不做处理,一次发送操作,会引起这里会进来2次// 一次是串口DMA中断(先进来),一次是串口普通中断(后进来)。// 从 uart 的内容看不出是DMA来的,还是普通串口中断来的// 只能是在进入DMA中断时,设置一个标记,且这个标记不能是bool, 必须是内建的类型// 否则编译不过(将代码都写在begin x 和 end x之间的标准写法,重新配置代码时,不会清掉自己手写的代码)if (((hal_uart_dev_struct*) dma_usart0_tx_info.p_periph == uart)&& (1 == g_is_from_USART0_IRQHandler_1_or_0)) {// 在发生串口接收空闲中断时,必须收到东西(rx bytes cnt > 0),才响应(根据收到的命令,发点回包给上位机)// 如果没收到东西(或有效内容),就不能给上位机回包。否则可能出现死循环.// 如果是DMA_usart0的完成回调,设置发送完标记,会导致接收方最后一个字节内容错误。// 所以,必须等UART0的完成回调时,才能设置发送完的标记。tx_end = SET;}
}void error_rx_cb(hal_uart_dev_struct *uart) {// 接收错误assert(false);
}void rx_complete(hal_uart_dev_struct *uart) {
// 接收完成rx_end = SET;
}/* user code [global 1] end */

gd32f3x0_hal_it.c

/*\file  gd32f3x0_hal_it.c*/
/*Copyright (c) 2024, GigaDevice Semiconductor Inc.All rights reserved.Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the copyright holder nor the names of its contributorsmay be used to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUTNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITYOF SUCH DAMAGE.*/
#include "gd32f3x0_hal_it.h"
#include "gd32f3x0_hal.h"
#include "gd32f3x0_hal_init.h"void NMI_Handler(void) {/* user code [NonMaskableInt_IRQn local 0] begin *//* user code [NonMaskableInt_IRQn local 0] end *//* user code [NonMaskableInt_IRQn local 1] begin *//* user code [NonMaskableInt_IRQn local 1] end */
}void SVC_Handler(void) {/* user code [SVCall_IRQn local 0] begin *//* user code [SVCall_IRQn local 0] end *//* user code [SVCall_IRQn local 1] begin *//* user code [SVCall_IRQn local 1] end */
}void PendSV_Handler(void) {/* user code [PendSV_IRQn local 0] begin *//* user code [PendSV_IRQn local 0] end *//* user code [PendSV_IRQn local 1] begin *//* user code [PendSV_IRQn local 1] end */
}void SysTick_Handler(void) {/* user code [SysTick_IRQn local 0] begin *//* user code [SysTick_IRQn local 0] end */hal_sys_basetick_irq();/* user code [SysTick_IRQn local 1] begin *//* user code [SysTick_IRQn local 1] end */
}void DMA_Channel1_2_IRQHandler(void) {/* user code [DMA_Channel1_2_IRQn local 0] begin */g_is_from_DMA_Channel1_2_IRQHandler_1_or_0 = 1;/* user code [DMA_Channel1_2_IRQn local 0] end */hal_dma_irq(&dma_usart0_tx_info);hal_dma_irq(&dma_usart0_rx_info);/* user code [DMA_Channel1_2_IRQn local 1] begin */g_is_from_DMA_Channel1_2_IRQHandler_1_or_0 = 0;/* user code [DMA_Channel1_2_IRQn local 1] end */
}void USART0_IRQHandler(void) {/* user code [USART0_IRQn local 0] begin */g_is_from_USART0_IRQHandler_1_or_0 = 1;/* user code [USART0_IRQn local 0] end */hal_uart_irq(&uart0_info);g_is_from_USART0_IRQHandler_1_or_0 = 0;/* user code [USART0_IRQn local 1] begin *//* user code [USART0_IRQn local 1] end */
}

gd32f3x0_hal_init.c

/*\file  gd32f3x0_hal_init.c*/
/*Copyright (c) 2024, GigaDevice Semiconductor Inc.All rights reserved.Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the copyright holder nor the names of its contributorsmay be used to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUTNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITYOF SUCH DAMAGE.*/
#include "gd32f3x0_hal_init.h"
/* user code [global 0] begin *//* user code [global 0] end */
hal_uart_dev_struct uart0_info;
hal_dma_dev_struct dma_usart0_tx_info;
hal_dma_dev_struct dma_usart0_rx_info;void msd_system_init(void) {/* user code [system_init local 0] begin *//* user code [system_init local 0] end */hal_rcu_periph_clk_enable(RCU_CFGCMP);hal_nvic_irq_priority_group_set(NVIC_PRIGROUP_PRE4_SUB0);hal_sys_debug_init(SYS_DEBUG_SERIAL_WIRE);hal_sys_timesource_init(SYS_TIMEBASE_SOURCE_SYSTICK);hal_nvic_set_priority(NonMaskableInt_IRQn, 0, 0);hal_nvic_set_priority(SVCall_IRQn, 0, 0);hal_nvic_set_priority(PendSV_IRQn, 0, 0);hal_nvic_set_priority(SysTick_IRQn, 0, 0);/* user code [system_init local 1] begin *//* user code [system_init local 1] end */
}void msd_clock_init(void) {/* user code [clock_init local 0] begin *//* user code [clock_init local 0] end */hal_rcu_clk_struct rcu_clk_parameter;hal_rcu_osci_struct rcu_osci_parameter;hal_rcu_periphclk_struct rcu_periphclk_parameter;hal_rcu_struct_init(HAL_RCU_CLK_STRUCT, &rcu_clk_parameter);hal_rcu_struct_init(HAL_RCU_OSCI_STRUCT, &rcu_osci_parameter);hal_rcu_struct_init(HAL_RCU_PERIPHCLK_STRUCT, &rcu_periphclk_parameter);rcu_osci_parameter.irc8m.need_configure = ENABLE;rcu_osci_parameter.irc8m.state = RCU_OSC_ON;rcu_osci_parameter.irc8m.adjust_value = 0;/*If IRC48M is selected as USB clock source, please configure CTC calibration operation*/rcu_osci_parameter.irc48m.need_configure = ENABLE;rcu_osci_parameter.irc48m.state = RCU_OSC_ON;if (HAL_ERR_NONE != hal_rcu_osci_config(&rcu_osci_parameter)) {while (1);}rcu_clk_parameter.clock_type = RCU_CLKTYPE_SYSCLK | RCU_CLKTYPE_AHBCLK| RCU_CLKTYPE_APB1CLK | RCU_CLKTYPE_APB2CLK | RCU_CLKTYPE_CK48MCLK;rcu_clk_parameter.sysclk_source = RCU_SYSCLK_SRC_IRC8M;rcu_clk_parameter.ahbclk_divider = RCU_SYSCLK_AHBDIV1;rcu_clk_parameter.apb1clk_divider = RCU_AHBCLK_APB1DIV1;rcu_clk_parameter.apb2clk_divider = RCU_AHBCLK_APB2DIV1;rcu_clk_parameter.ck48mclk_source = RCU_USB_CK48MSRC_IRC48M;if (HAL_ERR_NONE != hal_rcu_clock_config(&rcu_clk_parameter)) {while (1);}rcu_periphclk_parameter.periph_clock_type = RCU_PERIPH_CLKTYPE_USART0;rcu_periphclk_parameter.usart0_clock_source = RCU_USART0_CLKSRC_APB2;if (HAL_ERR_NONE != hal_rcu_periph_clock_config(&rcu_periphclk_parameter)) {while (1);}/* user code [clock_init local 1] begin *//* user code [clock_init local 1] end */
}void msd_dma_init(void) {/* user code [dma_init local 0] begin *//* user code [dma_init local 0] end */hal_rcu_periph_clk_enable(RCU_DMA);hal_nvic_irq_enable(DMA_Channel1_2_IRQn, 0, 0);/* user code [dma_init local 1] begin *//* user code [dma_init local 1] end */
}void msd_dma_deinit(void) {/* user code [dma_deinit local 0] begin *//* user code [dma_deinit local 0] end */hal_rcu_periph_clk_disable(RCU_DMA);/* user code [dma_deinit local 1] begin *//* user code [dma_deinit local 1] end */
}void msd_gpio_init(void) {/* user code [gpio_init local 0] begin *//* user code [gpio_init local 0] end */hal_gpio_init_struct gpio_init_parameter;hal_rcu_periph_clk_enable(RCU_GPIOB);hal_rcu_periph_clk_enable(RCU_GPIOA);hal_gpio_struct_init(&gpio_init_parameter);hal_gpio_bit_reset(EN_485_GPIO_PORT, EN_485_PIN);gpio_init_parameter.mode = GPIO_MODE_OUTPUT_PP;gpio_init_parameter.pull = GPIO_PULL_DOWN;gpio_init_parameter.ospeed = GPIO_OSPEED_50MHZ;gpio_init_parameter.af = GPIO_AF_0;hal_gpio_init(EN_485_GPIO_PORT, EN_485_PIN, &gpio_init_parameter);/* user code [gpio_init local 1] begin *//* user code [gpio_init local 1] end */
}void msd_gpio_deinit(void) {/* user code [gpio_deinit local 0] begin *//* user code [gpio_deinit local 0] end */hal_rcu_periph_clk_disable(RCU_GPIOB);hal_rcu_periph_clk_disable(RCU_GPIOA);hal_gpio_deinit(EN_485_GPIO_PORT, EN_485_PIN);/* user code [gpio_deinit local 1] begin *//* user code [gpio_deinit local 1] end */
}void msd_usart0_init(void) {/* user code [usart0_init local 0] begin *//* user code [usart0_init local 0] end */hal_gpio_init_struct gpio_init_parameter;hal_dma_init_struct dma_usart0_tx_init_parameter;hal_dma_init_struct dma_usart0_rx_init_parameter;hal_uart_init_struct uart0_init_parameter;hal_rcu_periph_clk_enable(RCU_USART0);hal_gpio_struct_init(&gpio_init_parameter);gpio_init_parameter.mode = GPIO_MODE_AF_PP;gpio_init_parameter.pull = GPIO_PULL_UP;gpio_init_parameter.ospeed = GPIO_OSPEED_50MHZ;gpio_init_parameter.af = GPIO_AF_0;hal_gpio_init(UART0_RX_485_GPIO_PORT, UART0_RX_485_PIN,&gpio_init_parameter);gpio_init_parameter.mode = GPIO_MODE_AF_PP;gpio_init_parameter.pull = GPIO_PULL_UP;gpio_init_parameter.ospeed = GPIO_OSPEED_50MHZ;gpio_init_parameter.af = GPIO_AF_0;hal_gpio_init(UART0_TX_485_GPIO_PORT, UART0_TX_485_PIN,&gpio_init_parameter);hal_uart_struct_init(HAL_UART_INIT_STRUCT, &uart0_init_parameter);hal_uart_struct_init(HAL_UART_DEV_STRUCT, &uart0_info);uart0_init_parameter.work_mode = UART_WORK_MODE_ASYN;uart0_init_parameter.baudrate = 115200;uart0_init_parameter.parity = UART_PARITY_NONE;uart0_init_parameter.word_length = UART_WORD_LENGTH_8BIT;uart0_init_parameter.stop_bit = UART_STOP_BIT_1;uart0_init_parameter.direction = UART_DIRECTION_RX_TX;uart0_init_parameter.over_sample = UART_OVER_SAMPLE_16;uart0_init_parameter.sample_method = UART_THREE_SAMPLE_BIT;uart0_init_parameter.hardware_flow = UART_HARDWARE_FLOW_NONE;uart0_init_parameter.rx_fifo_en = DISABLE;uart0_init_parameter.timeout_enable = DISABLE;uart0_init_parameter.first_bit_msb = DISABLE;uart0_init_parameter.tx_rx_swap = DISABLE;uart0_init_parameter.rx_level_invert = DISABLE;uart0_init_parameter.tx_level_invert = DISABLE;uart0_init_parameter.data_bit_invert = DISABLE;uart0_init_parameter.overrun_disable = DISABLE;uart0_init_parameter.rx_error_dma_stop = DISABLE;uart0_init_parameter.rs485_mode = DISABLE;hal_uart_init(&uart0_info, USART0, &uart0_init_parameter);hal_dma_struct_init(HAL_DMA_INIT_STRUCT, &dma_usart0_tx_init_parameter);hal_dma_struct_init(HAL_DMA_DEV_STRUCT, &dma_usart0_tx_info);hal_dma_struct_init(HAL_DMA_INIT_STRUCT, &dma_usart0_rx_init_parameter);hal_dma_struct_init(HAL_DMA_DEV_STRUCT, &dma_usart0_rx_info);dma_usart0_tx_init_parameter.direction = DMA_DIR_MEMORY_TO_PERIPH;dma_usart0_tx_init_parameter.periph_inc = DISABLE;dma_usart0_tx_init_parameter.memory_inc = ENABLE;dma_usart0_tx_init_parameter.periph_width = DMA_PERIPH_SIZE_8BITS;dma_usart0_tx_init_parameter.memory_width = DMA_MEMORY_SIZE_8BITS;dma_usart0_tx_init_parameter.mode = DMA_NORMAL_MODE;dma_usart0_tx_init_parameter.priority = DMA_PRIORITY_LEVEL_LOW;hal_dma_init(&dma_usart0_tx_info, DMA_CH1, &dma_usart0_tx_init_parameter);hal_periph_dma_info_bind(uart0_info, p_dma_tx, dma_usart0_tx_info);dma_usart0_rx_init_parameter.direction = DMA_DIR_PERIPH_TO_MEMORY;dma_usart0_rx_init_parameter.periph_inc = DISABLE;dma_usart0_rx_init_parameter.memory_inc = ENABLE;dma_usart0_rx_init_parameter.periph_width = DMA_PERIPH_SIZE_8BITS;dma_usart0_rx_init_parameter.memory_width = DMA_MEMORY_SIZE_8BITS;dma_usart0_rx_init_parameter.mode = DMA_NORMAL_MODE;dma_usart0_rx_init_parameter.priority = DMA_PRIORITY_LEVEL_LOW;hal_dma_init(&dma_usart0_rx_info, DMA_CH2, &dma_usart0_rx_init_parameter);hal_periph_dma_info_bind(uart0_info, p_dma_rx, dma_usart0_rx_info);hal_nvic_irq_enable(USART0_IRQn, 0, 0);/* user code [usart0_init local 1] begin *//* user code [usart0_init local 1] end */
}void msd_usart0_deinit(void) {/* user code [usart0_deinit local 0] begin *//* user code [usart0_deinit local 0] end */hal_rcu_periph_clk_disable(RCU_USART0);hal_gpio_deinit(UART0_RX_485_GPIO_PORT, UART0_RX_485_PIN);hal_gpio_deinit(UART0_TX_485_GPIO_PORT, UART0_TX_485_PIN);hal_uart_deinit(&uart0_info);hal_dma_deinit(&dma_usart0_tx_info);hal_dma_deinit(&dma_usart0_rx_info);/* user code [usart0_deinit local 1] begin *//* user code [usart0_deinit local 1] end */
}/* user code [global 1] begin *//* user code [global 1] end */

gd32f3x0_hal_init.h

/*\file  gd32f3x0_hal_init.h*/
/*Copyright (c) 2024, GigaDevice Semiconductor Inc.All rights reserved.Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the copyright holder nor the names of its contributorsmay be used to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUTNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITYOF SUCH DAMAGE.*/
#ifndef  GD32F3X0_HAL_INIT_H
#define  GD32F3X0_HAL_INIT_H
#include "gd32f3x0_hal.h"
#define  UART0_RX_485_GPIO_PORT    GPIOB
#define  EN_485_GPIO_PORT    GPIOB
#define  UART0_RX_485_PIN    GPIO_PIN_7
#define  UART0_TX_485_GPIO_PORT    GPIOB
#define  UART0_TX_485_PIN    GPIO_PIN_6
#define  EN_485_PIN    GPIO_PIN_5
/* user code [global 0] begin *//* user code [global 0] end */
extern hal_uart_dev_struct uart0_info;
extern hal_dma_dev_struct dma_usart0_tx_info;
extern hal_dma_dev_struct dma_usart0_rx_info;void msd_system_init(void);
void msd_clock_init(void);
void msd_dma_init(void);
void msd_dma_deinit(void);
void msd_gpio_init(void);
void msd_gpio_deinit(void);
void msd_usart0_init(void);
void msd_usart0_deinit(void);/* user code [global 1] begin *//* user code [global 1] end */
#endif  

gd32f3x0_hal_it.h

/*\file  gd32f3x0_hal_it.h*/
/*Copyright (c) 2024, GigaDevice Semiconductor Inc.All rights reserved.Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the copyright holder nor the names of its contributorsmay be used to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUTNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITYOF SUCH DAMAGE.*/
#ifndef GD32F3X0_HAL_IT_H
#define GD32F3X0_HAL_IT_H/* user code [global 0] begin */extern int g_is_from_DMA_Channel1_2_IRQHandler_1_or_0;
extern int g_is_from_USART0_IRQHandler_1_or_0;
/* user code [global 0] end */void NMI_Handler(void);void SVC_Handler(void);void PendSV_Handler(void);void SysTick_Handler(void);void DMA_Channel1_2_IRQHandler(void);void USART0_IRQHandler(void);/* user code [global 1] begin *//* user code [global 1] end */#endif/*GD32F3X0_HAL_IT_H*/

gd32f3x0_libopt.h

/*!\file    gd32f3x0_libopt.h\brief   HAL library optional for gd32f3x0\version 2023-08-01, V1.0.0, HAL firmware for GD32F3x0*//*Copyright (c) 2023, GigaDevice Semiconductor Inc.Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the copyright holder nor the names of its contributorsmay be used to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUTNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITYOF SUCH DAMAGE.*/#ifndef GD32F3X0_LIBOPT_H
#define GD32F3X0_LIBOPT_H/* if set, flash operation (write and eraser) will reserve original data locatedin out of targeted scope */
#define FLASH_OPER_RESERVE_ORIGINAL_DATA        0
/* if set, the parameters check will be implemented in function */
#define HAL_PARAMETER_CHECK                     0
/* if set, print debug message according to level of marco 'HAL_DEBUG_PRINTF_LEVEL'and halt code according to level of marco 'HAL_DEBUG_HALT_LEVEL' */
#define HAL_DEBUG                               0#if (1 == HAL_DEBUG)
#define HAL_DEBUG_PRINTF                        printf
#define HAL_DEBUG_PRINTF_LEVEL                  HAL_DEBUG_LVL_ALL
#define HAL_DEBUG_HALT_LEVEL                    HAL_DEBUG_LVL_NONE#define HAL_DEBUG_UART                          USART0
#define HAL_DEBUG_EXTRA_DO
#endif /* 1 == HAL_DEBUG *//* define value of high speed crystal oscillator (HXTAL) in Hz */
#define HAL_HXTAL_VALUE                         ((uint32_t)8000000)
/*!< HXTAL state change timeout (in ms) */
#define HAL_HXTAL_TIMEOUT                       ((uint32_t)100)
/* define value of low speed crystal oscillator (LXTAL)in Hz */
#define HAL_LXTAL_VALUE                         ((uint32_t)32768)
/*!< LXTAL state change timeout (in ms) */
#define HAL_LXTAL_TIMEOUT                       ((uint32_t)5000)#include "gd32f3x0_hal_dma.h"
#include "gd32f3x0_hal_fmc.h"
#include "gd32f3x0_hal_pmu.h"
#include "gd32f3x0_hal_dac.h"
#include "gd32f3x0_hal_gpio.h"
#include "gd32f3x0_hal_rcu.h"
#include "gd32f3x0_hal_exti.h"
#include "gd32f3x0_hal_sys.h"
#include "gd32f3x0_hal_syscfg.h"
#include "gd32f3x0_hal_nvic.h"
#include "gd32f3x0_hal_cmp.h"
#include "gd32f3x0_hal_cec.h"
#include "gd32f3x0_hal_crc.h"
#include "gd32f3x0_hal_adc.h"
#include "gd32f3x0_hal_ctc.h"
#include "gd32f3x0_hal_fwdgt.h"
#include "gd32f3x0_hal_tsi.h"
#include "gd32f3x0_hal_wwdgt.h"
#include "gd32f3x0_hal_spi_com.h"
#include "gd32f3x0_hal_spi.h"
#include "gd32f3x0_hal_i2s.h"
#include "gd32f3x0_hal_usart_com.h"
#include "gd32f3x0_hal_uart.h"
#include "gd32f3x0_hal_usrt.h"
#include "gd32f3x0_hal_irda.h"
#include "gd32f3x0_hal_smartcard.h" 
#include "gd32f3x0_hal_rtc.h" 
#include "gd32f3x0_hal_i2c_com.h"
#include "gd32f3x0_hal_i2c.h"
#include "gd32f3x0_hal_smbus.h"
#include "gd32f3x0_hal_timer.h"
#endif /* GD32F3X0_LIBOPT_H */

备注

上位机的串口调试助手,打开串口后,要打开RTS/DTR选项(debug - 串口助手 - 如果不勾选RTS/DTR, 不能正常收发),否则不能正确收包,导致自己误会自己的固件工程实现或硬件焊接问题。

END

相关文章:

GD - EmbeddedBuilder - 用DMA进行串口发送接收,支持接收不定长包

文章目录 GD - EmbeddedBuilder - 用DMA进行串口发送接收&#xff0c;支持接收不定长包概述笔记硬件连接图形化配置485EN的配置串口的图形化配置 代码实现main.cgd32f3x0_hal_it.cgd32f3x0_hal_init.cgd32f3x0_hal_init.hgd32f3x0_hal_it.hgd32f3x0_libopt.h 备注END GD - Embe…...

英语中apartment(公寓)(美式)、house(房子)、flat(公寓)(英式)、villa(别墅)、room(房间)区别

文章目录 英语中apartment、house、flat、villa、room区别 英语中apartment、house、flat、villa、room区别 在英语中&#xff0c;“apartment”、“house”、“flat”、“villa”、和 “room” 这些词语都与居住空间有关&#xff0c;但它们各自的含义和用途有所不同&#xff…...

黑马头条vue2.0项目实战(十一)——功能优化(组件缓存、响应拦截器、路由跳转与权限管理)

1. 组件缓存 1.1 介绍 先来看一个问题&#xff1f; 从首页切换到我的&#xff0c;再从我的回到首页&#xff0c;我们发现首页重新渲染原来的状态没有了。 首先&#xff0c;这是正常的状态&#xff0c;并非问题&#xff0c;路由在切换的时候会销毁切出去的页面组件&#xff…...

《AI视频类工具之一——​ 即创》

一.简介 官网:即创 - 一站式智能创意生产与管理平台 即创是字节跳动(现更名为抖音集团)旗下的一款一站式智能创意生产与管理平台,旨在帮助用户高效地进行创意内容的生成、管理和分析。 二.功能介绍 视频创作: 智能成片:利用AI技术自动编辑视频片段,快速生成完整的视频…...

CSS的:host伪类:精确定位于Web组件的指南

随着Web组件技术的发展&#xff0c;自定义元素&#xff08;Custom Elements&#xff09;已经成为现代Web开发中不可或缺的一部分。CSS的:host伪类为Web组件的样式封装提供了一种强大的工具&#xff0c;它允许开发者为自定义Web组件的宿主元素定义样式。本文将详细介绍:host伪类…...

安卓sdk manager下载安装

安卓sdk下载安装 android SDK manager下载 环境变量配置 ANDROID_HOME&#xff1a;D:\Android %ANDROID_HOME%\tools %ANDROID_HOME%\platform-tools %ANDROID_HOME%\build-tools\29.0.3Android SDK Platform-tools公用开发工具包&#xff0c;需要下载 Android SDK Tools基础…...

CV学习笔记3-图像特征提取

图像特征提取是计算机视觉中的一个关键步骤&#xff0c;其目标是从图像中提取有意义的特征&#xff0c;以便进行进一步的分析或任务&#xff0c;如分类、检测、分割等。特征提取可以帮助减少数据的维度&#xff0c;同时保留重要的信息。以下是常见的图像特征提取方法和技术&…...

Git使用方法(三)---简洁版上传git代码

1 默认已经装了sshWindows下安装SSH详细介绍-CSDN博客 2 配置链接github的SSH秘钥 1 我的.ssh路径 2 进入路径cd .ssh 文件 3 生成密钥对 ssh-keygen -t rsa -b 4096 (-t 秘钥类型 -b 生成大小) 输入完会出现 Enter file in which to save the key (/c/Users/Administrator/…...

8.21-部署eleme项目

1.设置主从从mysql57服务器 &#xff08;1&#xff09;配置主数据库 [rootmsater_5 ~]# systemctl stop firewalld[rootmsater_5 ~]# setenforce 0[rootmsater_5 ~]# systemctl disable firewalldRemoved symlink /etc/systemd/system/multi-user.target.wants/firewalld.serv…...

多目标跟踪之ByteTrack论文(翻译+精读)

ByteTrack&#xff1a;通过关联每个检测框进行多对象跟踪 摘要 翻译 多对象跟踪&#xff08;MOT&#xff09;旨在估计视频中对象的边界框和身份。大多数方法通过关联分数高于阈值的检测框来获取身份。检测分数低的物体&#xff0c;例如被遮挡的物体被简单地丢弃&#xff0c;…...

【实践】Java开发常用工具类或中间件

在Java开发中&#xff0c;有许多常用的工具类和中间件&#xff0c;它们可以显著提高开发效率&#xff0c;简化代码&#xff0c;并提供强大的功能。这些工具类和中间件广泛应用于各种类型的Java应用程序中&#xff0c;包括Web应用、企业级应用、微服务等。以下是一些在Java开发中…...

Vue2移动端(H5项目)项目封装车牌选择组件

一、最终效果 二、参数配置 1、代码示例&#xff1a; <t-keyword:isShow"isShow"ok"isShowfalse"cancel"isShowfalse"inputchange"inputchange":finalValue"trailerNo"/>2、配置参数&#xff08;TKeyword Attribute…...

四川财谷通信息技术有限公司抖音小店的优势

在数字化浪潮的推动下&#xff0c;电商行业迎来了前所未有的发展机遇&#xff0c;而抖音小店作为新兴的电商平台&#xff0c;凭借其独特的社交属性和便捷的购物体验&#xff0c;迅速赢得了广大消费者的青睐。在众多抖音小店中&#xff0c;四川财谷通信息技术有限公司旗下的抖音…...

2025届八股文:计算机网络高频重点面试题

鉴于排版复杂且篇幅过长&#xff0c;本文仅列举出问题&#xff0c;而未给出答案&#xff0c;有需要答案的同学可后台私信。整理总结不易&#xff0c;请尊重劳动成果&#xff0c;转载请注明出处。 目录 网络基础 HTTP TCP UDP IP PING WebSocket DNS 网络安全 网络基础…...

嵌入式和单片机有什么区别?

目录 &#xff08;1&#xff09;什么是嵌入式&#xff1f; &#xff08;2&#xff09;什么是单片机&#xff1f; &#xff08;3&#xff09;嵌入式和单片机的共同点 &#xff08;4&#xff09;嵌入式和单片机的区别 &#xff08;1&#xff09;什么是嵌入式&#xff1f; 关…...

JSON.stringify 和 JSON.parse

JSON.stringify 是一个将 JavaScript 对象转换为 JSON 字符串的方法&#xff0c;它有三个参数&#xff1a; JSON.stringify(value, replacer, space) 参数详解 value &#xff08;必需&#xff09;: 这是你想要转换为 JSON 字符串的 JavaScript 对象或数组。例如&#xff1a;…...

APP架构设计_2.用MVVM架构实现一个具体业务

2.MVVM架构图 3.MVVM 实现一个具体业务 3.1 界面层的实现 界面层实现时&#xff0c;需要遵循以下几点。 1&#xff09;选择实现界面的元素 界面元素可以用 view 或 compose 来实现&#xff0c;这里用 view 实现。 2&#xff09;提供一个状态容器 这里使用 ViewModel 作为状态容…...

安恒信息总裁宋端智,辞职了!活捉一枚新鲜出炉的餐饮人!

吉祥知识星球http://mp.weixin.qq.com/s?__bizMzkwNjY1Mzc0Nw&mid2247485367&idx1&sn837891059c360ad60db7e9ac980a3321&chksmc0e47eebf793f7fdb8fcd7eed8ce29160cf79ba303b59858ba3a6660c6dac536774afb2a6330#rd 《网安面试指南》http://mp.weixin.qq.com/s?…...

《javaEE篇》--定时器

定时器概念 当我们不需要某个线程立刻执行&#xff0c;而是在指定时间点或指定时间段之后执行&#xff0c;假如我们要定期清理数据库里的一些信息时&#xff0c;如果每次都手动清理的话就太麻烦&#xff0c;所以就可以使用定时器。定时器就可以比作一个闹钟&#xff0c;可以让…...

OpenLayers3, 缩放、平移、复位操作

文章目录 一、前言二、代码示例 一、前言 本文基于OpenLayers3实现地图缩放、平移和复位操作 二、代码示例 <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htm…...

【Python】 -- 趣味代码 - 小恐龙游戏

文章目录 文章目录 00 小恐龙游戏程序设计框架代码结构和功能游戏流程总结01 小恐龙游戏程序设计02 百度网盘地址00 小恐龙游戏程序设计框架 这段代码是一个基于 Pygame 的简易跑酷游戏的完整实现,玩家控制一个角色(龙)躲避障碍物(仙人掌和乌鸦)。以下是代码的详细介绍:…...

Cursor实现用excel数据填充word模版的方法

cursor主页&#xff1a;https://www.cursor.com/ 任务目标&#xff1a;把excel格式的数据里的单元格&#xff0c;按照某一个固定模版填充到word中 文章目录 注意事项逐步生成程序1. 确定格式2. 调试程序 注意事项 直接给一个excel文件和最终呈现的word文件的示例&#xff0c;…...

ES6从入门到精通:前言

ES6简介 ES6&#xff08;ECMAScript 2015&#xff09;是JavaScript语言的重大更新&#xff0c;引入了许多新特性&#xff0c;包括语法糖、新数据类型、模块化支持等&#xff0c;显著提升了开发效率和代码可维护性。 核心知识点概览 变量声明 let 和 const 取代 var&#xf…...

相机Camera日志实例分析之二:相机Camx【专业模式开启直方图拍照】单帧流程日志详解

【关注我&#xff0c;后续持续新增专题博文&#xff0c;谢谢&#xff01;&#xff01;&#xff01;】 上一篇我们讲了&#xff1a; 这一篇我们开始讲&#xff1a; 目录 一、场景操作步骤 二、日志基础关键字分级如下 三、场景日志如下&#xff1a; 一、场景操作步骤 操作步…...

PPT|230页| 制造集团企业供应链端到端的数字化解决方案:从需求到结算的全链路业务闭环构建

制造业采购供应链管理是企业运营的核心环节&#xff0c;供应链协同管理在供应链上下游企业之间建立紧密的合作关系&#xff0c;通过信息共享、资源整合、业务协同等方式&#xff0c;实现供应链的全面管理和优化&#xff0c;提高供应链的效率和透明度&#xff0c;降低供应链的成…...

1.3 VSCode安装与环境配置

进入网址Visual Studio Code - Code Editing. Redefined下载.deb文件&#xff0c;然后打开终端&#xff0c;进入下载文件夹&#xff0c;键入命令 sudo dpkg -i code_1.100.3-1748872405_amd64.deb 在终端键入命令code即启动vscode 需要安装插件列表 1.Chinese简化 2.ros …...

Mobile ALOHA全身模仿学习

一、题目 Mobile ALOHA&#xff1a;通过低成本全身远程操作学习双手移动操作 传统模仿学习&#xff08;Imitation Learning&#xff09;缺点&#xff1a;聚焦与桌面操作&#xff0c;缺乏通用任务所需的移动性和灵活性 本论文优点&#xff1a;&#xff08;1&#xff09;在ALOHA…...

在Ubuntu24上采用Wine打开SourceInsight

1. 安装wine sudo apt install wine 2. 安装32位库支持,SourceInsight是32位程序 sudo dpkg --add-architecture i386 sudo apt update sudo apt install wine32:i386 3. 验证安装 wine --version 4. 安装必要的字体和库(解决显示问题) sudo apt install fonts-wqy…...

回溯算法学习

一、电话号码的字母组合 import java.util.ArrayList; import java.util.List;import javax.management.loading.PrivateClassLoader;public class letterCombinations {private static final String[] KEYPAD {"", //0"", //1"abc", //2"…...

【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的“no matching...“系列算法协商失败问题

【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的"no matching..."系列算法协商失败问题 摘要&#xff1a; 近期&#xff0c;在使用较新版本的OpenSSH客户端连接老旧SSH服务器时&#xff0c;会遇到 "no matching key exchange method found"​, "n…...