From 2a0e0b40b64f3c7266c51f016acce57714de2060 Mon Sep 17 00:00:00 2001 From: yelvlab Date: Wed, 2 Apr 2025 14:12:25 +0800 Subject: [PATCH] Revert "auto detect drive current function OK!!!" This reverts commit 6c37fecd28770b74befd507383ad75360f663d4e. --- CMakeLists.txt | 2 +- inc/ldc1612.h | 2 +- src/main.c | 24 ++++-------------------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6a6946..1d0e927 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(xlsw_3dp_LDC1612) set(VERSION_MAJOR 0) set(VERSION_MINOR 2) -set(VERSION_PATCH 1) +set(VERSION_PATCH 0) set(VERSION "V${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") string(TIMESTAMP CURRENT_DATE "%Y-%m-%d") set(IIC_TYPE "SW-IIC") diff --git a/inc/ldc1612.h b/inc/ldc1612.h index c5c1979..f11cae6 100644 --- a/inc/ldc1612.h +++ b/inc/ldc1612.h @@ -48,7 +48,7 @@ /******************************************************************************/ #define LDC1612_CONVERSION_TIME_CH0 0x0546 //0536 -#define LDC1612_DRIVE_CURRENT 0xB000 //A000 +#define LDC1612_DRIVE_CURRENT 0x9000 //A000 #define LDC1612_MUX_CONFIG 0x020C // no auto scan and filter bandwidth 3.3MHz #define LDC1612_SENSOR_CONFIG 0x1601 #define LDC1612_ERROR_CONFIG 0x0000 diff --git a/src/main.c b/src/main.c index acb2730..85babea 100644 --- a/src/main.c +++ b/src/main.c @@ -33,30 +33,14 @@ int main(void) { #endif /* configure LDC1612 */ - // ldc1612_single_ch0_config(); - - - + ldc1612_single_ch0_config(); /* Initialize watchdog */ - // watchdog_init(); + watchdog_init(); while (1) { - - // delay_ms(10); - uint8_t data[2] = {0}; - ldc1612_set_freq_divide(CHANNEL_0); - soft_i2c_read_16bits(LDC1612_ADDR, SENSOR_CONFIG_REG, data); - printf("SENSOR_CONFIG_REG: 0x%x\n", (data[0] << 8) | data[1]); - soft_i2c_write_16bits(LDC1612_ADDR, SENSOR_CONFIG_REG, (data[0] << 8) | data[1]); - ldc1612_set_sensor_config(LDC1612_SENSOR_CONFIG); //0x1A --0x1601 - delay_ms(100); - soft_i2c_read_16bits(LDC1612_ADDR, SET_DRIVER_CURRENT_REG, data); - printf("sensor config: 0x%x\n", (data[0] << 8) | data[1]); - printf("sensor config: 0x%x\n", (((data[0] << 8) | data[1]) >> 6) & 0x1F); - printf("drive current value: 0x%x\n", (((((data[0] << 8) | data[1]) >> 6) & 0x1F) << 11) | 0x0000); - delay_ms(999); - // fwdgt_counter_reload(); + delay_ms(99); + fwdgt_counter_reload(); } }