📄 stm8_tsl_services.ls
字号:
1 ; C Compiler for STM8 (COSMIC Software)
2 ; Parser V4.9.2 - 29 Jun 2010
3 ; Generator V4.3.5 - 02 Jul 2010
81 ; 53 void TSL_SetStructPointer(void)
81 ; 54 {
83 switch .text
84 0000 _TSL_SetStructPointer:
88 ; 55 pKeyStruct = &sSCKeyInfo[KeyIndex];
90 0000 b600 ld a,_KeyIndex
91 0002 97 ld xl,a
92 0003 a60f ld a,#15
93 0005 42 mul x,a
94 0006 01 rrwa x,a
95 0007 ab00 add a,#_sSCKeyInfo
96 0009 2401 jrnc L6
97 000b 5c incw x
98 000c L6:
99 000c 5f clrw x
100 000d 97 ld xl,a
101 000e bf00 ldw _pKeyStruct,x
102 ; 56 }
105 0010 81 ret
131 ; 69 void TSL_DeltaCalculation(void)
131 ; 70 {
132 switch .text
133 0011 _TSL_DeltaCalculation:
137 ; 83 Delta = (s16)(pKeyStruct->Channel.LastMeas - pKeyStruct->Channel.Reference);
139 0011 be00 ldw x,_pKeyStruct
140 0013 ee05 ldw x,(5,x)
141 0015 90be00 ldw y,_pKeyStruct
142 0018 90ee08 ldw y,(8,y)
143 001b 90bf00 ldw c_x,y
144 001e 72b00000 subw x,c_x
145 0022 bf00 ldw _Delta,x
146 ; 85 }
149 0024 81 ret
175 ; 99 void TSL_SCKey_SetIdleState(void)
175 ; 100 {
176 switch .text
177 0025 _TSL_SCKey_SetIdleState:
181 ; 101 pKeyStruct->Setting.b.CHANGED = 1;
183 0025 be00 ldw x,_pKeyStruct
184 0027 e602 ld a,(2,x)
185 0029 aa08 or a,#8
186 002b e702 ld (2,x),a
187 ; 102 TSL_SCKey_BackToIdleState();
189 002d ad01 call _TSL_SCKey_BackToIdleState
191 ; 103 }
194 002f 81 ret
219 ; 117 void TSL_SCKey_BackToIdleState(void)
219 ; 118 {
220 switch .text
221 0030 _TSL_SCKey_BackToIdleState:
225 ; 119 pKeyStruct->State.whole = IDLE_STATE;
227 0030 a602 ld a,#2
228 0032 92c700 ld [_pKeyStruct.w],a
229 ; 120 pKeyStruct->Setting.b.DETECTED = 0;
231 0035 be00 ldw x,_pKeyStruct
232 0037 e602 ld a,(2,x)
233 0039 a4fb and a,#251
234 003b e702 ld (2,x),a
235 ; 121 pKeyStruct->Setting.b.LOCKED = 0;
237 003d be00 ldw x,_pKeyStruct
238 003f e602 ld a,(2,x)
239 0041 a47f and a,#127
240 0043 e702 ld (2,x),a
241 ; 122 pKeyStruct->Setting.b.ERROR = 0;
243 0045 be00 ldw x,_pKeyStruct
244 0047 e602 ld a,(2,x)
245 0049 a4df and a,#223
246 004b e702 ld (2,x),a
247 ; 123 }
250 004d 81 ret
276 ; 137 void TSL_SCKey_SetPreDetectState(void)
276 ; 138 {
277 switch .text
278 004e _TSL_SCKey_SetPreDetectState:
282 ; 139 pKeyStruct->State.whole = PRE_DETECTED_STATE;
284 004e a614 ld a,#20
285 0050 92c700 ld [_pKeyStruct.w],a
286 ; 140 pKeyStruct->Channel.IntegratorCounter = DetectionIntegrator;
288 0053 be00 ldw x,_pKeyStruct
289 0055 b600 ld a,_DetectionIntegrator
290 0057 e70a ld (10,x),a
291 ; 141 }
294 0059 81 ret
320 ; 155 void TSL_SCKey_SetDetectedState(void)
320 ; 156 {
321 switch .text
322 005a _TSL_SCKey_SetDetectedState:
326 ; 157 pKeyStruct->State.whole = DETECTED_STATE;
328 005a a604 ld a,#4
329 005c 92c700 ld [_pKeyStruct.w],a
330 ; 158 pKeyStruct->Setting.b.DETECTED = 1;
332 005f be00 ldw x,_pKeyStruct
333 0061 e602 ld a,(2,x)
334 0063 aa04 or a,#4
335 0065 e702 ld (2,x),a
336 ; 159 pKeyStruct->Setting.b.CHANGED = 1;
338 0067 be00 ldw x,_pKeyStruct
339 0069 e602 ld a,(2,x)
340 006b aa08 or a,#8
341 006d e702 ld (2,x),a
342 ; 160 pKeyStruct->Counter = DetectionTimeout;
344 006f be00 ldw x,_pKeyStruct
345 0071 b600 ld a,_DetectionTimeout
346 0073 e703 ld (3,x),a
347 ; 161 }
350 0075 81 ret
376 ; 175 void TSL_SCKey_SetPostDetectState(void)
376 ; 176 {
377 switch .text
378 0076 _TSL_SCKey_SetPostDetectState:
382 ; 177 pKeyStruct->State.whole = POST_DETECTED_STATE;
384 0076 a624 ld a,#36
385 0078 92c700 ld [_pKeyStruct.w],a
386 ; 178 pKeyStruct->Channel.IntegratorCounter = EndDetectionIntegrator;
388 007b be00 ldw x,_pKeyStruct
389 007d b600 ld a,_EndDetectionIntegrator
390 007f e70a ld (10,x),a
391 ; 179 }
394 0081 81 ret
419 ; 193 void TSL_SCKey_BackToDetectedState(void)
419 ; 194 {
420 switch .text
421 0082 _TSL_SCKey_BackToDetectedState:
425 ; 195 pKeyStruct->State.whole = DETECTED_STATE;
427 0082 a604 ld a,#4
428 0084 92c700 ld [_pKeyStruct.w],a
429 ; 196 }
432 0087 81 ret
458 ; 210 void TSL_SCKey_SetPreRecalibrationState(void)
458 ; 211 {
459 switch .text
460 0088 _TSL_SCKey_SetPreRecalibrationState:
464 ; 212 pKeyStruct->State.whole = PRE_CALIBRATION_STATE;
466 0088 a611 ld a,#17
467 008a 92c700 ld [_pKeyStruct.w],a
468 ; 213 pKeyStruct->Channel.IntegratorCounter = RecalibrationIntegrator;
470 008d be00 ldw x,_pKeyStruct
471 008f b600 ld a,_RecalibrationIntegrator
472 0091 e70a ld (10,x),a
473 ; 214 }
476 0093 81 ret
501 ; 228 void TSL_SCKey_SetCalibrationState(void)
501 ; 229 {
502 switch .text
503 0094 _TSL_SCKey_SetCalibrationState:
507 ; 230 pKeyStruct->State.whole = CALIBRATION_STATE;
509 0094 a601 ld a,#1
510 0096 92c700 ld [_pKeyStruct.w],a
511 ; 231 pKeyStruct->Setting.b.DETECTED = 0;
513 0099 be00 ldw x,_pKeyStruct
514 009b e602 ld a,(2,x)
515 009d a4fb and a,#251
516 009f e702 ld (2,x),a
517 ; 232 pKeyStruct->Setting.b.CHANGED = 1;
519 00a1 be00 ldw x,_pKeyStruct
520 00a3 e602 ld a,(2,x)
521 00a5 aa08 or a,#8
522 00a7 e702 ld (2,x),a
523 ; 233 pKeyStruct->Setting.b.LOCKED = 0;
525 00a9 be00 ldw x,_pKeyStruct
526 00ab e602 ld a,(2,x)
527 00ad a47f and a,#127
528 00af e702 ld (2,x),a
529 ; 234 pKeyStruct->Setting.b.ERROR = 0;
531 00b1 be00 ldw x,_pKeyStruct
532 00b3 e602 ld a,(2,x)
533 00b5 a4df and a,#223
534 00b7 e702 ld (2,x),a
535 ; 235 pKeyStruct->Counter = SCKEY_CALIBRATION_COUNT_DEFAULT;
537 00b9 be00 ldw x,_pKeyStruct
538 00bb a608 ld a,#8
539 00bd e703 ld (3,x),a
540 ; 236 pKeyStruct->Channel.Reference = 0;
542 00bf be00 ldw x,_pKeyStruct
543 00c1 905f clrw y
544 00c3 ef08 ldw (8,x),y
545 ; 237 }
548 00c5 81 ret
573 ; 251 void TSL_SCKey_SetErrorState(void)
573 ; 252 {
574 switch .text
575 00c6 _TSL_SCKey_SetErrorState:
579 ; 253 pKeyStruct->State.whole = ERROR_STATE;
581 00c6 a608 ld a,#8
582 00c8 92c700 ld [_pKeyStruct.w],a
583 ; 254 pKeyStruct->Setting.b.DETECTED = 0;
585 00cb be00 ldw x,_pKeyStruct
586 00cd e602 ld a,(2,x)
587 00cf a4fb and a,#251
588 00d1 e702 ld (2,x),a
589 ; 255 pKeyStruct->Setting.b.CHANGED = 1;
591 00d3 be00 ldw x,_pKeyStruct
592 00d5 e602 ld a,(2,x)
593 00d7 aa08 or a,#8
594 00d9 e702 ld (2,x),a
595 ; 256 pKeyStruct->Setting.b.LOCKED = 0;
597 00db be00 ldw x,_pKeyStruct
598 00dd e602 ld a,(2,x)
599 00df a47f and a,#127
600 00e1 e702 ld (2,x),a
601 ; 257 pKeyStruct->Setting.b.ERROR = 1;
603 00e3 be00 ldw x,_pKeyStruct
604 00e5 e602 ld a,(2,x)
605 00e7 aa20 or a,#32
606 00e9 e702 ld (2,x),a
607 ; 258 }
610 00eb 81 ret
635 ; 272 void TSL_SCKey_SetDisabledState(void)
635 ; 273 {
636 switch .text
637 00ec _TSL_SCKey_SetDisabledState:
641 ; 274 pKeyStruct->State.whole = DISABLED_STATE;
643 00ec a680 ld a,#128
644 00ee 92c700 ld [_pKeyStruct.w],a
645 ; 275 pKeyStruct->Setting.b.DETECTED = 0;
647 00f1 be00 ldw x,_pKeyStruct
648 00f3 e602 ld a,(2,x)
649 00f5 a4fb and a,#251
650 00f7 e702 ld (2,x),a
651 ; 276 pKeyStruct->Setting.b.CHANGED = 1;
653 00f9 be00 ldw x,_pKeyStruct
654 00fb e602 ld a,(2,x)
655 00fd aa08 or a,#8
656 00ff e702 ld (2,x),a
657 ; 277 pKeyStruct->Setting.b.LOCKED = 0;
659 0101 be00 ldw x,_pKeyStruct
660 0103 e602 ld a,(2,x)
661 0105 a47f and a,#127
662 0107 e702 ld (2,x),a
663 ; 278 pKeyStruct->Setting.b.ERROR = 0;
665 0109 be00 ldw x,_pKeyStruct
666 010b e602 ld a,(2,x)
667 010d a4df and a,#223
668 010f e702 ld (2,x),a
669 ; 279 }
672 0111 81 ret
764 ; 295 void TSL_ECS(void)
764 ; 296 {
765 switch .text
766 0112 _TSL_ECS:
768 0112 520b subw sp,#11
769 0000000b OFST: set 11
772 ; 302 disableInterrupts();
775 0114 9b sim
777 ; 303 Local_TickECS10ms = TSL_TickCount_ECS_10ms;
780 0115 450000 mov _Local_TickECS10ms,_TSL_TickCount_ECS_10ms
781 ; 304 TSL_TickCount_ECS_10ms = 0;
783 0118 3f00 clr _TSL_TickCount_ECS_10ms
784 ; 305 enableInterrupts();
787 011a 9a rim
791 011b ac580358 jpf L522
792 011f L322:
793 ; 309 ECSTimeStepCounter--;
795 011f 3a00 dec _ECSTimeStepCounter
796 ; 310 ECSTempoPrescaler--;
798 0121 3a00 dec _ECSTempoPrescaler
799 ; 311 if (!ECSTempoPrescaler)
801 0123 3d00 tnz _ECSTempoPrescaler
802 0125 260a jrne L132
803 ; 313 ECSTempoPrescaler = 10;
805 0127 350a0000 mov _ECSTempoPrescaler,#10
806 ; 314 if (ECSTempoCounter)
808 012b 3d00 tnz _ECSTempoCounter
809 012d 2702 jreq L132
810 ; 315 ECSTempoCounter--;
812 012f 3a00 dec _ECSTempoCounter
813 0131 L132:
814 ; 318 K_Filter = ECS_K_Slow; // Default case !
816 0131 b600 ld a,_ECS_K_Slow
817 0133 6b05 ld (OFST-6,sp),a
818 ; 319 ECS_Fast_Enable = 1;
820 0135 a601 ld a,#1
821 0137 6b07 ld (OFST-4,sp),a
822 ; 320 ECS_Fast_Direction = 0;
824 0139 0f06 clr (OFST-5,sp)
825 ; 322 for (KeyIndex = 0; KeyIndex < NUMBER_OF_SINGLE_CHANNEL_KEYS; KeyIndex++)
827 013b 3f00 clr _KeyIndex
828 013d L532:
829 ; 324 TSL_SetStructPointer();
831 013d cd0000 call _TSL_SetStructPointer
833 ; 326 if ((pKeyStruct->State.whole == PRE_DETECTED_STATE) || (pKeyStruct->State.whole == DETECTED_STATE) || (pKeyStruct->State.whole == POST_DETECTED_STATE))
835 0140 92c600 ld a,[_pKeyStruct.w]
836 0143 a114 cp a,#20
837 0145 270e jreq L542
839 0147 92c600 ld a,[_pKeyStruct.w]
840 014a a104 cp a,#4
841 014c 2707 jreq L542
843 014e 92c600 ld a,[_pKeyStruct.w]
844 0151 a124 cp a,#36
845 0153 261f jrne L342
846 0155 L542:
847 ; 328 ECSTempoCounter = ECSTemporization; // Restart temporization counter ...
849 0155 450000 mov _ECSTempoCounter,_ECSTemporization
850 ; 329 break; // Out from the for loop
851 0158 L142:
852 ; 357 for (KeyIndex = 0; KeyIndex < NUMBER_OF_MULTI_CHANNEL_KEYS; KeyIndex++)
854 0158 3f00 clr _KeyIndex
855 015a L372:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -