📄 stm8_tsl_services.ls
字号:
1923 ; 796 pMCKeyStruct->Setting.b.DETECTED = 1;
1925 0493 be00 ldw x,_pMCKeyStruct
1926 0495 e602 ld a,(2,x)
1927 0497 aa04 or a,#4
1928 0499 e702 ld (2,x),a
1929 ; 797 pMCKeyStruct->Setting.b.CHANGED = 1;
1931 049b be00 ldw x,_pMCKeyStruct
1932 049d e602 ld a,(2,x)
1933 049f aa08 or a,#8
1934 04a1 e702 ld (2,x),a
1935 ; 798 pMCKeyStruct->Counter = DetectionTimeout;
1937 04a3 be00 ldw x,_pMCKeyStruct
1938 04a5 b600 ld a,_DetectionTimeout
1939 04a7 e703 ld (3,x),a
1940 ; 799 pMCKeyStruct->Channel[1].IntegratorCounter = pMCKeyStruct->DirectionChangeIntegrator;
1942 04a9 be00 ldw x,_pMCKeyStruct
1943 04ab e62e ld a,(46,x)
1944 04ad e711 ld (17,x),a
1945 ; 800 }
1948 04af 81 ret
1974 ; 813 void TSL_MCKey_SetPostDetectState(void)
1974 ; 814 {
1975 switch .text
1976 04b0 _TSL_MCKey_SetPostDetectState:
1980 ; 815 pMCKeyStruct->State.whole = POST_DETECTED_STATE;
1982 04b0 a624 ld a,#36
1983 04b2 92c700 ld [_pMCKeyStruct.w],a
1984 ; 816 pMCKeyStruct->Channel[0].IntegratorCounter = EndDetectionIntegrator;
1986 04b5 be00 ldw x,_pMCKeyStruct
1987 04b7 b600 ld a,_EndDetectionIntegrator
1988 04b9 e70a ld (10,x),a
1989 ; 817 }
1992 04bb 81 ret
2017 ; 830 void TSL_MCKey_BackToDetectedState(void)
2017 ; 831 {
2018 switch .text
2019 04bc _TSL_MCKey_BackToDetectedState:
2023 ; 832 pMCKeyStruct->State.whole = DETECTED_STATE;
2025 04bc a604 ld a,#4
2026 04be 92c700 ld [_pMCKeyStruct.w],a
2027 ; 833 }
2030 04c1 81 ret
2056 ; 846 void TSL_MCKey_SetPreRecalibrationState(void)
2056 ; 847 {
2057 switch .text
2058 04c2 _TSL_MCKey_SetPreRecalibrationState:
2062 ; 848 pMCKeyStruct->State.whole = PRE_CALIBRATION_STATE;
2064 04c2 a611 ld a,#17
2065 04c4 92c700 ld [_pMCKeyStruct.w],a
2066 ; 849 pMCKeyStruct->Channel[0].IntegratorCounter = RecalibrationIntegrator;
2068 04c7 be00 ldw x,_pMCKeyStruct
2069 04c9 b600 ld a,_RecalibrationIntegrator
2070 04cb e70a ld (10,x),a
2071 ; 850 }
2074 04cd 81 ret
2110 ; 863 void TSL_MCKey_SetCalibrationState(void)
2110 ; 864 {
2111 switch .text
2112 04ce _TSL_MCKey_SetCalibrationState:
2114 04ce 88 push a
2115 00000001 OFST: set 1
2118 ; 867 pMCKeyStruct->State.whole = CALIBRATION_STATE;
2120 04cf a601 ld a,#1
2121 04d1 92c700 ld [_pMCKeyStruct.w],a
2122 ; 868 pMCKeyStruct->Setting.b.DETECTED = 0;
2124 04d4 be00 ldw x,_pMCKeyStruct
2125 04d6 e602 ld a,(2,x)
2126 04d8 a4fb and a,#251
2127 04da e702 ld (2,x),a
2128 ; 869 pMCKeyStruct->Setting.b.CHANGED = 1;
2130 04dc be00 ldw x,_pMCKeyStruct
2131 04de e602 ld a,(2,x)
2132 04e0 aa08 or a,#8
2133 04e2 e702 ld (2,x),a
2134 ; 870 pMCKeyStruct->Setting.b.LOCKED = 0;
2136 04e4 be00 ldw x,_pMCKeyStruct
2137 04e6 e602 ld a,(2,x)
2138 04e8 a47f and a,#127
2139 04ea e702 ld (2,x),a
2140 ; 871 pMCKeyStruct->Counter = MCKEY_CALIBRATION_COUNT_DEFAULT;
2142 04ec be00 ldw x,_pMCKeyStruct
2143 04ee a608 ld a,#8
2144 04f0 e703 ld (3,x),a
2145 ; 872 for (Index = 0; Index < CHANNEL_PER_MCKEY; Index++)
2147 04f2 0f01 clr (OFST+0,sp)
2148 04f4 L366:
2149 ; 874 pMCKeyStruct->Channel[Index].Reference = 0;
2151 04f4 7b01 ld a,(OFST+0,sp)
2152 04f6 97 ld xl,a
2153 04f7 a607 ld a,#7
2154 04f9 42 mul x,a
2155 04fa 72bb0000 addw x,_pMCKeyStruct
2156 04fe 905f clrw y
2157 0500 ef08 ldw (8,x),y
2158 ; 872 for (Index = 0; Index < CHANNEL_PER_MCKEY; Index++)
2160 0502 0c01 inc (OFST+0,sp)
2163 0504 7b01 ld a,(OFST+0,sp)
2164 0506 a105 cp a,#5
2165 0508 25ea jrult L366
2166 ; 876 }
2169 050a 84 pop a
2170 050b 81 ret
2195 ; 889 void TSL_MCKey_SetErrorState(void)
2195 ; 890 {
2196 switch .text
2197 050c _TSL_MCKey_SetErrorState:
2201 ; 891 pMCKeyStruct->State.whole = ERROR_STATE;
2203 050c a608 ld a,#8
2204 050e 92c700 ld [_pMCKeyStruct.w],a
2205 ; 892 pMCKeyStruct->Setting.b.DETECTED = 0;
2207 0511 be00 ldw x,_pMCKeyStruct
2208 0513 e602 ld a,(2,x)
2209 0515 a4fb and a,#251
2210 0517 e702 ld (2,x),a
2211 ; 893 pMCKeyStruct->Setting.b.CHANGED = 1;
2213 0519 be00 ldw x,_pMCKeyStruct
2214 051b e602 ld a,(2,x)
2215 051d aa08 or a,#8
2216 051f e702 ld (2,x),a
2217 ; 894 pMCKeyStruct->Setting.b.LOCKED = 0;
2219 0521 be00 ldw x,_pMCKeyStruct
2220 0523 e602 ld a,(2,x)
2221 0525 a47f and a,#127
2222 0527 e702 ld (2,x),a
2223 ; 895 pMCKeyStruct->Setting.b.ERROR = 1;
2225 0529 be00 ldw x,_pMCKeyStruct
2226 052b e602 ld a,(2,x)
2227 052d aa20 or a,#32
2228 052f e702 ld (2,x),a
2229 ; 896 }
2232 0531 81 ret
2257 ; 909 void TSL_MCKey_SetDisabledState(void)
2257 ; 910 {
2258 switch .text
2259 0532 _TSL_MCKey_SetDisabledState:
2263 ; 911 pMCKeyStruct->State.whole = DISABLED_STATE;
2265 0532 a680 ld a,#128
2266 0534 92c700 ld [_pMCKeyStruct.w],a
2267 ; 912 pMCKeyStruct->Setting.b.DETECTED = 0;
2269 0537 be00 ldw x,_pMCKeyStruct
2270 0539 e602 ld a,(2,x)
2271 053b a4fb and a,#251
2272 053d e702 ld (2,x),a
2273 ; 913 pMCKeyStruct->Setting.b.CHANGED = 1;
2275 053f be00 ldw x,_pMCKeyStruct
2276 0541 e602 ld a,(2,x)
2277 0543 aa08 or a,#8
2278 0545 e702 ld (2,x),a
2279 ; 914 pMCKeyStruct->Setting.b.LOCKED = 0;
2281 0547 be00 ldw x,_pMCKeyStruct
2282 0549 e602 ld a,(2,x)
2283 054b a47f and a,#127
2284 054d e702 ld (2,x),a
2285 ; 915 }
2288 054f 81 ret
2333 ; 929 void TSL_MCKey_DxS(void)
2333 ; 930 {
2334 switch .text
2335 0550 _TSL_MCKey_DxS:
2337 0550 89 pushw x
2338 00000002 OFST: set 2
2341 ; 934 if (pMCKeyStruct->Setting.b.LOCKED)
2343 0551 be00 ldw x,_pMCKeyStruct
2344 0553 e602 ld a,(2,x)
2345 0555 a580 bcp a,#128
2346 0557 2624 jrne L421
2347 ; 935 return;
2349 ; 937 DxSGroupMask = pMCKeyStruct->DxSGroup;
2351 0559 be00 ldw x,_pMCKeyStruct
2352 055b e604 ld a,(4,x)
2353 055d 6b01 ld (OFST-1,sp),a
2354 ; 939 for (KeyToCheck = 0; KeyToCheck < NUMBER_OF_SINGLE_CHANNEL_KEYS; KeyToCheck++)
2356 055f 0f02 clr (OFST+0,sp)
2357 0561 L737:
2358 ; 942 if (sSCKeyInfo[KeyToCheck].DxSGroup & DxSGroupMask)
2360 0561 7b02 ld a,(OFST+0,sp)
2361 0563 97 ld xl,a
2362 0564 a60f ld a,#15
2363 0566 42 mul x,a
2364 0567 e604 ld a,(_sSCKeyInfo+4,x)
2365 0569 1501 bcp a,(OFST-1,sp)
2366 056b 2712 jreq L547
2367 ; 944 if (sSCKeyInfo[KeyToCheck].Setting.b.LOCKED)
2369 056d 7b02 ld a,(OFST+0,sp)
2370 056f 97 ld xl,a
2371 0570 a60f ld a,#15
2372 0572 42 mul x,a
2373 0573 e602 ld a,(_sSCKeyInfo+2,x)
2374 0575 a580 bcp a,#128
2375 0577 2706 jreq L547
2376 ; 946 goto ExitToIdle;
2377 ; 971 ExitToIdle: // The DxS is verified at PRE DETECT state only !
2377 ; 972 pMCKeyStruct->Channel[0].IntegratorCounter++; // Increment integrator to never allow DETECT state
2379 0579 be00 ldw x,_pMCKeyStruct
2380 057b 6c0a inc (10,x)
2381 ; 973 return;
2382 057d L421:
2385 057d 85 popw x
2386 057e 81 ret
2387 057f L547:
2388 ; 939 for (KeyToCheck = 0; KeyToCheck < NUMBER_OF_SINGLE_CHANNEL_KEYS; KeyToCheck++)
2390 057f 0c02 inc (OFST+0,sp)
2393 0581 7b02 ld a,(OFST+0,sp)
2394 0583 a102 cp a,#2
2395 0585 25da jrult L737
2396 ; 968 pMCKeyStruct->Setting.b.LOCKED = 1;
2398 0587 be00 ldw x,_pMCKeyStruct
2399 0589 e602 ld a,(2,x)
2400 058b aa80 or a,#128
2401 058d e702 ld (2,x),a
2402 ; 969 return;
2404 058f 20ec jra L421
2432 ; 987 void TSL_MCKey_DetectionTimeout(void)
2432 ; 988 {
2433 switch .text
2434 0591 _TSL_MCKey_DetectionTimeout:
2438 ; 989 if (Local_TickFlag.b.DTO_1sec)
2440 0591 b600 ld a,_Local_TickFlag
2441 0593 a501 bcp a,#1
2442 0595 2711 jreq L167
2443 ; 991 if (DetectionTimeout)
2445 0597 3d00 tnz _DetectionTimeout
2446 0599 270d jreq L167
2447 ; 993 pMCKeyStruct->Counter--;
2449 059b be00 ldw x,_pMCKeyStruct
2450 059d 6a03 dec (3,x)
2451 ; 994 if (!pMCKeyStruct->Counter)
2453 059f be00 ldw x,_pMCKeyStruct
2454 05a1 6d03 tnz (3,x)
2455 05a3 2603 jrne L167
2456 ; 996 TSL_MCKey_SetCalibrationState();
2458 05a5 cd04ce call _TSL_MCKey_SetCalibrationState
2460 05a8 L167:
2461 ; 1000 }
2464 05a8 81 ret
2489 xdef _TSL_MCKey_DetectionTimeout
2490 xdef _TSL_MCKey_DxS
2491 xdef _TSL_MCKey_SetDisabledState
2492 xdef _TSL_MCKey_SetErrorState
2493 xdef _TSL_MCKey_SetCalibrationState
2494 xdef _TSL_MCKey_SetPreRecalibrationState
2495 xdef _TSL_MCKey_BackToDetectedState
2496 xdef _TSL_MCKey_SetPostDetectState
2497 xdef _TSL_MCKey_SetDetectedState
2498 xdef _TSL_MCKey_SetPreDetectState
2499 xdef _TSL_MCKey_BackToIdleState
2500 xdef _TSL_MCKey_SetIdleState
2501 xdef _TSL_MCKey_DeltaCalculation
2502 xdef _TSL_MCKey_SetStructPointer
2503 xdef _TSL_MCKey_InitAcq
2504 xdef _TSL_SCKey_DetectionTimeout
2505 xdef _TSL_SCKey_DxS
2506 xdef _TSL_ECS
2507 xdef _TSL_SCKey_SetDisabledState
2508 xdef _TSL_SCKey_SetErrorState
2509 xdef _TSL_SCKey_SetCalibrationState
2510 xdef _TSL_SCKey_SetPreRecalibrationState
2511 xdef _TSL_SCKey_BackToDetectedState
2512 xdef _TSL_SCKey_SetPostDetectState
2513 xdef _TSL_SCKey_SetDetectedState
2514 xdef _TSL_SCKey_SetPreDetectState
2515 xdef _TSL_SCKey_BackToIdleState
2516 xdef _TSL_SCKey_SetIdleState
2517 xdef _TSL_DeltaCalculation
2518 xdef _TSL_SetStructPointer
2519 xdef _MCKEY1_DELTA_COEFF
2520 xref.b _ECSTempoPrescaler
2521 xref.b _ECSTempoCounter
2522 xref.b _ECSTimeStepCounter
2523 xref.b _Local_TickFlag
2524 xref.b _Local_TickECS10ms
2525 xref.b _Delta1
2526 xref.b _Delta
2527 xref.b _ChannelIndex
2528 xref.b _KeyIndex
2529 xref _Table_MCKEY_PORTS
2530 xref _Table_MCKEY_BITS
2531 xref.b _sMCKeyInfo
2532 xref.b _pMCKeyStruct
2533 xref.b _ECS_K_Slow
2534 xref.b _ECS_K_Fast
2535 xref.b _ECSTemporization
2536 xref.b _ECSTimeStep
2537 xref.b _RecalibrationIntegrator
2538 xref.b _EndDetectionIntegrator
2539 xref.b _DetectionIntegrator
2540 xref.b _DetectionTimeout
2541 xref.b _sSCKeyInfo
2542 xref.b _pKeyStruct
2543 xref.b _TSL_TickCount_ECS_10ms
2544 xref.b c_lreg
2545 xref.b c_x
2546 xref.b c_y
2565 xref c_lgadd
2566 xref c_lmul
2567 xref c_lgmul
2568 xref c_rtol
2569 xref c_ladc
2570 xref c_umul
2571 end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -