9 Commits

Author SHA1 Message Date
ca332e9ea1 debug 2025-01-09 15:48:50 +08:00
7ffb8c0612 修改变量的声明位置和修饰符 2025-01-08 17:16:12 +08:00
7075fd16ea clean & update version 2025-01-08 14:04:18 +08:00
f7ef4b5af7 Merge branch 'feature-ultrasonic' into dev
# Conflicts:
#	CMakeLists.txt
#	inc/main.h
#	inc/rs485_protocol.h
#	src/main.c
#	src/rs485_protocol.c
2025-01-08 14:02:40 +08:00
e940c69d49 clean 2025-01-08 13:57:25 +08:00
a0ba0c6bd1 update version IR development version 2025-01-08 09:17:30 +08:00
389d480da7 修改通信协议部分,修改版型为0x04 2025-01-08 09:14:18 +08:00
c12273fd46 主函数中重复执行,500ms间隔获取温度数据 2025-01-08 00:35:20 +08:00
e86f8b0dd3 使用硬件IIC实现回去数据,并且,间隔缩小到300ms 2025-01-07 15:42:56 +08:00
6 changed files with 17 additions and 34 deletions

View File

@@ -6,7 +6,7 @@ set(PROJECT_NAME "XLSW_3DP_US-IR")
project(${PROJECT_NAME}) project(${PROJECT_NAME})
set(VERSION_MAJOR 0) set(VERSION_MAJOR 0)
set(VERSION_MINOR 1) set(VERSION_MINOR 2)
set(VERSION_PATCH 0) set(VERSION_PATCH 0)
set(VERSION "V${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") set(VERSION "V${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
string(TIMESTAMP CURRENT_DATE "%Y-%m-%d") string(TIMESTAMP CURRENT_DATE "%Y-%m-%d")
@@ -42,7 +42,6 @@ set(TARGET_C_SRC
${CMAKE_SOURCE_DIR}/src/rs485_protocol.c ${CMAKE_SOURCE_DIR}/src/rs485_protocol.c
${CMAKE_SOURCE_DIR}/src/ultrasonic_analog.c ${CMAKE_SOURCE_DIR}/src/ultrasonic_analog.c
${CMAKE_SOURCE_DIR}/src/gd60914.c ${CMAKE_SOURCE_DIR}/src/gd60914.c
${CMAKE_SOURCE_DIR}/src/ultrasonic_analog.c
) )
add_executable(${PROJECT_NAME} ${TARGET_C_SRC}) add_executable(${PROJECT_NAME} ${TARGET_C_SRC})

View File

@@ -43,7 +43,6 @@ OF SUCH DAMAGE.
#include "usart.h" #include "usart.h"
#include "fwdgt.h" #include "fwdgt.h"
#include "board_config.h" #include "board_config.h"
#include "ultrasonic_analog.h"
#include "gd60914.h" #include "gd60914.h"
#include "ultrasonic_analog.h" #include "ultrasonic_analog.h"

View File

@@ -15,7 +15,7 @@ void watchdog_init(void) {
rcu_osci_stab_wait(RCU_IRC40K); rcu_osci_stab_wait(RCU_IRC40K);
/* Configure FWDGT counter clock: 40KHz(IRC40K) / 64 = 0.625 KHz */ /* Configure FWDGT counter clock: 40KHz(IRC40K) / 64 = 0.625 KHz */
fwdgt_config(625, FWDGT_PSC_DIV64); // Set timeout to 1 seconds (625 / 0.625 KHz) fwdgt_config(625, FWDGT_PSC_DIV256); // Set timeout to 1 seconds (625 / 0.625 KHz)
/* Enable FWDGT */ /* Enable FWDGT */
fwdgt_enable(); fwdgt_enable();

View File

@@ -34,7 +34,7 @@ OF SUCH DAMAGE.
#include "gd32e23x_it.h" #include "gd32e23x_it.h"
__IO uint16_t g_capture_value; extern uint16_t g_capture_value;
/*! /*!
\brief this function handles NMI exception \brief this function handles NMI exception

View File

@@ -7,9 +7,7 @@
#include "main.h" #include "main.h"
volatile uint8_t g_temperature_uint8[2] = {0}; volatile uint8_t g_temperature_uint8[2] = {0};
volatile uint16_t g_capture_value;
extern uint16_t g_capture_value;
uint16_t g_distance_uint16;
/*! /*!
\brief main function \brief main function
@@ -29,24 +27,29 @@ int main(void)
/* configure FWDGT */ /* configure FWDGT */
watchdog_init(); watchdog_init();
#ifdef SOFTWARE_IIC // #ifdef SOFTWARE_IIC
soft_i2c_config(); // soft_i2c_config();
#else // #else
i2c_config(); // i2c_config();
#endif // #endif
printf("system start!\r\n"); printf("system start!\r\n");
ultrasonic_config(); ultrasonic_config();
// gpio_bit_write(RS485_EN_PORT, RS485_EN_PIN, RESET);
while(1){ while(1){
gd60914_get_object_tempture(); // gd60914_get_object_tempture();
delay_ms(50); delay_ms(500);
ultrasonic_pwm_out_cycles(ULTRASONIC_TX_CYCLES); ultrasonic_pwm_out_cycles(ULTRASONIC_TX_CYCLES);
delay_ms(10);
uint16_t distance = ultrasonic_calc_distance();
printf("%u\r\n", distance);
watchdog_reload(); watchdog_reload();
} }
} }

View File

@@ -102,24 +102,6 @@ void gd60914_tempture_report(void) {
printf("%c%c", g_temperature_uint8[1], g_temperature_uint8[0]); printf("%c%c", g_temperature_uint8[1], g_temperature_uint8[0]);
printf("%c", calculate_crc(combined_data, 6)); printf("%c", calculate_crc(combined_data, 6));
} }
// void eddy_current_value_report(void) {
// static uint32_t eddy_current_value_uint32 = 0;
//
// eddy_current_value_uint32 = ldc1612_get_raw_channel_result(CHANNEL_0);
//
// package_data[0] = (eddy_current_value_uint32 >> 24) & 0xFF;
// package_data[1] = (eddy_current_value_uint32 >> 16) & 0xFF;
// package_data[2] = (eddy_current_value_uint32 >> 8) & 0xFF;
// package_data[3] = eddy_current_value_uint32 & 0xFF;
//
// uint8_t combined_data[7];
// memcpy(combined_data, package_header, 3);
// memcpy(combined_data + 3, package_data, 4);
//
// printf("%c%c%c", package_header[0], package_header[1], package_header[2]);
// printf("%c%c%c%c", package_data[0], package_data[1], package_data[2], package_data[3]);
// printf("%c", calculate_crc(combined_data, 8));
// }
void ultrasonic_distance_report(void) { void ultrasonic_distance_report(void) {
static uint16_t distance_uint16 = 0; static uint16_t distance_uint16 = 0;