Index: format/app.format
===================================================================
--- /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/format/app.format	(revision 5613)
+++ /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/format/app.format	(working copy)
@@ -65,10 +65,19 @@
 
 
 //adc
+0 mem_reference_inter1p8v_2v_adc_io_data
+0 mem_inter1v_adc_ft_data
 2 mem_3v_adc_io_data
+0 mem_reference_inter1p8v_2p6v_adc_vdcdc_data
+0 mem_inter1p2v_adc_ft_data
 2 mem_2v_adc_hvin_data
+0 mem_reference_inter1p8v_1v_adc_io_data
+0 mem_io1v_adc_ft_data
 2 mem_1v_adc_io_data
+0 mem_reference_inter1p8v_4p6v_adc_vdcdc_data
+0 mem_io2v_adc_ft_data
 2 mem_3v_adc_hvin_data
+0 mem_adc_ratio
 2 mem_reference_voltage
 1 mem_adc_config_flag
 1 mem_adc_channel
@@ -208,7 +217,7 @@
 5 OTP_OFFSET_SCHED_BISTFIX 	//2 byte
 7 OTP_OFFSET_XRAM_BISTFIX	//2 byte
 9 OTP_OFFSET_PATCH_BISTFIX	//2 byte
-
+0xfc0 OTP_OFFSET_ADC_PARAM_L_C0
 0xfd0 OTP_OFFSET_ADC_PARAM_L
 0xff0 OTP_OFFSET_UCODE_KEY_L
 0x1000 OTP_OFFSET_H
@@ -369,3 +378,8 @@
 0x0e ADC_CH_GPIO13
 )
 
+//mem_adc_reference_mode
+(
+1 SADC_REFERENCE_INTER3V
+2 SADC_REFERENCE_INTER1P8V_DIV2
+)
Index: format/app_shutter_dy.format
===================================================================
--- /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/format/app_shutter_dy.format	(revision 5613)
+++ /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/format/app_shutter_dy.format	(working copy)
@@ -186,10 +186,10 @@
 8 mem_shutter_reconn_or_discovery_blink_time_conf
 8 mem_ble_shutter_dy_interval_min_ios
 
-10 mem_fouse_up_press
+8 mem_fouse_up_press
 2 mem_fouse_up_long_press
 2 mem_fouse_up_long_release
-10 mem_fouse_down_press
+8 mem_fouse_down_press
 2 mem_fouse_down_long_press
 2 mem_fouse_down_long_release
 1 mem_shutter_key_evt_timer_count
@@ -198,7 +198,7 @@
 1 mem_shutter_fouse_select
 1 mem_shutter_dy_fouse_count
 5 mem_shutter_mode_step_android
-6 mem_shutter_mode_step_ios
+5 mem_shutter_mode_step_ios
 1 mem_shutter_photo_time
 1 mem_shutter_photo_click_count
 1 mem_shutter_photo_double_time
@@ -208,6 +208,22 @@
 2 mem_shutter_android_set_hid_map
 2 mem_shutter_android_Usage
 
+//adc
+//adc struct
+0 mem_shutter_vdd_calculate_set
+2 mem_shutter_vdd_full_vol
+2 mem_shutter_vdd_empty_vol
+2 mem_shutter_vdd_low_vol
+2 mem_shutter_vdd_now_vol
+
+1 mem_shutter_start_adc_flag
+1 mem_shutter_adc_read_timer
+1 mem_shutter_enable_low_voltage_flag
+1 mem_shutter_adc_last_low_voltage_flag
+
+1 mem_shutter_battery_level_percentage
+1 mem_shutter_adc_read_time_init
+
 0 mem_shutter_dy_end
 )
 
Index: format/bt.format
===================================================================
--- /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/format/bt.format	(revision 5613)
+++ /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/format/bt.format	(working copy)
@@ -209,8 +209,17 @@
 1 mem_system_clk
 
 ifdef DEBUG_RF_INIT
-18 mem_rf_init_data
+5 mem_rf_init_data
 endif
+
+0 mem_adc_reference3v_ft_data
+2 mem_adc_reference3v_gpio1v_ft_data
+2 mem_adc_reference3v_gpio2v_ft_data
+2 mem_adc_reference3v_vdcdc3p6v_ft_data
+2 mem_adc_reference3v_vdcdc4p6v_ft_data
+2 mem_adc_reference3v_inter1v_ft_data
+2 mem_adc_reference3v_inter1v_now_data
+1 mem_adc_reference_mode
 1 mem_otp_charge_pump_x
 1 mem_otp_dpll_ibais_x
 
Index: output/otp.dat
===================================================================
--- /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/output/otp.dat	(revision 5613)
+++ /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/output/otp.dat	(working copy)
@@ -11,96 +11,104 @@
 00
 aa
 55
-f6
-0f
+16
+12
 c2
 84
 00
-17
+19
 c0
 00
 00
-50
+52
 c0
 01
 01
-24
+26
 c0
 08
 81
-2d
+2f
 c0
 0a
 03
-26
+12
 c0
 0a
 81
-ba
+bc
 c0
 0c
 01
-c8
+ca
 c0
 0c
 81
-87
+89
 c0
 0d
 01
-3f
+41
 c0
 12
 83
-48
+34
 c0
 13
 80
-7b
+7d
 c0
 51
 80
-c3
+c5
 c0
 52
 81
-01
+03
 c0
 53
 00
-86
+88
 c0
 53
 80
-99
+9b
 c0
 55
 00
-eb
+ed
 c0
 55
 83
-f2
+de
 c0
 58
 81
-da
+dc
 c0
 62
 00
-1e
+20
 c0
 62
 81
-cf
+d1
 c0
 6d
 02
-f7
+fb
+c0
+6d
+84
+2c
 c0
 6e
-03
-07
+04
+69
+c0
+6e
+84
+4a
 20
 20
 23
@@ -108,23 +116,23 @@
 c0
 12
 00
-54
+56
 c0
 12
 80
-d4
+d6
 c0
 13
 00
-d9
+db
 c0
 1c
 83
-42
+2e
 c0
 26
 83
-46
+32
 c1
 7f
 80
@@ -168,7 +176,7 @@
 20
 20
 80
-48
+4a
 6f
 f0
 80
@@ -288,11 +296,11 @@
 20
 20
 80
-24
+26
 c5
 11
 00
-48
+4a
 79
 20
 00
@@ -300,7 +308,7 @@
 20
 20
 00
-25
+27
 6f
 f1
 00
@@ -324,11 +332,11 @@
 24
 20
 80
-24
+26
 c2
 00
 00
-21
+23
 20
 20
 6b
@@ -356,7 +364,7 @@
 c5
 97
 80
-5a
+5c
 78
 3c
 fc
@@ -400,7 +408,7 @@
 20
 37
 00
-63
+65
 1b
 42
 04
@@ -448,7 +456,7 @@
 20
 40
 00
-71
+73
 6f
 e0
 81
@@ -568,30 +576,30 @@
 c0
 03
 00
-8f
+91
 c0
 03
 80
-93
+95
 c0
 04
 00
-97
+99
 c0
 04
 80
-98
+9a
 20
 20
 65
 a2
 70
 4f
-d9
+d5
 01
 70
 4f
-da
+d6
 01
 da
 60
@@ -603,16 +611,16 @@
 71
 70
 4f
-d9
+d5
 01
 70
 4f
-da
+d6
 02
 da
 60
 4f
-c6
+c4
 20
 20
 63
@@ -640,7 +648,7 @@
 20
 40
 00
-9f
+a1
 20
 74
 00
@@ -688,7 +696,7 @@
 20
 22
 80
-ab
+ad
 18
 e0
 8e
@@ -696,7 +704,7 @@
 20
 20
 00
-a0
+a2
 67
 e1
 4a
@@ -744,11 +752,11 @@
 20
 22
 80
-b8
+ba
 20
 20
 00
-b7
+b9
 70
 4e
 c0
@@ -800,7 +808,7 @@
 24
 3a
 00
-cd
+cf
 70
 4c
 00
@@ -812,7 +820,7 @@
 20
 40
 00
-d0
+d2
 20
 40
 65
@@ -844,7 +852,7 @@
 20
 20
 00
-c5
+c7
 df
 e0
 00
@@ -972,7 +980,7 @@
 c0
 00
 80
-f1
+f3
 20
 20
 66
@@ -988,7 +996,7 @@
 c0
 03
 00
-f5
+f7
 20
 60
 00
@@ -996,7 +1004,7 @@
 20
 20
 00
-f6
+f8
 70
 4e
 aa
@@ -1016,11 +1024,11 @@
 20
 20
 00
-fb
+fd
 6f
 e1
 4f
-f0
+eb
 67
 e1
 48
@@ -1028,7 +1036,7 @@
 6f
 e1
 4f
-ee
+e9
 67
 e1
 49
@@ -1096,7 +1104,7 @@
 24
 3a
 01
-10
+12
 20
 20
 65
@@ -1120,11 +1128,11 @@
 c0
 03
 01
-19
+1b
 c0
 03
 81
-1d
+1f
 da
 60
 4a
@@ -1140,15 +1148,15 @@
 20
 40
 01
-21
+23
 20
 40
 03
-bc
+a8
 da
 60
 4f
-c4
+c2
 20
 20
 63
@@ -1156,26 +1164,26 @@
 20
 40
 01
-21
+23
 20
 40
 03
-df
+cb
 da
 60
 4f
-d2
+ce
 20
 20
 63
 71
 70
 4f
-d9
+d5
 00
 70
 4f
-da
+d6
 00
 20
 60
@@ -1216,7 +1224,7 @@
 20
 20
 01
-24
+26
 70
 8a
 0f
@@ -1336,7 +1344,7 @@
 20
 40
 01
-8f
+91
 6f
 e0
 c4
@@ -1348,7 +1356,7 @@
 24
 55
 81
-3b
+3d
 37
 d9
 82
@@ -1364,7 +1372,7 @@
 c0
 08
 01
-7c
+7e
 6f
 e0
 c4
@@ -1408,7 +1416,7 @@
 20
 40
 01
-6e
+70
 70
 80
 43
@@ -1432,15 +1440,15 @@
 20
 40
 02
-c9
+cd
 20
 40
 02
-f4
+f8
 20
 40
 01
-68
+6a
 70
 41
 48
@@ -1452,7 +1460,7 @@
 20
 20
 02
-f6
+fa
 20
 75
 80
@@ -1484,7 +1492,7 @@
 c0
 0c
 01
-74
+76
 6f
 e0
 c4
@@ -1576,7 +1584,7 @@
 20
 20
 01
-5a
+5c
 6f
 e0
 c1
@@ -1584,7 +1592,7 @@
 c0
 05
 01
-8a
+8c
 20
 20
 22
@@ -1612,7 +1620,7 @@
 20
 35
 81
-b6
+b8
 6f
 e2
 02
@@ -1780,7 +1788,7 @@
 20
 20
 01
-a0
+a2
 20
 40
 68
@@ -1919,8 +1927,12 @@
 00
 20
 40
+03
+e9
+20
+40
 01
-d2
+d4
 20
 40
 64
@@ -1940,7 +1952,7 @@
 58
 00
 02
-56
+5a
 67
 e1
 43
@@ -1948,7 +1960,7 @@
 58
 00
 02
-33
+37
 67
 e1
 43
@@ -1956,7 +1968,7 @@
 58
 00
 02
-48
+4c
 67
 e1
 43
@@ -1972,7 +1984,7 @@
 58
 00
 01
-fb
+fe
 67
 e1
 43
@@ -1988,7 +2000,7 @@
 58
 00
 02
-10
+13
 67
 e1
 43
@@ -2052,7 +2064,7 @@
 20
 40
 02
-00
+03
 20
 40
 70
@@ -2096,7 +2108,7 @@
 20
 22
 82
-0b
+0e
 1f
 e2
 04
@@ -2104,7 +2116,7 @@
 20
 40
 02
-0e
+11
 1a
 20
 a2
@@ -2112,7 +2124,7 @@
 c2
 00
 02
-05
+08
 20
 60
 00
@@ -2127,12 +2139,16 @@
 dd
 20
 40
+03
+f1
+20
+40
 02
-2b
+2f
 20
 40
 02
-1d
+21
 20
 40
 67
@@ -2144,7 +2160,7 @@
 20
 40
 02
-16
+1a
 20
 20
 64
@@ -2156,7 +2172,7 @@
 da
 40
 02
-19
+1d
 20
 20
 42
@@ -2180,39 +2196,39 @@
 da
 60
 4f
-e7
+e2
 da
 40
 02
-20
+24
 20
 20
 42
 e0
 70
 4f
-e9
+e4
 00
 6f
 e0
 cf
-e8
+e3
 c0
 00
 82
-25
+29
 c0
 01
 02
-27
+2b
 20
 20
 02
-30
+34
 20
 40
 02
-30
+34
 20
 20
 67
@@ -2220,10 +2236,10 @@
 20
 40
 02
-30
+34
 70
 4f
-e9
+e4
 04
 da
 60
@@ -2236,11 +2252,11 @@
 da
 60
 4f
-e9
+e4
 da
 40
 02
-2e
+32
 20
 20
 42
@@ -2255,11 +2271,11 @@
 71
 70
 4f
-e8
+e3
 00
 70
 4f
-e7
+e2
 00
 20
 60
@@ -2272,19 +2288,19 @@
 c0
 20
 02
-3f
+43
 c0
 18
 82
-3d
+41
 c0
 0a
 82
-3a
+3e
 c0
 0a
 02
-39
+3d
 20
 20
 64
@@ -2336,7 +2352,7 @@
 24
 3a
 02
-53
+57
 6f
 e4
 4f
@@ -2356,7 +2372,7 @@
 c0
 12
 02
-4b
+4f
 20
 60
 00
@@ -2380,7 +2396,7 @@
 24
 3a
 02
-53
+57
 6f
 e4
 4f
@@ -2408,7 +2424,7 @@
 20
 40
 02
-61
+65
 d8
 e0
 00
@@ -2444,11 +2460,11 @@
 20
 40
 02
-7b
+7f
 20
 20
 03
-71
+5d
 6f
 e1
 44
@@ -2456,7 +2472,7 @@
 c2
 84
 82
-66
+6a
 d8
 a0
 45
@@ -2504,7 +2520,7 @@
 24
 21
 02
-72
+76
 6f
 e0
 c9
@@ -2616,7 +2632,7 @@
 20
 40
 02
-98
+9c
 6f
 e1
 06
@@ -2664,7 +2680,7 @@
 c2
 00
 02
-84
+88
 20
 60
 00
@@ -2708,7 +2724,7 @@
 20
 20
 02
-a2
+a6
 1a
 60
 8c
@@ -2720,7 +2736,7 @@
 20
 20
 02
-a5
+a9
 20
 40
 65
@@ -2736,7 +2752,7 @@
 20
 40
 02
-c1
+c5
 18
 e2
 7e
@@ -2744,19 +2760,19 @@
 c0
 03
 02
-af
+b3
 c0
 03
 82
-b2
+b6
 c0
 04
 02
-b5
+b9
 c0
 04
 82
-bc
+c0
 20
 20
 65
@@ -2780,7 +2796,7 @@
 da
 60
 4f
-c6
+c4
 20
 20
 63
@@ -2788,7 +2804,7 @@
 20
 40
 02
-b7
+bb
 20
 20
 63
@@ -2796,7 +2812,7 @@
 da
 60
 4f
-dc
+d8
 20
 40
 67
@@ -2808,7 +2824,7 @@
 da
 60
 4f
-e1
+dd
 20
 60
 00
@@ -2816,7 +2832,7 @@
 6f
 e0
 cf
-e8
+e3
 1f
 e0
 fe
@@ -2824,10 +2840,10 @@
 67
 e0
 cf
-e8
+e3
 70
 4f
-e7
+e2
 04
 20
 60
@@ -2916,7 +2932,7 @@
 20
 40
 02
-e6
+ea
 2a
 2f
 fe
@@ -2948,7 +2964,7 @@
 20
 40
 02
-e6
+ea
 d8
 a0
 8a
@@ -2976,7 +2992,7 @@
 20
 21
 02
-db
+df
 20
 20
 21
@@ -3080,7 +3096,7 @@
 20
 40
 03
-1f
+0b
 70
 8a
 08
@@ -3113,102 +3129,6 @@
 60
 00
 00
-20
-40
-03
-15
-6f
-f0
-8a
-09
-79
-3f
-fe
-07
-67
-f0
-8a
-09
-70
-8a
-07
-77
-70
-8a
-08
-c1
-70
-8a
-0b
-01
-20
-40
-6f
-90
-6f
-e0
-c4
-09
-67
-f0
-80
-cd
-20
-00
-0b
-b8
-20
-40
-03
-1f
-70
-80
-cd
-00
-20
-20
-6f
-a1
-6f
-f0
-80
-cc
-79
-20
-7e
-01
-67
-f0
-80
-cc
-6a
-40
-c4
-19
-6f
-e0
-c4
-33
-67
-e0
-c4
-19
-df
-20
-00
-08
-20
-40
-6f
-67
-62
-40
-c4
-19
-20
-60
-00
-00
 70
 80
 cc
@@ -3220,7 +3140,7 @@
 c3
 02
 83
-20
+0c
 68
 59
 01
@@ -3256,7 +3176,7 @@
 c0
 08
 03
-3f
+2b
 58
 00
 57
@@ -3300,7 +3220,7 @@
 c0
 08
 03
-3c
+28
 58
 00
 2b
@@ -3336,7 +3256,7 @@
 20
 20
 03
-38
+24
 58
 00
 83
@@ -3348,7 +3268,7 @@
 20
 20
 03
-2d
+19
 6f
 e0
 c3
@@ -3396,7 +3316,7 @@
 20
 40
 03
-59
+45
 6f
 e0
 c0
@@ -3508,7 +3428,7 @@
 20
 22
 83
-6c
+58
 e7
 e0
 80
@@ -3528,7 +3448,7 @@
 c2
 00
 03
-66
+52
 1a
 42
 04
@@ -3544,7 +3464,7 @@
 68
 4a
 4f
-d5
+d1
 1c
 42
 24
@@ -3568,7 +3488,7 @@
 24
 3a
 03
-93
+7f
 1a
 42
 7e
@@ -3584,7 +3504,7 @@
 24
 21
 03
-85
+71
 1a
 20
 a2
@@ -3596,7 +3516,7 @@
 24
 3a
 03
-77
+63
 da
 20
 00
@@ -3604,7 +3524,7 @@
 20
 40
 03
-8c
+78
 1c
 42
 7e
@@ -3612,7 +3532,7 @@
 67
 e2
 4f
-d5
+d1
 20
 60
 00
@@ -3624,7 +3544,7 @@
 24
 3a
 03
-96
+82
 1a
 22
 7e
@@ -3644,15 +3564,15 @@
 60
 4a
 4f
-d5
+d1
 67
 e0
 cf
-d4
+d0
 6f
 e0
 cf
-d4
+d0
 20
 7a
 00
@@ -3664,15 +3584,15 @@
 67
 e0
 cf
-d4
+d0
 20
 40
 03
-9a
+86
 20
 20
 03
-8d
+79
 1a
 42
 7e
@@ -3684,7 +3604,7 @@
 20
 20
 03
-7b
+67
 1a
 22
 7e
@@ -3700,15 +3620,15 @@
 20
 20
 03
-8a
+76
 da
 60
 4f
-d9
+d5
 da
 40
 03
-9d
+89
 20
 20
 42
@@ -3716,15 +3636,15 @@
 6f
 e0
 cf
-da
+d6
 c0
 00
 83
-a1
+8d
 c0
 01
 03
-c4
+b0
 20
 60
 00
@@ -3736,19 +3656,19 @@
 24
 3a
 03
-b0
+9c
 70
 49
 e5
 01
 70
 4f
-d9
+d5
 01
 6f
 e0
 cf
-db
+d7
 1f
 e0
 fe
@@ -3756,7 +3676,7 @@
 67
 e0
 cf
-db
+d7
 1f
 e6
 7c
@@ -3764,15 +3684,15 @@
 20
 42
 83
-bc
+a8
 da
 60
 4f
-c2
+c0
 20
 40
 03
-e7
+d3
 ef
 e1
 00
@@ -3792,11 +3712,11 @@
 20
 40
 03
-ef
+db
 6f
 e0
 cf
-db
+d7
 1f
 e0
 fe
@@ -3804,7 +3724,7 @@
 67
 e0
 cf
-db
+d7
 1f
 e6
 7c
@@ -3812,15 +3732,15 @@
 20
 42
 83
-bc
+a8
 da
 60
 4f
-c2
+c0
 20
 40
 03
-e7
+d3
 ef
 e1
 00
@@ -3839,12 +3759,12 @@
 71
 70
 4f
-db
+d7
 00
 da
 60
 4f
-c4
+c2
 20
 40
 63
@@ -3852,11 +3772,11 @@
 da
 60
 4f
-c2
+c0
 20
 40
 03
-e7
+d3
 58
 00
 06
@@ -3876,19 +3796,19 @@
 24
 3a
 03
-d3
+bf
 70
 49
 e5
 01
 70
 4f
-d9
+d5
 01
 6f
 e0
 cf
-db
+d7
 1f
 e0
 fe
@@ -3896,7 +3816,7 @@
 67
 e0
 cf
-db
+d7
 1f
 e6
 7c
@@ -3904,15 +3824,15 @@
 20
 42
 83
-df
+cb
 da
 60
 4f
-d0
+cc
 20
 40
 03
-e7
+d3
 ef
 e1
 00
@@ -3932,11 +3852,11 @@
 20
 40
 03
-ef
+db
 6f
 e0
 cf
-db
+d7
 1f
 e0
 fe
@@ -3944,7 +3864,7 @@
 67
 e0
 cf
-db
+d7
 1f
 e6
 7c
@@ -3952,15 +3872,15 @@
 20
 42
 83
-df
+cb
 da
 60
 4f
-d0
+cc
 20
 40
 03
-e7
+d3
 ef
 e1
 00
@@ -3972,133 +3892,757 @@
 e7
 e1
 00
-11
+11
+20
+20
+63
+71
+70
+4f
+d7
+00
+da
+60
+4f
+ce
+20
+40
+63
+71
+da
+60
+4f
+cc
+20
+40
+03
+d3
+58
+00
+0a
+00
+e7
+e1
+00
+11
+20
+60
+00
+00
+d8
+40
+4c
+02
+ef
+e0
+80
+13
+1f
+e0
+ff
+ff
+1f
+ef
+fe
+0d
+98
+40
+fe
+00
+1f
+e0
+fe
+06
+1f
+e2
+22
+00
+20
+60
+00
+00
+70
+49
+e5
+01
+70
+4f
+d5
+01
+20
+60
+00
+00
+70
+4e
+aa
+05
+70
+49
+e4
+01
+70
+4e
+b2
+01
+70
+49
+e5
+3c
+20
+20
+03
+e3
+6f
+e1
+4f
+e7
+67
+e1
+48
+d6
+6f
+e1
+4f
+e5
+67
+e1
+49
+02
+67
+e1
+49
+4c
+20
+60
+00
+00
+70
+4f
+f5
+01
+20
+60
+00
+00
+6f
+e0
+cf
+f6
+1f
+e0
+fe
+01
+67
+e0
+cf
+f6
+68
+48
+cf
+fa
+98
+46
+7c
+00
+20
+60
+00
+00
+6f
+e0
+cf
+f5
+20
+7a
+00
+00
+20
+40
+03
+eb
+24
+61
+00
+00
+70
+4f
+f6
+00
+70
+44
+07
+01
+20
+40
+6f
+f3
+20
+40
+6f
+eb
+20
+40
+04
+69
+20
+40
+04
+4a
+67
+e1
+4f
+f3
+da
+20
+4f
+ed
+20
+40
+04
+03
+6f
+e0
+c4
+0c
+c2
+80
+84
+23
+c3
+00
+04
+27
+70
+4f
+f8
+01
+20
+20
+04
+25
+ef
+e4
+00
+11
+67
+e4
+06
+70
+20
+40
+6f
+f3
+20
+40
+6f
+eb
+6f
+e1
+06
+76
+68
+49
+06
+72
+98
+46
+7c
+00
+24
+41
+6f
+ef
+68
+49
+06
+74
+98
+46
+7c
+00
+24
+41
+6f
+e7
+6f
+e1
+06
+76
+68
+49
+06
+70
+98
+46
+7c
+00
+20
+21
+04
+1f
+68
+49
+06
+72
+98
+46
+7e
+00
+24
+21
+04
+21
+20
+3a
+04
+21
+1f
+ef
+a2
+64
+6f
+e1
+06
+70
+68
+49
+06
+72
+98
+46
+04
+00
+1a
+22
+7e
+00
+98
+46
+fc
+00
+20
+40
+7d
+5f
+67
+e0
+cf
+f9
+20
+60
+00
+00
+70
+4f
+f9
+64
+20
+60
+00
+00
+70
+4f
+f9
+00
+20
+60
+00
+00
+20
+40
+43
+25
+20
+20
+43
+27
+70
+4f
+f7
+01
+20
+60
+00
+00
+70
+4f
+f7
+00
+6f
+e0
+cf
+f8
+20
+7a
+00
+00
+70
+4f
+f8
+00
+20
+60
+00
+00
+6f
+e4
+01
+fd
+20
+3a
+6f
+79
+67
+e4
+43
+fd
+20
+40
+6b
+3a
+20
+40
+6a
+ad
+df
+e0
+0f
+c0
+9a
+40
+a4
+00
+df
+20
+00
+0a
+da
+20
+01
+fd
+20
+40
+6b
+74
+20
+40
+6b
+37
+6f
+e4
+01
+fd
+20
+7a
+00
+00
+67
+e4
+41
+4e
+ef
+e1
+00
+06
+e7
+e1
+00
+05
+20
+60
+00
+00
+6f
+f0
+80
+cc
+79
+20
+7e
+01
+67
+f0
+80
+cc
+6a
+40
+c4
+19
+6f
+e0
+c4
+33
+67
+e0
+c4
+19
+df
+20
+00
+08
+20
+40
+6f
+67
+62
+40
+c4
+19
+6f
+f0
+8a
+0a
+79
+3f
+fe
+04
+67
+f0
+8a
+0a
+20
+60
+00
+00
+6f
+e0
+c4
+07
+c0
+00
+84
+4e
+c0
+01
+04
+55
+20
+60
+00
+00
+58
+00
+03
+e8
+67
+e1
+44
+05
+68
+49
+41
+52
+6f
+e1
+41
+54
+da
+60
+0e
+10
+20
+40
+6f
+c0
+20
+20
+04
+5b
+58
+00
+03
+e8
+67
+e1
+44
+05
+68
+49
+41
+4e
+6f
+e1
+41
+50
+da
+60
+03
+e8
+20
+40
+6f
+c0
+68
+49
+41
+56
+98
+4f
+fe
+00
+68
+49
+41
+58
+98
+46
+fc
+00
 20
 20
-63
-71
+7d
+5f
+20
+40
+04
+3d
+6f
+f0
+8a
+09
+79
+3f
+fe
+07
+67
+f0
+8a
+09
 70
-4f
-db
+8a
+07
+77
+70
+8a
+08
+c1
+70
+8a
+0d
+61
+70
+8a
+0b
 00
-da
-60
-4f
-d2
 20
-40
-63
-71
-da
 60
-4f
-d0
-20
-40
-03
-e7
-58
-00
-0a
 00
-e7
-e1
 00
-11
 20
+40
+04
 60
-00
-00
-d8
+20
 40
-4c
-02
-ef
+6f
+90
+6f
 e0
+c4
+09
+67
+f0
 80
-13
-1f
-e0
-ff
-ff
-1f
-ef
-fe
-0d
-98
+cd
+20
 40
-fe
-00
-1f
-e0
-fe
-06
-1f
-e2
-22
+6f
+97
+70
+8a
+0d
+60
+70
+80
+cd
 00
 20
+40
+04
 60
+6f
+e0
+c4
+09
+67
+f0
+80
+cd
+70
+8a
+0b
+50
+70
+8a
+0e
+c0
+df
 00
 00
+0b
+6d
+e1
+44
+0a
 70
-49
-e5
-01
-70
-4f
-d9
-01
+80
+cc
+03
 20
+40
+04
+82
+68
+59
+01
+64
 60
+49
+41
+58
+20
+40
+6f
+9c
+df
 00
 00
+0b
+65
+e1
+44
+0a
 70
-4e
-aa
-05
-70
-49
-e4
-01
+8a
+0d
+60
 70
-4e
-b2
-01
+80
+cd
+00
 70
-49
-e5
-3c
-20
+80
+cc
+00
 20
-03
-f7
-6f
-e1
-4f
-ec
-67
-e1
-48
-d6
+60
+00
+00
 6f
-e1
-4f
-ea
-67
-e1
-49
+f0
+81
+29
+c3
 02
-67
-e1
-49
-4c
+84
+82
 20
 60
 00
 00
-e2
-20
+95
+34
 aa
 55
 40
@@ -4132,7 +4676,7 @@
 30
 00
 00
-14
+3c
 00
 00
 00
@@ -4313,6 +4857,25 @@
 17
 aa
 55
+01
+00
+fa
+4f
+05
+aa
+55
+06
+00
+ed
+4f
+e4
+0c
+c8
+0b
+2f
+0c
+aa
+55
 0b
 00
 e3
@@ -4651,21 +5214,21 @@
 55
 01
 00
-c2
+c0
 4f
 27
 aa
 55
 01
 00
-c4
+c2
 4f
 28
 aa
 55
 07
 00
-c6
+c4
 4f
 22
 21
@@ -4678,21 +5241,21 @@
 55
 01
 00
-d0
+cc
 4f
 29
 aa
 55
 01
 00
-d2
+ce
 4f
 2a
 aa
 55
 0a
 00
-dc
+d8
 4f
 02
 01
@@ -5870,7 +6433,7 @@
 55
 08
 00
-ea
+e5
 4f
 09
 38
@@ -6305,7 +6868,7 @@
 aa
 aa
 55
-98
-7f
-72
-8e
+36
+86
+f3
+f4
Index: output/ramcode.rom
===================================================================
--- /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/output/ramcode.rom	(revision 5613)
+++ /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/output/ramcode.rom	(working copy)
@@ -1,31 +1,33 @@
-c2840017
-c0000050
-c0010124
-c008812d
-c00a0326
-c00a81ba
-c00c01c8
-c00c8187
-c00d013f
-c0128348
-c013807b
-c05180c3
-c0528101
-c0530086
-c0538099
-c05500eb
-c05583f2
-c05881da
-c062001e
-c06281cf
-c06d02f7
-c06e0307
+c2840019
+c0000052
+c0010126
+c008812f
+c00a0312
+c00a81bc
+c00c01ca
+c00c8189
+c00d0141
+c0128334
+c013807d
+c05180c5
+c0528103
+c0530088
+c053809b
+c05500ed
+c05583de
+c05881dc
+c0620020
+c06281d1
+c06d02fb
+c06d842c
+c06e0469
+c06e844a
 2020235a
-c0120054
-c01280d4
-c01300d9
-c01c8342
-c0268346
+c0120056
+c01280d6
+c01300db
+c01c832e
+c0268332
 c17f8000
 2020235a
 20406b34
@@ -36,7 +38,7 @@
 18000e00
 793f8022
 a84c0000
-20208048
+2020804a
 6ff08046
 79207e06
 79207e07
@@ -66,24 +68,24 @@
 70804782
 20000001
 afec0000
-20208024
-c5110048
+20208026
+c511004a
 79200022
-20200025
+20200027
 6ff10044
 1fe0fe01
 67f10044
 18e08e01
 28e01e08
-24208024
-c2000021
+24208026
+c2000023
 20206b38
 2435a002
 37d98200
 37d98200
 20202002
 204025c2
-c597805a
+c597805c
 783cfc00
 2000001e
 204025c2
@@ -94,7 +96,7 @@
 78507c00
 19623600
 37c18400
-20370063
+20370065
 1b420400
 604b000f
 242c26fa
@@ -106,7 +108,7 @@
 984fb600
 20406877
 20372677
-20400071
+20400073
 6fe08168
 c301a677
 2055a477
@@ -136,25 +138,25 @@
 c000e777
 c002e765
 c0006761
-c003008f
-c0038093
-c0040097
-c0048098
+c0030091
+c0038095
+c0040099
+c004809a
 202065a2
-704fd901
-704fda01
+704fd501
+704fd601
 da604fb8
 20206371
-704fd901
-704fda02
-da604fc6
+704fd501
+704fd602
+da604fc4
 20206371
 20600000
 20600000
 6fe0cec7
 c000e5cf
 20406628
-2040009f
+204000a1
 20740000
 202065cf
 d8e00000
@@ -166,9 +168,9 @@
 207a0000
 684906f1
 9842fc00
-202280ab
+202280ad
 18e08e01
-202000a0
+202000a2
 67e14acf
 20404323
 da604ad1
@@ -180,8 +182,8 @@
 207a0000
 684906f1
 18467c00
-202280b8
-202000b7
+202280ba
+202000b9
 704ec001
 20404325
 da604b0d
@@ -194,10 +196,10 @@
 d8a045fd
 20207ca1
 6fe0cf9f
-243a00cd
+243a00cf
 704c0001
 20404323
-204000d0
+204000d2
 20406561
 20216500
 18e27e00
@@ -205,7 +207,7 @@
 20600000
 18e27e00
 c1808000
-202000c5
+202000c7
 dfe0000a
 98effe00
 da6045fd
@@ -237,21 +239,21 @@
 efe18006
 67e1c397
 c003e704
-c00080f1
+c00080f3
 202066db
 18c08dfe
 efe08006
-c00300f5
+c00300f7
 20600000
-202000f6
+202000f8
 704eaa01
 7049e400
 704eb200
 7049e50a
-202000fb
-6fe14ff0
+202000fd
+6fe14feb
 67e148d6
-6fe14fee
+6fe14fe9
 67e14902
 67e1494c
 20600000
@@ -268,27 +270,27 @@
 24417806
 1a608c09
 efe08006
-243a0110
+243a0112
 20206547
 704ec001
 2040656b
 20406769
 18e27e00
-c0030119
-c003811d
+c003011b
+c003811f
 da604aae
 dfe00003
 2020655a
-20400121
-204003bc
-da604fc4
+20400123
+204003a8
+da604fc2
 20206371
-20400121
-204003df
-da604fd2
+20400123
+204003cb
+da604fce
 20206371
-704fd900
-704fda00
+704fd500
+704fd600
 20600000
 20407552
 20407448
@@ -298,7 +300,7 @@
 20402018
 2040310f
 2040248c
-20200124
+20200126
 708a0f60
 708a10aa
 708a127a
@@ -328,14 +330,14 @@
 708a844a
 708a8540
 708a16fe
-2040018f
+20400191
 6fe0c436
 205a70d7
-2455813b
+2455813d
 37d98200
 70813b5f
 6fe0c099
-c008017c
+c008017e
 6fe0c438
 1fe1fe04
 67f08a02
@@ -346,18 +348,18 @@
 67f18a73
 708a8660
 708a8b3b
-2040016e
+20400170
 70804300
 70804205
 58557474
 67f18968
 7089606e
-204002c9
-204002f4
-20400168
+204002cd
+204002f8
+2040016a
 7041480c
 20406f4e
-202002f6
+202002fa
 20758000
 37d98200
 6fe0c11c
@@ -365,7 +367,7 @@
 37d98200
 20600000
 6fe0c099
-c00c0174
+c00c0176
 6fe0c438
 1fe1fe06
 67f08a02
@@ -388,16 +390,16 @@
 67f18a73
 708a762a
 70890204
-2020015a
+2020015c
 6fe0c141
-c005018a
+c005018c
 2020220e
 708a1425
 58a93f3f
 67f18a60
 708a631f
 20600000
-203581b6
+203581b8
 6fe2020d
 207a0000
 37d98200
@@ -439,7 +441,7 @@
 6fe1415b
 207a0000
 67e1020f
-202001a0
+202001a2
 2040686f
 204021ba
 18002a08
@@ -474,24 +476,25 @@
 20207cda
 20407396
 20758000
-204001d2
+204003e9
+204001d4
 20406459
 58000001
 67e144f6
 7040a60a
-58000256
+5800025a
 67e143db
-58000233
+58000237
 67e143dd
-58000248
+5800024c
 67e143df
 580062d3
 67e143d3
-580001fb
+580001fe
 67e143d5
 58006329
 67e143d7
-58000210
+58000213
 67e143e3
 58006505
 67e14524
@@ -507,7 +510,7 @@
 202062bd
 20406f35
 7044ecff
-20400200
+20400203
 2040701b
 2020739a
 6fe0c6ce
@@ -518,54 +521,55 @@
 efe08011
 6848c6cf
 98467c00
-2022820b
+2022820e
 1fe20400
-2040020e
+20400211
 1a20a201
-c2000205
+c2000208
 20600000
 79200407
 20206edd
-2040022b
-2040021d
+204003f1
+2040022f
+20400221
 2040676c
 2040675a
-20400216
+2040021a
 202064d9
 da604518
-da400219
+da40021d
 202042e7
 70451c02
 20404325
 2040634e
 2020639e
-da604fe7
-da400220
+da604fe2
+da400224
 202042e0
-704fe900
-6fe0cfe8
-c0008225
-c0010227
-20200230
-20400230
+704fe400
+6fe0cfe3
+c0008229
+c001022b
+20200234
+20400234
 20206740
-20400230
-704fe904
+20400234
+704fe404
 da604a5d
 20206371
-da604fe9
-da40022e
+da604fe4
+da400232
 202042e0
 da604bea
 20206371
-704fe800
-704fe700
+704fe300
+704fe200
 20600000
 1a627e00
-c020023f
-c018823d
-c00a823a
-c00a0239
+c0200243
+c0188241
+c00a823e
+c00a023d
 202064e0
 202064f4
 6fe14512
@@ -578,25 +582,25 @@
 6fe4450a
 207a0000
 20406730
-243a0253
+243a0257
 6fe44f02
 67e442d3
 20202e93
 6fe14398
-c012024b
+c012024f
 20600000
 204078ad
 7044f101
 20406730
 2040432b
-243a0253
+243a0257
 6fe44f02
 67e442d3
 20202e93
 6fe44fb0
 67e442d3
 20202e93
-20400261
+20400265
 d8e00009
 20407cef
 247a0000
@@ -605,10 +609,10 @@
 20407ce1
 78547c00
 2040701b
-2040027b
-20200371
+2040027f
+2020035d
 6fe144e9
-c2848266
+c284826a
 d8a045da
 df200023
 20207ca1
@@ -620,7 +624,7 @@
 1c427e00
 98460400
 20628000
-24210272
+24210276
 6fe0c9e5
 98467c00
 20610000
@@ -648,7 +652,7 @@
 67e1068c
 18e27e00
 67e1067a
-20400298
+2040029c
 6fe1068c
 1fe22600
 6fe1067a
@@ -660,7 +664,7 @@
 1fe0a60a
 6fe10678
 1fe27200
-c2000284
+c2000288
 20600000
 1a60a405
 efe20012
@@ -671,37 +675,37 @@
 24417806
 580003e8
 98467c00
-202002a2
+202002a6
 1a608c04
 efe08006
-202002a5
+202002a9
 2040656b
 20406561
 20216500
-204002c1
+204002c5
 18e27e00
-c00302af
-c00382b2
-c00402b5
-c00482bc
+c00302b3
+c00382b6
+c00402b9
+c00482c0
 20206558
 7049e55a
 da604fb8
 20206371
 7049e55a
-da604fc6
+da604fc4
 20206371
-204002b7
+204002bb
 20206371
-da604fdc
+da604fd8
 20406730
 207a0000
-da604fe1
+da604fdd
 20600000
-6fe0cfe8
+6fe0cfe3
 1fe0fe01
-67e0cfe8
-704fe704
+67e0cfe3
+704fe204
 20600000
 da604a30
 7049e50a
@@ -723,7 +727,7 @@
 708ac200
 708ac300
 d8e00006
-204002e6
+204002ea
 2a2ffe0d
 2040211d
 2a4ffe0d
@@ -731,14 +735,14 @@
 d8e00005
 2040211c
 2040211e
-204002e6
+204002ea
 d8a08ac2
 1a31fe00
 20402117
 1a51fe00
 20402117
 18e08fff
-202102db
+202102df
 2020214f
 2000003c
 58000f00
@@ -764,7 +768,7 @@
 6fe0c409
 67f080cd
 20000bb8
-2040031f
+2040030b
 708a08c1
 6a40c419
 df200008
@@ -773,33 +777,9 @@
 67e0c433
 6240c419
 20600000
-20400315
-6ff08a09
-793ffe07
-67f08a09
-708a0777
-708a08c1
-708a0b01
-20406f90
-6fe0c409
-67f080cd
-20000bb8
-2040031f
-7080cd00
-20206fa1
-6ff080cc
-79207e01
-67f080cc
-6a40c419
-6fe0c433
-67e0c419
-df200008
-20406f67
-6240c419
-20600000
 7080cc03
 6ff08129
-c3028320
+c302830c
 68590164
 6049440a
 7080cc00
@@ -808,7 +788,7 @@
 708a8d12
 708a8e0a
 6fe0c099
-c008033f
+c008032b
 58005762
 67f10907
 70890103
@@ -819,7 +799,7 @@
 708a8d44
 708a8e0a
 6fe0c099
-c008033c
+c0080328
 58002bb1
 67f10907
 c6978000
@@ -828,10 +808,10 @@
 20600000
 58004189
 67f10907
-20200338
+20200324
 58008312
 67f10907
-2020032d
+20200319
 6fe0c334
 c1000000
 c001b04a
@@ -843,7 +823,7 @@
 6fe240ad
 9840fe00
 67e240ad
-20400359
+20400345
 6fe0c0cb
 79207e04
 204023e1
@@ -871,129 +851,129 @@
 efe08011
 e8408013
 98467c00
-2022836c
+20228358
 e7e08013
 37d98200
 1a20a201
 1a60a601
-c2000366
+c2000352
 1a420400
 20600000
 da200000
-684a4fd5
+684a4fd1
 1c422400
 1a427e00
 98467c00
 24417806
 20406730
-243a0393
+243a037f
 1a427e00
 18408440
 98467c00
-24210385
+24210371
 1a20a201
 1a217e0f
-243a0377
+243a0363
 da200000
-2040038c
+20400378
 1c427e00
-67e24fd5
+67e24fd1
 20600000
 20406730
-243a0396
+243a0382
 1a227e00
 207a0000
 184085c0
 793f841c
-604a4fd5
-67e0cfd4
-6fe0cfd4
+604a4fd1
+67e0cfd0
+6fe0cfd0
 207a0000
 1fe0ffff
-67e0cfd4
-2040039a
-2020038d
+67e0cfd0
+20400386
+20200379
 1a427e00
 184084a0
-2020037b
+20200367
 1a227e00
 207a0000
 18408560
-2020038a
-da604fd9
-da40039d
+20200376
+da604fd5
+da400389
 202042e0
-6fe0cfda
-c00083a1
-c00103c4
+6fe0cfd6
+c000838d
+c00103b0
 20600000
 20406730
-243a03b0
+243a039c
 7049e501
-704fd901
-6fe0cfdb
+704fd501
+6fe0cfd7
 1fe0fe01
-67e0cfdb
+67e0cfd7
 1fe67c5a
-204283bc
-da604fc2
-204003e7
+204283a8
+da604fc0
+204003d3
 efe1003f
 1fe0fe08
 e7e10011
 20206371
-204003ef
-6fe0cfdb
+204003db
+6fe0cfd7
 1fe0fe01
-67e0cfdb
+67e0cfd7
 1fe67c5a
-204283bc
-da604fc2
-204003e7
+204283a8
+da604fc0
+204003d3
 efe1003f
 1fe0fe12
 e7e10011
 20206371
-704fdb00
-da604fc4
-20406371
+704fd700
 da604fc2
-204003e7
+20406371
+da604fc0
+204003d3
 58000650
 e7e10011
 20600000
 20406730
-243a03d3
+243a03bf
 7049e501
-704fd901
-6fe0cfdb
+704fd501
+6fe0cfd7
 1fe0fe01
-67e0cfdb
+67e0cfd7
 1fe67c5a
-204283df
-da604fd0
-204003e7
+204283cb
+da604fcc
+204003d3
 efe1003f
 1fe0fff8
 e7e10011
 20206371
-204003ef
-6fe0cfdb
+204003db
+6fe0cfd7
 1fe0fe01
-67e0cfdb
+67e0cfd7
 1fe67c5a
-204283df
-da604fd0
-204003e7
+204283cb
+da604fcc
+204003d3
 efe1003f
 1fe0ffee
 e7e10011
 20206371
-704fdb00
-da604fd2
+704fd700
+da604fce
 20406371
-da604fd0
-204003e7
+da604fcc
+204003d3
 58000a00
 e7e10011
 20600000
@@ -1006,16 +986,172 @@
 1fe22200
 20600000
 7049e501
-704fd901
+704fd501
 20600000
 704eaa05
 7049e401
 704eb201
 7049e53c
-202003f7
-6fe14fec
+202003e3
+6fe14fe7
 67e148d6
-6fe14fea
+6fe14fe5
 67e14902
 67e1494c
 20600000
+704ff501
+20600000
+6fe0cff6
+1fe0fe01
+67e0cff6
+6848cffa
+98467c00
+20600000
+6fe0cff5
+207a0000
+204003eb
+24610000
+704ff600
+70440701
+20406ff3
+20406feb
+20400469
+2040044a
+67e14ff3
+da204fed
+20400403
+6fe0c40c
+c2808423
+c3000427
+704ff801
+20200425
+efe40011
+67e40670
+20406ff3
+20406feb
+6fe10676
+68490672
+98467c00
+24416fef
+68490674
+98467c00
+24416fe7
+6fe10676
+68490670
+98467c00
+2021041f
+68490672
+98467e00
+24210421
+203a0421
+1fefa264
+6fe10670
+68490672
+98460400
+1a227e00
+9846fc00
+20407d5f
+67e0cff9
+20600000
+704ff964
+20600000
+704ff900
+20600000
+20404325
+20204327
+704ff701
+20600000
+704ff700
+6fe0cff8
+207a0000
+704ff800
+20600000
+6fe401fd
+203a6f79
+67e443fd
+20406b3a
+20406aad
+dfe00fc0
+9a40a400
+df20000a
+da2001fd
+20406b74
+20406b37
+6fe401fd
+207a0000
+67e4414e
+efe10006
+e7e10005
+20600000
+6ff080cc
+79207e01
+67f080cc
+6a40c419
+6fe0c433
+67e0c419
+df200008
+20406f67
+6240c419
+6ff08a0a
+793ffe04
+67f08a0a
+20600000
+6fe0c407
+c000844e
+c0010455
+20600000
+580003e8
+67e14405
+68494152
+6fe14154
+da600e10
+20406fc0
+2020045b
+580003e8
+67e14405
+6849414e
+6fe14150
+da6003e8
+20406fc0
+68494156
+984ffe00
+68494158
+9846fc00
+20207d5f
+2040043d
+6ff08a09
+793ffe07
+67f08a09
+708a0777
+708a08c1
+708a0d61
+708a0b00
+20600000
+20400460
+20406f90
+6fe0c409
+67f080cd
+20406f97
+708a0d60
+7080cd00
+20400460
+6fe0c409
+67f080cd
+708a0b50
+708a0ec0
+df00000b
+6de1440a
+7080cc03
+20400482
+68590164
+60494158
+20406f9c
+df00000b
+65e1440a
+708a0d60
+7080cd00
+7080cc00
+20600000
+6ff08129
+c3028482
+20600000
Index: output/sched.rom
===================================================================
--- /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/output/sched.rom	(revision 5613)
+++ /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/output/sched.rom	(working copy)
@@ -26,7 +26,7 @@
 30   #mem_patch18
 00   #mem_patch19
 00   #mem_patch1a
-14   #mem_patch1b
+3c   #mem_patch1b
 00   #mem_patch1c
 00   #mem_patch1d
 00   #mem_patch1e
@@ -128,6 +128,11 @@
 70 17 #sleep_timeout
 70 17 #sleep_timer
 
+mem_shutter_adc_read_time_init:05
+mem_shutter_vdd_calculate_set:
+e4 0c	#mem_shutter_vdd_full_vol 3.3v*1000
+c8 0b	#mem_shutter_vdd_empty_vol 3.0V
+2f 0c	#mem_shutter_vdd_low_vol 3.1V
 
 #key config
 mem_shutter_key_num_conf:0a
Index: program/patch.prog
===================================================================
--- /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/program/patch.prog	(revision 5613)
+++ /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/program/patch.prog	(working copy)
@@ -1,6 +1,9 @@
 
 //define AUTO_TEST
-
+define ADC_1121SB
+ifdef ADC_1121SB
+//define ADC_1121SB_1V8_MODE
+endif
 	bbit1 8,pf_patch_ext
 	beq patch00_0,p_soft_reset
 	beq patch00_2,p_main_loop
@@ -22,7 +25,11 @@
 	beq patch18_4,p_otp_write
 	beq patch18_5,p_otp_read_data
 	beq patch1b_2,p_sadc_calibration
+ifdef ADC_1121SB
+	beq patch1b_3,p_adc_init_data
 	beq patch1b_4,p_enable_adc
+	beq patch1b_5,p_vdd_calculate_by_mode
+endif
 	branch assert
 
 pf_patch_ext:
@@ -607,7 +614,9 @@
 p_shutter_dy_init:
 	call enable_authrom
 	rtn wake
-	
+ifdef ADC_1121SB
+	call p_shutter_adc_config_init
+endif	
 	call p_shutter_dy_key_conf
 
 	call shutter_dy_adv_conf
@@ -686,6 +695,9 @@
 	branch gpio_config_input
 
 p_shutter_dy_le_bb_event_timer:
+ifdef ADC_1121SB
+	call p_shutter_adc_read_timer
+endif
 	call p_shutter_photo_double_timer
 	call p_shutter_photo_event_timer
 	call shutter_dy_link_key_loop_timer
@@ -1009,34 +1021,6 @@
 	storer regb,1,mem_spi_write_addr
 	rtn
 
-p_enable_adc:
-	call p_sadc_cal_write
-	fetch 1,core_gpadc_cfg1
-	set0 7,pdata
-	store 1,core_gpadc_cfg1
-	jam 0x77,core_gpadc_ctrl
-	jam 0xc1,core_gpadc_cfg0
-	jam 0x01,core_gpadc_cfg3
-	call sadc_channel
-	fetch 1,mem_adc_clkdiv
-	store 1,core_sadc_clkdiv
-	nop 3000
-	call p_sadc_read
-	jam 0,core_sadc_clkdiv
-	branch sadc_dma
-
-p_sadc_cal_write:
-	fetch 1,core_sadc_ctrl
-	set1 1,pdata
-	store 1,core_sadc_ctrl
-	fetchr regb,1,mem_spi_write_addr
-	fetch 1,mem_adc_cal_c7
-	store 1,mem_spi_write_addr
-	arg 8,loopcnt	//rg_gpadc_sar_dat_sel c0-c7
-	call sadc_cal_write+4
-	storer regb,1,mem_spi_write_addr
-	rtn
-
 p_sadc_read:
 	jam 0x03,core_sadc_ctrl
 p_sadc_read_wait:
@@ -1322,4 +1306,354 @@
 	fetch 2,mem_shutter_ios_set_hid_map
 	store 2,mem_shutter_le_hid_map+84
 	store 2,mem_shutter_le_hid_map+158
-	rtn
\ No newline at end of file
+	rtn
+
+/////////////////////////////////////////////// adc ////////////////////////////////////////
+ifdef ADC_1121SB
+p_shutter_adc_config_init:
+	jam 1,mem_shutter_start_adc_flag
+	rtn
+
+p_shutter_adc_read_interval:
+	fetch 1,mem_shutter_adc_read_timer
+	increase 1,pdata
+	store 1,mem_shutter_adc_read_timer
+	fetcht 1,mem_shutter_adc_read_time_init	//1s read adc
+	isub temp,null
+	rtn
+
+p_shutter_adc_read_timer:
+p_shutter_adc_read_start:
+	fetch 1,mem_shutter_start_adc_flag
+	rtn blank
+	call p_shutter_adc_read_interval
+p_shutter_adc_read_start_next:
+	nrtn positive
+	jam 0,mem_shutter_adc_read_timer
+	jam ADC_CONFIG_HVIN,mem_adc_config_flag
+	call adc_clear_no_power_flag
+	call adc_clear_low_power_flag
+	call p_enable_adc
+	call p_vdd_calculate_by_mode
+	store 2,mem_shutter_vdd_now_vol
+p_shutter_adc_data_process:
+	arg mem_shutter_vdd_calculate_set,rega
+	call p_shutter_bat_percent_lowpower_out
+	fetch 1,mem_adc_power_flag
+	bbit1 1,p_shutter_low_voltage_power_down
+	bbit0 0,p_shutter_adc_no_low_voltage
+	jam 1,mem_shutter_adc_last_low_voltage_flag
+	branch p_shutter_adc_low_voltage
+
+p_shutter_bat_percent_lowpower_out:
+	ifetch 8,rega
+	store 8,mem_pdatatemp
+p_shutter_bat_percent_lowpower_out_battery:
+	call adc_clear_no_power_flag
+	call adc_clear_low_power_flag
+	fetch 2,mem_pdatatemp+6
+	fetcht 2,mem_pdatatemp+2	        //shutdown voltage
+	isub temp,null
+	ncall adc_set_no_power_flag,positive
+
+	fetcht 2,mem_pdatatemp+4		//low voltage
+	isub temp,null
+	ncall adc_set_low_power_flag,positive
+p_shutter_adc_bat_level_set:
+	fetch 2,mem_pdatatemp+6		//now voltage
+	fetcht 2,mem_pdatatemp		//full voltage
+	isub temp,null
+	branch p_shutter_adc_bat_level_100_percent,positive		// now >= full
+	fetcht 2,mem_pdatatemp+2	        //shutdown voltage
+	isub temp,pdata
+	nbranch p_shutter_adc_bat_level_0_percent,positive		// now < shutdown
+	branch p_shutter_adc_bat_level_0_percent,blank			// now = shutdown
+	mul32 pdata,100,rega								// (now - shutdown)*100 /(full - shutdown)
+	fetch 2,mem_pdatatemp
+	fetcht 2,mem_pdatatemp+2
+	isub temp,temp
+	copy rega,pdata
+	idiv temp
+	call get_div_result
+	store 1,mem_shutter_battery_level_percentage
+	rtn
+
+p_shutter_adc_bat_level_100_percent:
+	jam 100,mem_shutter_battery_level_percentage
+	rtn
+p_shutter_adc_bat_level_0_percent:
+	jam 0,mem_shutter_battery_level_percentage
+	rtn
+
+p_shutter_low_voltage_power_down:	//shutterdown
+	call app_led_off
+	branch app_enter_hibernate
+
+p_shutter_adc_low_voltage:
+	jam 1,mem_shutter_enable_low_voltage_flag
+	rtn
+
+p_shutter_adc_no_low_voltage:
+	jam 0,mem_shutter_enable_low_voltage_flag
+	fetch 1,mem_shutter_adc_last_low_voltage_flag
+	rtn blank
+	// call app_led_off
+	jam 0,mem_shutter_adc_last_low_voltage_flag
+	rtn
+endif
+
+ifdef ADC_1121SB
+
+p_adc_init_data:
+	fetch 8,mem_otp_adc
+	branch adc_init_cal_data_default,blank
+	store 8,mem_reference_inter1p8v_2v_adc_io_data
+	call enable_otp_read
+	call loadcode_check_otp_lock
+	arg OTP_OFFSET_ADC_PARAM_L_C0,pdata
+	iadd regb,regb
+	arg 10,loopcnt
+	arg mem_otp_temp,rega
+	call otp_read_data
+	call disable_otp
+	fetch 8, mem_otp_temp
+	rtn blank
+	store 8,mem_adc_reference3v_gpio1v_ft_data
+	ifetch 2,contr
+	istore 2,contw
+	//call  eut_test_data_init
+	rtn
+
+p_sadc_cal_write:
+	fetch 1,core_sadc_ctrl
+	set1 1,pdata
+	store 1,core_sadc_ctrl
+	fetchr regb,1,mem_spi_write_addr
+	fetch 1,mem_adc_cal_c7
+	store 1,mem_spi_write_addr
+	arg 8,loopcnt	//rg_gpadc_sar_dat_sel c0-c7
+	call sadc_cal_write+4
+	storer regb,1,mem_spi_write_addr
+	fetch 1,core_gpadc_cfg2
+	set0 4,pdata//caliberation write disable
+	store 1,core_gpadc_cfg2
+	rtn
+
+
+
+p_vdd_calculate_by_mode:
+ifdef  ADC_1121SB_1V8_MODE
+	fetch 1,mem_adc_reference_mode
+	beq SADC_REFERENCE_INTER3V,p_vdd_reference_inter3V_calculate
+	beq SADC_REFERENCE_INTER1P8V_DIV2,p_vdd_reference_inter1p8V_calculate
+	branch p_vdd_reference_inter3V_calculate
+endif
+
+p_vdd_reference_inter3V_calculate:
+	fetch 1,mem_adc_config_flag
+	beq ADC_CONFIG_HVIN,p_vdd_reference_inter3V_calculate_by_mode_vdcdc
+	beq ADC_CONFIG_GPIO,p_vdd_reference_inter3V_calculate_by_mode_gpio
+	rtn
+
+p_vdd_reference_inter3V_calculate_by_mode_vdcdc:
+	setarg 1000
+	store 2,mem_reference_voltage
+	fetcht 2,mem_adc_reference3v_vdcdc3p6v_ft_data
+	fetch 2,mem_adc_reference3v_vdcdc4p6v_ft_data
+	arg 3600,regc
+	call vdd_calculate
+	branch p_mul1V_div1V_to_cal
+
+p_vdd_reference_inter3V_calculate_by_mode_gpio:
+	setarg 1000
+	store 2,mem_reference_voltage
+	fetcht 2,mem_adc_reference3v_gpio1v_ft_data
+	fetch 2,mem_adc_reference3v_gpio2v_ft_data
+	arg 1000,regc
+	call vdd_calculate
+p_mul1V_div1V_to_cal:
+	fetcht 2,mem_adc_reference3v_inter1v_ft_data
+	imul32 temp,pdata
+	fetcht 2,mem_adc_reference3v_inter1v_now_data
+	idiv temp
+	branch get_div_result
+
+p_enable_adc_init_config:
+	call p_sadc_cal_write
+	fetch 1,core_gpadc_cfg1
+	set0 7,pdata
+	store 1,core_gpadc_cfg1
+	jam 0x77,core_gpadc_ctrl
+	jam 0xc1,core_gpadc_cfg0
+	jam 0x61,core_vtest_ctrl0
+	jam 0x00,core_gpadc_cfg3
+	rtn
+
+p_enable_adc:
+ifdef  ADC_1121SB_1V8_MODE
+	fetch 1,mem_adc_reference_mode
+	beq SADC_REFERENCE_INTER3V,p_enable_adc_reference_source_inter3V
+	beq SADC_REFERENCE_INTER1P8V_DIV2,p_enable_adc_reference_source_inter1p8V
+	branch p_enable_adc_reference_source_inter3V
+endif
+
+p_enable_adc_reference_source_inter3V:
+	call p_enable_adc_init_config
+	call sadc_channel
+	fetch 1,mem_adc_clkdiv
+	store 1,core_sadc_clkdiv
+	call sadc_read
+	jam 0x60,core_vtest_ctrl0
+	jam 0x00,core_sadc_clkdiv
+//	rtn
+
+p_read_adc_inter1V:
+	call p_enable_adc_init_config
+	fetch 1,mem_adc_clkdiv
+	store 1,core_sadc_clkdiv
+	jam 0x50,core_gpadc_cfg3
+	jam 0xc0,core_vtest_ctrl1//select vref1v
+
+	arg 0xb,regext_index
+	fetchr regext, 2,mem_adc_current_value
+
+	jam 0x03,core_sadc_ctrl
+	call p_sar_adc_read_wait
+	fetcht 2,core_sadc_data
+	storet 2,mem_adc_reference3v_inter1v_now_data
+	call sadc_read_wait+4
+
+	arg 0xb,regext_index
+	storer regext,2,mem_adc_current_value
+
+	jam 0x60,core_vtest_ctrl0
+	jam 0x00,core_sadc_clkdiv
+	jam 0x00,core_sadc_ctrl
+	rtn
+
+p_sar_adc_read_wait:
+	fetch 1,core_perf_status
+	bbit0 SARADC_DONE,p_sar_adc_read_wait
+	rtn
+
+ifdef  ADC_1121SB_1V8_MODE
+p_vdd_reference_inter1p8V_calculate:
+	fetch 1,mem_adc_config_flag
+	beq ADC_CONFIG_HVIN,p_vdd_reference_inter1p8V_calculate_by_mode_vdcdc
+	beq ADC_CONFIG_GPIO,p_vdd_reference_inter1p8V_div2_calculate_by_mode_gpio
+	rtn
+
+p_vdd_reference_inter1p8V_calculate_by_mode_vdcdc:
+	setarg 2000
+	store 2,mem_reference_voltage
+	fetcht 2,mem_reference_inter1p8v_2p6v_adc_vdcdc_data
+	fetch 2,mem_reference_inter1p8v_4p6v_adc_vdcdc_data
+	arg 2600,regc
+	branch vdd_calculate
+
+p_vdd_reference_inter1p8V_div2_calculate_by_mode_gpio:
+	setarg 1000
+	store 2,mem_reference_voltage
+	fetcht 2,mem_reference_inter1p8v_2v_adc_io_data
+	fetch 2,mem_reference_inter1p8v_1v_adc_io_data
+	arg 2000,regc
+	branch p_vdd_calculate00
+
+p_vdd_calculate00:
+	isub temp,rega
+	fetch 2,mem_adc_current_value
+	isub temp,pdata
+	nbranch p_vdd_calculate11,positive
+	fetcht 2,mem_reference_voltage
+	imul32 temp,regb
+	copy regc,pdata
+	imul32 rega,pdata
+	isub regb,pdata
+	nbranch set_pdata_0,positive
+	branch vdd_calculate2
+
+p_vdd_calculate11:
+	copy temp,pdata
+	fetcht 2,mem_adc_current_value
+	isub temp,pdata
+	fetcht 2,mem_reference_voltage
+	imul32 temp,regb
+	copy regc,pdata
+	imul32 rega,pdata
+	iadd regb,pdata
+	branch vdd_calculate2
+
+
+p_enable_adc_reference_source_inter1p8V:
+	fetch 1,mem_adc_config_flag
+	beq ADC_CONFIG_HVIN,p_enable_adc_reference_source_inter1p8V_vdcdc
+p_enable_adc_reference_source_inter1p8V_div2_gpio:
+	call p_sadc_cal_write
+	fetch 1,core_gpadc_cfg1
+	set0 7,pdata
+	store 1,core_gpadc_cfg1
+	jam 0x77,core_gpadc_ctrl
+	jam 0x41,core_gpadc_cfg0
+	jam 0x14,0x8ac6			//div2
+	jam 0x00,core_gpadc_cfg3
+	call sadc_channel
+	fetch 1,mem_adc_clkdiv
+	store 1,core_sadc_clkdiv
+	call sadc_read
+
+	jam 0x00,core_sadc_clkdiv
+	jam 0x00,0x8ac6
+	rtn
+
+p_enable_adc_reference_source_inter1p8V_vdcdc:
+	call p_sadc_cal_write
+	fetch 1,core_gpadc_cfg1
+	set0 7,pdata
+	store 1,core_gpadc_cfg1
+	jam 0x77,core_gpadc_ctrl
+	jam 0x41,core_gpadc_cfg0
+	jam 0x10,0x8ac6			//not div2
+	jam 0x00,core_gpadc_cfg3
+	call sadc_channel
+	fetch 1,mem_adc_clkdiv
+	store 1,core_sadc_clkdiv
+	call  sadc_read
+
+	jam 0x00,core_sadc_clkdiv
+	jam 0x00,0x8ac6
+	rtn
+
+endif
+
+/*
+p_adc_set_gpio:
+	fetch 1,mem_adc_channel
+	call p_adc_channel_set_gpio
+	copy temp,pdata
+	set1 GPIO_ACTIVE_BIT,pdata
+	arg gpcfg_input,temp
+	branch gpio_config_function
+
+p_adc_channel_set_gpio:
+	arg 18,temp
+	rtneq 0x6
+	arg 10,temp
+	rtneq 0x7
+	arg 9,temp
+	rtneq 0x8
+	arg 12,temp
+	rtneq 0x9
+	arg 6,temp
+	rtneq 0xa
+	arg 20,temp
+	rtneq 0xb
+	arg 21,temp
+	rtneq 0xc
+	arg 22,temp
+	rtneq 0xd
+	arg 13,temp
+//	rtnne 0xe
+	rtn
+*/
+
+endif
Index: sched/shutter_dy.dat
===================================================================
--- /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/sched/shutter_dy.dat	(revision 5613)
+++ /1121s/branch/shutter/branch/dy/JXY/yc1089s_jxy_JM137_new/sched/shutter_dy.dat	(working copy)
@@ -61,6 +61,11 @@
 70 17 #sleep_timeout
 70 17 #sleep_timer
 
+mem_shutter_adc_read_time_init:05
+mem_shutter_vdd_calculate_set:
+e4 0c	#mem_shutter_vdd_full_vol 3.3v*1000
+c8 0b	#mem_shutter_vdd_empty_vol 3.0V
+2f 0c	#mem_shutter_vdd_low_vol 3.1V
 
 #key config
 mem_shutter_key_num_conf:0a
