Revert "auto detect drive current function OK!!!"

This reverts commit 6c37fecd28770b74befd507383ad75360f663d4e.
This commit is contained in:
yelvlab 2025-04-02 14:12:25 +08:00
parent 6c37fecd28
commit 2a0e0b40b6
3 changed files with 6 additions and 22 deletions

View File

@ -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")

View File

@ -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

View File

@ -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();
}
}