📄 stm8_tsl_rc_singlechannelkey.ls
字号:
590 0146 be00 ldw x,_pKeyStruct
591 0148 e607 ld a,(7,x)
592 014a a115 cp a,#21
593 014c 2421 jruge L361
595 014e 9c rvf
596 014f be00 ldw x,_pKeyStruct
597 0151 e60c ld a,(12,x)
598 0153 5f clrw x
599 0154 4d tnz a
600 0155 2a01 jrpl L22
601 0157 53 cplw x
602 0158 L22:
603 0158 97 ld xl,a
604 0159 b300 cpw x,_Delta
605 015b 2c12 jrsgt L361
606 ; 303 TSL_SCKey_DES( );
608 015d cd0000 call _TSL_SCKey_DES
610 ; 304 pKeyStruct->Channel.IntegratorCounter--;
612 0160 be00 ldw x,_pKeyStruct
613 0162 6a0a dec (10,x)
614 ; 305 if ( !pKeyStruct->Channel.IntegratorCounter )
616 0164 be00 ldw x,_pKeyStruct
617 0166 6d0a tnz (10,x)
618 0168 2609 jrne L761
619 ; 307 TSL_SCKey_SetDetectedState( );
621 016a cd0000 call _TSL_SCKey_SetDetectedState
623 016d 2004 jra L761
624 016f L361:
625 ; 312 TSL_SCKey_BackToIdleState( );
627 016f cd0000 call _TSL_SCKey_BackToIdleState
629 ; 313 return;
632 0172 81 ret
633 0173 L761:
634 ; 316 }
637 0173 81 ret
667 ; 329 void TSL_SCKey_DetectedTreatment(void)
667 ; 330 {
668 switch .text
669 0174 _TSL_SCKey_DetectedTreatment:
673 ; 333 if ((pKeyStruct->Channel.LastMeasRejectNb <= MAX_REJECTED_MEASUREMENTS) &&
673 ; 334 (Delta <= pKeyStruct->EndDetectThreshold))
675 0174 be00 ldw x,_pKeyStruct
676 0176 e607 ld a,(7,x)
677 0178 a115 cp a,#21
678 017a 241f jruge L102
680 017c 9c rvf
681 017d be00 ldw x,_pKeyStruct
682 017f e60d ld a,(13,x)
683 0181 5f clrw x
684 0182 4d tnz a
685 0183 2a01 jrpl L62
686 0185 53 cplw x
687 0186 L62:
688 0186 97 ld xl,a
689 0187 b300 cpw x,_Delta
690 0189 2f10 jrslt L102
691 ; 340 TSL_SCKey_SetPostDetectState( );
693 018b cd0000 call _TSL_SCKey_SetPostDetectState
695 ; 341 if ( !EndDetectionIntegrator )
697 018e 725d0000 tnz _EndDetectionIntegrator
698 0192 2606 jrne L302
699 ; 343 pKeyStruct->Channel.IntegratorCounter++;
701 0194 be00 ldw x,_pKeyStruct
702 0196 6c0a inc (10,x)
703 ; 344 TSL_SCKey_PostDetectTreatment( );
705 0198 ad05 call _TSL_SCKey_PostDetectTreatment
707 019a L302:
708 ; 346 return;
711 019a 81 ret
712 019b L102:
713 ; 349 TSL_SCKey_DetectionTimeout( );
715 019b cd0000 call _TSL_SCKey_DetectionTimeout
717 ; 351 }
720 019e 81 ret
748 ; 364 void TSL_SCKey_PostDetectTreatment(void)
748 ; 365 {
749 switch .text
750 019f _TSL_SCKey_PostDetectTreatment:
754 ; 368 if ((pKeyStruct->Channel.LastMeasRejectNb <= MAX_REJECTED_MEASUREMENTS) &&
754 ; 369 (Delta <= pKeyStruct->EndDetectThreshold))
756 019f be00 ldw x,_pKeyStruct
757 01a1 e607 ld a,(7,x)
758 01a3 a115 cp a,#21
759 01a5 241e jruge L512
761 01a7 9c rvf
762 01a8 be00 ldw x,_pKeyStruct
763 01aa e60d ld a,(13,x)
764 01ac 5f clrw x
765 01ad 4d tnz a
766 01ae 2a01 jrpl L23
767 01b0 53 cplw x
768 01b1 L23:
769 01b1 97 ld xl,a
770 01b2 b300 cpw x,_Delta
771 01b4 2f0f jrslt L512
772 ; 375 pKeyStruct->Channel.IntegratorCounter--;
774 01b6 be00 ldw x,_pKeyStruct
775 01b8 6a0a dec (10,x)
776 ; 376 if ( !pKeyStruct->Channel.IntegratorCounter )
778 01ba be00 ldw x,_pKeyStruct
779 01bc 6d0a tnz (10,x)
780 01be 2608 jrne L122
781 ; 378 TSL_SCKey_SetIdleState( );
783 01c0 cd0000 call _TSL_SCKey_SetIdleState
785 01c3 2003 jra L122
786 01c5 L512:
787 ; 384 TSL_SCKey_BackToDetectedState( );
789 01c5 cd0000 call _TSL_SCKey_BackToDetectedState
791 01c8 L122:
792 ; 386 }
795 01c8 81 ret
823 ; 399 void TSL_SCKey_PreRecalibrationTreatment(void)
823 ; 400 {
824 switch .text
825 01c9 _TSL_SCKey_PreRecalibrationTreatment:
829 ; 402 if ((pKeyStruct->Channel.LastMeasRejectNb <= MAX_REJECTED_MEASUREMENTS) &&
829 ; 403 (Delta <= pKeyStruct->RecalibrationThreshold))
831 01c9 be00 ldw x,_pKeyStruct
832 01cb e607 ld a,(7,x)
833 01cd a115 cp a,#21
834 01cf 241e jruge L332
836 01d1 9c rvf
837 01d2 be00 ldw x,_pKeyStruct
838 01d4 e60e ld a,(14,x)
839 01d6 5f clrw x
840 01d7 4d tnz a
841 01d8 2a01 jrpl L63
842 01da 53 cplw x
843 01db L63:
844 01db 97 ld xl,a
845 01dc b300 cpw x,_Delta
846 01de 2f0f jrslt L332
847 ; 405 pKeyStruct->Channel.IntegratorCounter--;
849 01e0 be00 ldw x,_pKeyStruct
850 01e2 6a0a dec (10,x)
851 ; 406 if ( !pKeyStruct->Channel.IntegratorCounter )
853 01e4 be00 ldw x,_pKeyStruct
854 01e6 6d0a tnz (10,x)
855 01e8 2608 jrne L732
856 ; 408 TSL_SCKey_SetCalibrationState( );
858 01ea cd0000 call _TSL_SCKey_SetCalibrationState
860 01ed 2003 jra L732
861 01ef L332:
862 ; 413 TSL_SCKey_BackToIdleState( );
864 01ef cd0000 call _TSL_SCKey_BackToIdleState
866 01f2 L732:
867 ; 416 }
870 01f2 81 ret
896 ; 429 void TSL_SCKey_CalibrationTreatment(void)
896 ; 430 {
897 switch .text
898 01f3 _TSL_SCKey_CalibrationTreatment:
902 ; 432 if (pKeyStruct->Channel.LastMeasRejectNb <= MAX_REJECTED_MEASUREMENTS)
904 01f3 be00 ldw x,_pKeyStruct
905 01f5 e607 ld a,(7,x)
906 01f7 a115 cp a,#21
907 01f9 242e jruge L152
908 ; 434 pKeyStruct->Channel.Reference += pKeyStruct->Channel.LastMeas;
910 01fb be00 ldw x,_pKeyStruct
911 01fd 90be00 ldw y,_pKeyStruct
912 0200 90ee05 ldw y,(5,y)
913 0203 90bf00 ldw c_y,y
914 0206 9093 ldw y,x
915 0208 90ee08 ldw y,(8,y)
916 020b 72b90000 addw y,c_y
917 020f ef08 ldw (8,x),y
918 ; 435 pKeyStruct->Counter--;
920 0211 be00 ldw x,_pKeyStruct
921 0213 6a03 dec (3,x)
922 ; 436 if ( !pKeyStruct->Counter )
924 0215 be00 ldw x,_pKeyStruct
925 0217 6d03 tnz (3,x)
926 0219 260e jrne L152
927 ; 439 pKeyStruct->Channel.Reference = (pKeyStruct->Channel.Reference >> 3);
929 021b be00 ldw x,_pKeyStruct
930 021d a603 ld a,#3
931 021f L24:
932 021f 6408 srl (8,x)
933 0221 6609 rrc (9,x)
934 0223 4a dec a
935 0224 26f9 jrne L24
936 ; 440 TSL_SCKey_SetIdleState( );
938 0226 cd0000 call _TSL_SCKey_SetIdleState
940 0229 L152:
941 ; 444 }
944 0229 81 ret
970 ; 457 void TSL_SCKey_CheckDisabled(void)
970 ; 458 {
971 switch .text
972 022a _TSL_SCKey_CheckDisabled:
976 ; 460 if ( !pKeyStruct->Setting.b.ENABLED )
978 022a be00 ldw x,_pKeyStruct
979 022c e602 ld a,(2,x)
980 022e a502 bcp a,#2
981 0230 2603 jrne L562
982 ; 462 TSL_SCKey_SetDisabledState( );
984 0232 cd0000 call _TSL_SCKey_SetDisabledState
986 0235 L562:
987 ; 465 }
990 0235 81 ret
1016 ; 478 void TSL_SCKey_CheckEnabled(void)
1016 ; 479 {
1017 switch .text
1018 0236 _TSL_SCKey_CheckEnabled:
1022 ; 481 if ( pKeyStruct->Setting.b.ENABLED && pKeyStruct->Setting.b.IMPLEMENTED )
1024 0236 be00 ldw x,_pKeyStruct
1025 0238 e602 ld a,(2,x)
1026 023a a502 bcp a,#2
1027 023c 270b jreq L772
1029 023e be00 ldw x,_pKeyStruct
1030 0240 e602 ld a,(2,x)
1031 0242 a501 bcp a,#1
1032 0244 2703 jreq L772
1033 ; 483 TSL_SCKey_SetCalibrationState( );
1035 0246 cd0000 call _TSL_SCKey_SetCalibrationState
1037 0249 L772:
1038 ; 486 }
1041 0249 81 ret
1066 ; 499 u8 TSL_SCKey_CheckErrorCondition(void)
1066 ; 500 {
1067 switch .text
1068 024a _TSL_SCKey_CheckErrorCondition:
1072 ; 502 if ( (pKeyStruct->Channel.LastMeas < SCKEY_MIN_ACQUISITION)
1072 ; 503 || (pKeyStruct->Channel.LastMeas > SCKEY_MAX_ACQUISITION) )
1074 024a be00 ldw x,_pKeyStruct
1075 024c 9093 ldw y,x
1076 024e 90ee05 ldw y,(5,y)
1077 0251 90a30096 cpw y,#150
1078 0255 250d jrult L313
1080 0257 be00 ldw x,_pKeyStruct
1081 0259 9093 ldw y,x
1082 025b 90ee05 ldw y,(5,y)
1083 025e 90a30bb9 cpw y,#3001
1084 0262 2503 jrult L113
1085 0264 L313:
1086 ; 505 return 0xFF; // Error case !
1088 0264 a6ff ld a,#255
1091 0266 81 ret
1092 0267 L113:
1093 ; 508 return 0;
1095 0267 4f clr a
1098 0268 81 ret
1111 xref _TSL_SCKey_DetectionTimeout
1112 xref _TSL_SCKey_DES
1113 xref _TSL_SCKey_SetDisabledState
1114 xref _TSL_SCKey_SetErrorState
1115 xref _TSL_SCKey_SetPreRecalibrationState
1116 xref _TSL_SCKey_BackToDetectedState
1117 xref _TSL_SCKey_SetPostDetectState
1118 xref _TSL_SCKey_SetDetectedState
1119 xref _TSL_SCKey_SetPreDetectState
1120 xref _TSL_SCKey_BackToIdleState
1121 xref _TSL_SCKey_SetIdleState
1122 xref _TSL_DeltaCalculation
1123 xref _TSL_SetStructPointer
1124 xref.b _TSL_TempGlobalState
1125 xref.b _TSL_TempGlobalSetting
1126 xref.b _Delta
1127 xref.b _KeyIndex
1128 xref _TSL_IO_Acquisition
1129 xref _Table_SCKEY_BITS
1130 xref.b _sTouchIO
1131 xref _TSL_SCKey_SetCalibrationState
1132 xref _EndDetectionIntegrator
1133 xref _DetectionIntegrator
1134 xref _sSCKeyInfo
1135 xref.b _pKeyStruct
1136 xdef _TSL_SCKey_CheckErrorCondition
1137 xdef _TSL_SCKey_CheckEnabled
1138 xdef _TSL_SCKey_CheckDisabled
1139 xdef _TSL_SCKey_CalibrationTreatment
1140 xdef _TSL_SCKey_PreRecalibrationTreatment
1141 xdef _TSL_SCKey_PostDetectTreatment
1142 xdef _TSL_SCKey_DetectedTreatment
1143 xdef _TSL_SCKey_PreDetectTreatment
1144 xdef _TSL_SCKey_IdleTreatment
1145 xdef _TSL_SCKey_Process
1146 xdef _TSL_SCKEY_P1_Acquisition
1147 xdef _TSL_SCKey_Init
1148 xref.b c_y
1167 end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -