Sfoglia il codice sorgente

1、修改SGM832A读取电流和功耗的准确性,不读取没用到的寄存器数据,POWER-Z电子测量仪本身的耗电电流有20~30mA(按照5V供电时功耗有100~150mW),实际测量的数据需减去POWER-Z本身的损耗
Set sgm832 calibration register, CAL=0.00512/(Current_LSB*Rshunt), Current_LSB=Max_Expected_Current/(2^15),
Max_Expected_Current = 3A, Rshunt = 0.028Ω, Current_LSB=3A/(2^15) ≈ 0.00009A,
CAL=0.00512/(0.00009A*0.028Ω) ≈ 2000 = 0x07D0, so CAL = 0x07D0
There is a ratio of 25 between the LSB of the power and the Current_LSB
2、不注册activity、workout、weather、music、heart_rate部件
3、调整部分文字内容靠左对齐

mohliy 3 mesi fa
parent
commit
c6545419d4

BIN
application/aem_watch/boards/ats3085s4_dev_watch_ext_nor/res/bt_watch.enG


BIN
application/aem_watch/boards/ats3085s4_dev_watch_ext_nor/res/bt_watch.zhC


File diff suppressed because it is too large
+ 0 - 0
application/aem_watch/boards/ats3085s4_dev_watch_ext_nor/res/txt/bt_watch_12.txt


File diff suppressed because it is too large
+ 0 - 0
application/aem_watch/boards/ats3085s4_dev_watch_ext_nor/res/txt/bt_watch_12_zhC.txt


+ 4 - 4
application/aem_watch/resource/360x360/bt_watch_enG.c

@@ -462,11 +462,11 @@ static const uint8_t STR_230[] = {0x52, 0x61, 0x69, 0x73, 0x65, 0x20, 0x74, 0x6f
 
 static const uint8_t STR_231[] = {0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x0}; 
 
-static const uint8_t STR_232[] = {0x52, 0x65, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x65, 0x72, 0x61, 0x73, 0x65, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x0}; 
+static const uint8_t STR_232[] = {0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x65, 0x72, 0x61, 0x73, 0x65, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x0}; 
 
 static const uint8_t STR_233[] = {0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x0}; 
 
-static const uint8_t STR_234[] = {0x53, 0x75, 0x72, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x3f, 0x0}; 
+static const uint8_t STR_234[] = {0x53, 0x75, 0x72, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x3f, 0x0}; 
 
 static const uint8_t STR_235[] = {0x52, 0x69, 0x6e, 0x67, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x0}; 
 
@@ -490,7 +490,7 @@ static const uint8_t STR_244[] = {0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x0};
 
 static const uint8_t STR_245[] = {0x50, 0x61, 0x69, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x73, 0x0}; 
 
-static const uint8_t STR_246[] = {0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x20, 0x44, 0x6f, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x3f, 0x0}; 
+static const uint8_t STR_246[] = {0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x65, 0x72, 0x61, 0x73, 0x65, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x20, 0xa, 0x44, 0x6f, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x3f, 0x0}; 
 
 static const uint8_t STR_247[] = {0x54, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x0}; 
 
@@ -522,7 +522,7 @@ static const uint8_t STR_260[] = {0x43, 0x6f, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x67
 
 static const uint8_t STR_261[] = {0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x0}; 
 
-static const uint8_t STR_262[] = {0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x58, 0x58, 0x20, 0x41, 0x70, 0x70, 0x20, 0x74, 0x6f, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x50, 0x6c, 0x61, 0x79, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x41, 0x70, 0x70, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x0}; 
+static const uint8_t STR_262[] = {0x50, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x43, 0x61, 0x74, 0x73, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x41, 0x70, 0x70, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x50, 0x6c, 0x61, 0x79, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2c, 0x20, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x41, 0x70, 0x70, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x0}; 
 
 static const uint8_t STR_263[] = {0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x0}; 
 

+ 1 - 1
application/aem_watch/resource/360x360/bt_watch_zhC.c

@@ -522,7 +522,7 @@ static const uint8_t STR_260[] = {0xe8, 0xbf, 0x9e, 0xe6, 0x8e, 0xa5, 0xe6, 0x88
 
 static const uint8_t STR_261[] = {0xe6, 0xad, 0xa3, 0xe5, 0x9c, 0xa8, 0xe8, 0xbf, 0x9e, 0xe6, 0x8e, 0xa5, 0x0}; 
 
-static const uint8_t STR_262[] = {0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0xe7, 0xb3, 0xbb, 0xe7, 0xbb, 0x9f, 0xe5, 0x89, 0x8d, 0xe5, 0xbe, 0x80, 0x58, 0x58, 0xe4, 0xb8, 0x8b, 0xe8, 0xbd, 0xbd, 0x58, 0x58, 0xef, 0xbc, 0x9b, 0xa, 0x69, 0x4f, 0x53, 0xe7, 0xb3, 0xbb, 0xe7, 0xbb, 0x9f, 0xe5, 0x89, 0x8d, 0xe5, 0xbe, 0x80, 0x58, 0x58, 0xe4, 0xb8, 0x8b, 0xe8, 0xbd, 0xbd, 0x58, 0x58, 0x0}; 
+static const uint8_t STR_262[] = {0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0xe7, 0xb3, 0xbb, 0xe7, 0xbb, 0x9f, 0xe5, 0x89, 0x8d, 0xe5, 0xbe, 0x80, 0xe5, 0xba, 0x94, 0xe7, 0x94, 0xa8, 0xe5, 0x95, 0x86, 0xe5, 0x9f, 0x8e, 0xe4, 0xb8, 0x8b, 0xe8, 0xbd, 0xbd, 0x43, 0x61, 0x74, 0x73, 0x69, 0x67, 0x68, 0x74, 0x73, 0xef, 0xbc, 0x9b, 0xa, 0x49, 0x4f, 0x53, 0xe5, 0x89, 0x8d, 0xe5, 0xbe, 0x80, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe4, 0xb8, 0x8b, 0xe8, 0xbd, 0xbd, 0x43, 0x61, 0x74, 0x73, 0x69, 0x67, 0x68, 0x74, 0x73, 0x0}; 
 
 static const uint8_t STR_263[] = {0xe8, 0xaf, 0xad, 0xe8, 0xa8, 0x80, 0x0}; 
 

BIN
application/aem_watch/resource/multiLang_translate_table.xls


+ 3 - 0
application/aem_watch/simulator/LVGL.Simulator/bt_watch_simulator.c

@@ -604,6 +604,7 @@ aem_clock_desc_t aem_watchface_db_begin[] =
             .editable = 0,
             .op = &profile_photo_ops,
         },
+        /*
         {
             .clock_id = WIDGET_ID_OFTEN_WORKOUT,
             .editable = 0,
@@ -624,11 +625,13 @@ aem_clock_desc_t aem_watchface_db_begin[] =
             .editable = 0,
             .op = &wf_music_ops,
         },
+        
         {
             .clock_id = WIDGET_ID_HEART_RATE,
             .editable = 0,
             .op = &wf_heart_rate_ops,
         },
+        */
 };
 
 aem_clock_desc_t *aem_watchface_db_end = NULL;

+ 1 - 1
application/aem_watch/src/application/activity/aem_widget_activity.c

@@ -150,4 +150,4 @@ const aem_clock_ops_t activity_ops =
     .refresh = on_ui_refresh,
 };
 
-AEM_BUILTIN_WATCHFACE_REGISTER(WIDGET_ID_ACTIVITY, 0, NULL, &activity_ops);
+//AEM_BUILTIN_WATCHFACE_REGISTER(WIDGET_ID_ACTIVITY, 0, NULL, &activity_ops);

+ 1 - 1
application/aem_watch/src/application/boot_binding/aem_boot_binding_main.c

@@ -70,7 +70,7 @@ static void create_ui(void)
         text_canvas_set_long_mode(tips, TEXT_CANVAS_LONG_WRAP);
         text_canvas_set_text(tips, res_manager_get_string_from_id(ID_KEY_SETUPWIZARD_DOWNLOAD_APP));
         lv_obj_set_style_text_color(tips, lv_color_white(), 0);
-        lv_obj_set_style_text_align(tips, LV_TEXT_ALIGN_CENTER, 0);
+        lv_obj_set_style_text_align(tips, LV_TEXT_ALIGN_LEFT, 0);
         lv_obj_align(tips, LV_ALIGN_TOP_MID, 0, DEF_UI_HEIGHT * 0.2);
     }
 

+ 1 - 1
application/aem_watch/src/application/health/heart_rate/aem_wf_heart_rate.c

@@ -444,4 +444,4 @@ const aem_clock_ops_t wf_heart_rate_ops =
         .refresh = NULL,
 };
 
-AEM_BUILTIN_WATCHFACE_REGISTER(WIDGET_ID_HEART_RATE, 0, NULL, &wf_heart_rate_ops);
+//AEM_BUILTIN_WATCHFACE_REGISTER(WIDGET_ID_HEART_RATE, 0, NULL, &wf_heart_rate_ops);

+ 1 - 1
application/aem_watch/src/application/in_out_power/aem_in_out_power_screen.c

@@ -373,7 +373,7 @@ void aem_in_out_power_screen_update(lv_obj_t *par)
         }
         //if (power_volt_cur_data->in_current_value)
         {
-            if (f_Current[1] < 0.05)
+            if (f_Current[1] < 0.03)
             {
                 sprintf(str_data, "%6.3f", f_Current[0]);
                 text_canvas_set_text(power_volt_cur_data->in_current_value, str_data);

+ 1 - 1
application/aem_watch/src/application/settings/aem_bt_connect_more.c

@@ -155,7 +155,7 @@ static void create_ui(void)
     if (tips)
     {
         lv_obj_set_width(tips, AEM_SIZE_FACTOR_466(tipe_w));
-        lv_obj_set_style_text_align(tips, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
+        lv_obj_set_style_text_align(tips, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN);
         lv_obj_set_style_text_color(tips, lv_color_white(), LV_PART_MAIN);
         lv_obj_set_style_text_font(tips, aem_font_sub(), LV_PART_MAIN);
         lv_obj_add_flag(tips, LV_OBJ_FLAG_CLICKABLE);

+ 1 - 1
application/aem_watch/src/application/settings/aem_system_tips.c

@@ -188,7 +188,7 @@ static void create_ui(void)
     if (tips)
     {
         lv_obj_set_width(tips, AEM_SIZE_FACTOR_466(tipe_w));
-        lv_obj_set_style_text_align(tips, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
+        lv_obj_set_style_text_align(tips, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN);
         lv_obj_set_style_text_color(tips, lv_color_white(), LV_PART_MAIN);
         lv_obj_set_style_text_font(tips, aem_font_def(), LV_PART_MAIN);
         lv_obj_add_flag(tips, LV_OBJ_FLAG_CLICKABLE);

+ 1 - 1
application/aem_watch/src/application/tool/music/aem_wf_music.c

@@ -132,4 +132,4 @@ const aem_clock_ops_t wf_music_ops =
         .refresh = on_ui_refresh,
 };
 
-AEM_BUILTIN_WATCHFACE_REGISTER(WIDGET_ID_MUSIC, 0, NULL, &wf_music_ops);
+//AEM_BUILTIN_WATCHFACE_REGISTER(WIDGET_ID_MUSIC, 0, NULL, &wf_music_ops);

+ 1 - 1
application/aem_watch/src/application/tool/weather/aem_wf_weather.c

@@ -239,4 +239,4 @@ const aem_clock_ops_t wf_weather_ops =
         .refresh = NULL,
 };
 
-AEM_BUILTIN_WATCHFACE_REGISTER(WIDGET_ID_WEATHER, 0, NULL, &wf_weather_ops);
+//AEM_BUILTIN_WATCHFACE_REGISTER(WIDGET_ID_WEATHER, 0, NULL, &wf_weather_ops);

+ 1 - 1
application/aem_watch/src/application/workout/aem_widget_workout.c

@@ -439,4 +439,4 @@ const aem_clock_ops_t workout_ops =
         .refresh = on_ui_refresh,
 };
 
-AEM_BUILTIN_WATCHFACE_REGISTER(WIDGET_ID_OFTEN_WORKOUT, 0, NULL, &workout_ops);
+//AEM_BUILTIN_WATCHFACE_REGISTER(WIDGET_ID_OFTEN_WORKOUT, 0, NULL, &workout_ops);

+ 1 - 1
thirdparty/lib/aem/config/aem_project.h

@@ -4,7 +4,7 @@
 #pragma warning(error : 4013)
 #endif
 #define AEM_VERSION "BL_Develop_NOR"
-#define BUILD_TIME "202412231702"
+#define BUILD_TIME "202412241923"
 #define AEM_GUI_FWK_LIB_VER "2.0.0.0"
 #define APP_DOWNLOAD_URL "https://customer.com"
 #define AEM_APP_TRANS_ANIMATION 1

+ 27 - 17
zephyr/drivers/input/sgm832a_acts.c

@@ -121,8 +121,8 @@ static void sgm832_typec_get_data(const struct device *i2c_dev, uint16_t sgm832_
 	static uint16_t read_data[1] = {0};
 	int ret = 0;
 
-	printk("sgm832 typec%d get data\n", typec_num);
-
+	//printk("sgm832 typec%d get data\n", typec_num);
+/*
     //00H Configuartion Register
 	ret = i2c_write_read(i2c_dev, sgm832_typec_slaver_addr, write_cmd, 1, read_data, 2);
 	if (ret != 0)
@@ -131,8 +131,8 @@ static void sgm832_typec_get_data(const struct device *i2c_dev, uint16_t sgm832_
 	}
 	
 	read_data[0] = ((read_data[0]  & 0xFF00) >> 8) + ((read_data[0] & 0x00FF) << 8);
-	printk("ConfigReg: 0x%04x\n", read_data[0]);
-
+	//printk("ConfigReg: 0x%04x\n", read_data[0]);
+*/
     //01H Shunt Voltage Register
 	ret = i2c_write_read(i2c_dev, sgm832_typec_slaver_addr, &write_cmd[1], 1, read_data, 2);
 	if (ret == 0)
@@ -149,9 +149,7 @@ static void sgm832_typec_get_data(const struct device *i2c_dev, uint16_t sgm832_
 	{
 		printk("sgm832 typec%d i2c_write_read Shunt_Voltage ERR\n", typec_num);
 	}
-    printk("Shunt_Voltage: %.4f mV\n", f_ShuntVoltage[typec_num]);
-	//printk("ConfigReg: 0x%04x, ShuntVoltage: %.4f mV, BusVoltage: %.3f V, Power: 0x%04x, Current: 0x%04x, Calibration: 0x%04x, MaskEnable: 0x%04x, AlertLimit: 0x%04x\n",
-	//		read_data[0], f_ShuntVoltage, f_BusVoltage, read_data[3], read_data[4], read_data[5], read_data[6], read_data[7]);
+    //printk("Shunt_Voltage: %.4f mV\n", f_ShuntVoltage[typec_num]);
 
     //02H Bus Voltage Register
     ret = i2c_write_read(i2c_dev, sgm832_typec_slaver_addr, &write_cmd[2], 1, read_data, 2);
@@ -162,7 +160,7 @@ static void sgm832_typec_get_data(const struct device *i2c_dev, uint16_t sgm832_
 
     read_data[0] = ((read_data[0]  & 0xFF00) >> 8) + ((read_data[0] & 0x00FF) << 8);
     f_BusVoltage[typec_num] = (float)read_data[0] * 1.25 * 0.001;
-	printk("Bus_Voltage: %.3f V\n", f_BusVoltage[typec_num]);
+	//printk("Bus_Voltage: %.3f V\n", f_BusVoltage[typec_num]);
 
     //03H Power Register
     ret = i2c_write_read(i2c_dev, sgm832_typec_slaver_addr, &write_cmd[3], 1, read_data, 2);
@@ -172,8 +170,9 @@ static void sgm832_typec_get_data(const struct device *i2c_dev, uint16_t sgm832_
 	}
 
 	read_data[0] = ((read_data[0]  & 0xFF00) >> 8) + ((read_data[0] & 0x00FF) << 8);
-	f_Power[typec_num] = (float)read_data[0] * 225 * 0.001;  //W
-	printk("Power: %.3f mW\n", f_Power[typec_num]);
+	//There is a ratio of 25 between the LSB of the power and the Current_LSB	
+	f_Power[typec_num] = (float)read_data[0] * 25 * 0.00009;  //W
+	//printk("Power: %.3f mW\n", f_Power[typec_num]);
 
 	//04H Current Register
     ret = i2c_write_read(i2c_dev, sgm832_typec_slaver_addr, &write_cmd[4], 1, read_data, 2);
@@ -185,15 +184,17 @@ static void sgm832_typec_get_data(const struct device *i2c_dev, uint16_t sgm832_
             read_data[0] = ~read_data[0] + 1;
         }
 
-		f_Current[typec_num] = read_data[0] * 0.00009;  //A
+        //Current_LSB=Max_Expected_Current/(2^15),
+		//Max_Expected_Current = 3A, 
+		//Current_LSB=3A/(2^15) ≈ 0.00009A
+		f_Current[typec_num] = read_data[0] * 0.00009;  
 	}
 	else
 	{
 		printk("sgm832 typec%d i2c_write_read Current Register ERR\n", typec_num);
 	}
-	printk("Current data: 0x%04x\n", read_data[0]);
-	printk("Current: %.3f mA\n", f_Current[typec_num]);
-
+	//printk("Current: %.3f mA\n", f_Current[typec_num]);
+/*
 	//05H Calibration Register
     ret = i2c_write_read(i2c_dev, sgm832_typec_slaver_addr, &write_cmd[5], 1, read_data, 2);
 	if (ret != 0)
@@ -202,7 +203,7 @@ static void sgm832_typec_get_data(const struct device *i2c_dev, uint16_t sgm832_
 	}
 
 	read_data[0] = ((read_data[0]  & 0xFF00) >> 8) + ((read_data[0] & 0x00FF) << 8);
-	printk("Calibration: 0x%04x\n", read_data[0]);
+	//printk("Calibration: 0x%04x\n", read_data[0]);
 
 	//06H Mask/Enable Register
     ret = i2c_write_read(i2c_dev, sgm832_typec_slaver_addr, &write_cmd[6], 1, read_data, 2);
@@ -243,7 +244,7 @@ static void sgm832_typec_get_data(const struct device *i2c_dev, uint16_t sgm832_
 
 	read_data[0] = ((read_data[0]  & 0xFF00) >> 8) + ((read_data[0] & 0x00FF) << 8);
 	//printk("Die_ID: 0x%04x\n", read_data[0]);		
-
+*/
 #endif	
 }
 #if 0
@@ -305,7 +306,16 @@ static void sgm832_typec1_get_shuntvoltage(const struct device *i2c_dev)
 #endif	
 }
 #endif
-
+/*
+*  sgm832_typec_calibration
+*  @i2c_dev: i2c device, sgm832 typec i2c device,
+*  @sgm832_typec_slaver_addr: sgm832 typec i2c slaver address,
+*  @typec_num: typec number, 0 or 1
+*  @return: none
+*  @description: Set sgm832 calibration register, CAL=0.00512/(Current_LSB*Rshunt), Current_LSB=Max_Expected_Current/(2^15),
+*  				 Max_Expected_Current = 3A, Rshunt = 0.028Ω, Current_LSB=3A/(2^15) ≈ 0.00009A,
+*  				 CAL=0.00512/(0.00009A*0.028Ω) ≈ 2000 = 0x07D0, so CAL = 0x07D0
+*/
 static void sgm832_typec_calibration(const struct device *i2c_dev, uint16_t sgm832_typec_slaver_addr, uint8_t typec_num)
 {
     //static uint8_t configurate_write_data[3] = {CONFIGURATION_REGISTER, 0x47, 0x6F};

Some files were not shown because too many files changed in this diff