⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm8_tsl_rc_singlechannelkey.ls

📁 STM8-触摸例程
💻 LS
📖 第 1 页 / 共 3 页
字号:
 906  0222 b300          	cpw	x,_Delta
 907  0224 2c12          	jrsgt	L342
 909  0226 be00          	ldw	x,_Delta
 910  0228 2a0e          	jrpl	L342
 911  022a               L542:
 912                     ; 340     TSL_SCKey_SetPostDetectState( );
 914  022a cd0000        	call	_TSL_SCKey_SetPostDetectState
 916                     ; 341     if ( !EndDetectionIntegrator )
 918  022d b600          	ld	a,_EndDetectionIntegrator
 919  022f 2606          	jrne	L152
 920                     ; 343       pKeyStruct->Channel.IntegratorCounter++;
 922  0231 be00          	ldw	x,_pKeyStruct
 923  0233 6c0a          	inc	(10,x)
 924                     ; 344       TSL_SCKey_PostDetectTreatment( );
 926  0235 ad04          	call	_TSL_SCKey_PostDetectTreatment
 928  0237               L152:
 929                     ; 346     return;
 932  0237 81            	ret	
 933  0238               L342:
 934                     ; 349   TSL_SCKey_DetectionTimeout( );
 937                     ; 351 }
 940  0238 cc0000        	jp	_TSL_SCKey_DetectionTimeout
 968                     ; 364 void TSL_SCKey_PostDetectTreatment(void)
 968                     ; 365 {
 969                     	switch	.text
 970  023b               _TSL_SCKey_PostDetectTreatment:
 974                     ; 371 	if ((pKeyStruct->Channel.LastMeasRejectNb <= MAX_REJECTED_MEASUREMENTS) &&
 974                     ; 372       ((( Delta <= pKeyStruct->EndDetectThreshold )&&(Delta > 0)) || (( Delta >= pKeyStruct->RecalibrationThreshold)&&(Delta < 0))))
 976  023b be00          	ldw	x,_pKeyStruct
 977  023d e607          	ld	a,(7,x)
 978  023f a115          	cp	a,#21
 979  0241 242c          	jruge	L362
 981  0243 e60d          	ld	a,(13,x)
 982  0245 5f            	clrw	x
 983  0246 4d            	tnz	a
 984  0247 2a01          	jrpl	L261
 985  0249 53            	cplw	x
 986  024a               L261:
 987  024a 97            	ld	xl,a
 988  024b b300          	cpw	x,_Delta
 989  024d 2f05          	jrslt	L762
 991  024f 9c            	rvf	
 992  0250 be00          	ldw	x,_Delta
 993  0252 2c12          	jrsgt	L562
 994  0254               L762:
 996  0254 be00          	ldw	x,_pKeyStruct
 997  0256 e60e          	ld	a,(14,x)
 998  0258 5f            	clrw	x
 999  0259 4d            	tnz	a
1000  025a 2a01          	jrpl	L461
1001  025c 53            	cplw	x
1002  025d               L461:
1003  025d 97            	ld	xl,a
1004  025e b300          	cpw	x,_Delta
1005  0260 2c0d          	jrsgt	L362
1007  0262 be00          	ldw	x,_Delta
1008  0264 2a09          	jrpl	L362
1009  0266               L562:
1010                     ; 375     pKeyStruct->Channel.IntegratorCounter--;
1012  0266 be00          	ldw	x,_pKeyStruct
1013  0268 6a0a          	dec	(10,x)
1014                     ; 376     if ( !pKeyStruct->Channel.IntegratorCounter )
1016  026a 2606          	jrne	L372
1017                     ; 378       TSL_SCKey_SetIdleState( );
1021  026c cc0000        	jp	_TSL_SCKey_SetIdleState
1022  026f               L362:
1023                     ; 384     TSL_SCKey_BackToDetectedState( );
1025  026f cd0000        	call	_TSL_SCKey_BackToDetectedState
1027  0272               L372:
1028                     ; 386 }
1031  0272 81            	ret	
1059                     ; 399 void TSL_SCKey_PreRecalibrationTreatment(void)
1059                     ; 400 {
1060                     	switch	.text
1061  0273               _TSL_SCKey_PreRecalibrationTreatment:
1065                     ; 402   if ((pKeyStruct->Channel.LastMeasRejectNb <= MAX_REJECTED_MEASUREMENTS) &&
1065                     ; 403      (Delta <= pKeyStruct->RecalibrationThreshold))
1067  0273 be00          	ldw	x,_pKeyStruct
1068  0275 e607          	ld	a,(7,x)
1069  0277 a115          	cp	a,#21
1070  0279 2415          	jruge	L503
1072  027b e60e          	ld	a,(14,x)
1073  027d 5f            	clrw	x
1074  027e 4d            	tnz	a
1075  027f 2a01          	jrpl	L471
1076  0281 53            	cplw	x
1077  0282               L471:
1078  0282 97            	ld	xl,a
1079  0283 b300          	cpw	x,_Delta
1080  0285 2f09          	jrslt	L503
1081                     ; 405     pKeyStruct->Channel.IntegratorCounter--;
1083  0287 be00          	ldw	x,_pKeyStruct
1084  0289 6a0a          	dec	(10,x)
1085                     ; 406     if ( !pKeyStruct->Channel.IntegratorCounter )
1087  028b 2606          	jrne	L113
1088                     ; 408       TSL_SCKey_SetCalibrationState( );
1092  028d cc0000        	jp	_TSL_SCKey_SetCalibrationState
1093  0290               L503:
1094                     ; 413     TSL_SCKey_BackToIdleState( );
1096  0290 cd0000        	call	_TSL_SCKey_BackToIdleState
1098  0293               L113:
1099                     ; 416 }
1102  0293 81            	ret	
1128                     ; 429 void TSL_SCKey_CalibrationTreatment(void)
1128                     ; 430 {
1129                     	switch	.text
1130  0294               _TSL_SCKey_CalibrationTreatment:
1134                     ; 432   if (pKeyStruct->Channel.LastMeasRejectNb <= MAX_REJECTED_MEASUREMENTS)
1136  0294 be00          	ldw	x,_pKeyStruct
1137  0296 e607          	ld	a,(7,x)
1138  0298 a115          	cp	a,#21
1139  029a 2423          	jruge	L323
1140                     ; 434     pKeyStruct->Channel.Reference += pKeyStruct->Channel.LastMeas;
1142  029c 9093          	ldw	y,x
1143  029e 90ee05        	ldw	y,(5,y)
1144  02a1 90bf00        	ldw	c_y,y
1145  02a4 9093          	ldw	y,x
1146  02a6 90ee08        	ldw	y,(8,y)
1147  02a9 72b90000      	addw	y,c_y
1148  02ad ef08          	ldw	(8,x),y
1149                     ; 435     pKeyStruct->Counter--;
1151  02af 6a03          	dec	(3,x)
1152                     ; 436     if ( !pKeyStruct->Counter )
1154  02b1 260c          	jrne	L323
1155                     ; 439       pKeyStruct->Channel.Reference = (pKeyStruct->Channel.Reference >> 3);
1157  02b3 a603          	ld	a,#3
1158  02b5               L402:
1159  02b5 6408          	srl	(8,x)
1160  02b7 6609          	rrc	(9,x)
1161  02b9 4a            	dec	a
1162  02ba 26f9          	jrne	L402
1163                     ; 440       TSL_SCKey_SetIdleState( );
1165  02bc cd0000        	call	_TSL_SCKey_SetIdleState
1167  02bf               L323:
1168                     ; 444 }
1171  02bf 81            	ret	
1197                     ; 457 void TSL_SCKey_CheckDisabled(void)
1197                     ; 458 {
1198                     	switch	.text
1199  02c0               _TSL_SCKey_CheckDisabled:
1203                     ; 460   if ( !pKeyStruct->Setting.b.ENABLED )
1205  02c0 be00          	ldw	x,_pKeyStruct
1206  02c2 e602          	ld	a,(2,x)
1207  02c4 a502          	bcp	a,#2
1208  02c6 2603          	jrne	L733
1209                     ; 462     TSL_SCKey_SetDisabledState( );
1211  02c8 cd0000        	call	_TSL_SCKey_SetDisabledState
1213  02cb               L733:
1214                     ; 465 }
1217  02cb 81            	ret	
1243                     ; 478 void TSL_SCKey_CheckEnabled(void)
1243                     ; 479 {
1244                     	switch	.text
1245  02cc               _TSL_SCKey_CheckEnabled:
1249                     ; 481   if ( pKeyStruct->Setting.b.ENABLED && pKeyStruct->Setting.b.IMPLEMENTED )
1251  02cc be00          	ldw	x,_pKeyStruct
1252  02ce e602          	ld	a,(2,x)
1253  02d0 a502          	bcp	a,#2
1254  02d2 2707          	jreq	L153
1256  02d4 a501          	bcp	a,#1
1257  02d6 2703          	jreq	L153
1258                     ; 483     TSL_SCKey_SetCalibrationState( );
1260  02d8 cd0000        	call	_TSL_SCKey_SetCalibrationState
1262  02db               L153:
1263                     ; 486 }
1266  02db 81            	ret	
1291                     ; 499 u8 TSL_SCKey_CheckErrorCondition(void)
1291                     ; 500 {
1292                     	switch	.text
1293  02dc               _TSL_SCKey_CheckErrorCondition:
1297                     ; 502   if ( (pKeyStruct->Channel.LastMeas < SCKEY_MIN_ACQUISITION)
1297                     ; 503        || (pKeyStruct->Channel.LastMeas > SCKEY_MAX_ACQUISITION) )
1299  02dc be00          	ldw	x,_pKeyStruct
1300  02de 9093          	ldw	y,x
1301  02e0 90ee05        	ldw	y,(5,y)
1302  02e3 90a30096      	cpw	y,#150
1303  02e7 250b          	jrult	L563
1305  02e9 9093          	ldw	y,x
1306  02eb 90ee05        	ldw	y,(5,y)
1307  02ee 90a30bb9      	cpw	y,#3001
1308  02f2 2503          	jrult	L363
1309  02f4               L563:
1310                     ; 505     return 0xFF;  // Error case !
1312  02f4 a6ff          	ld	a,#255
1315  02f6 81            	ret	
1316  02f7               L363:
1317                     ; 508   return 0;
1319  02f7 4f            	clr	a
1322  02f8 81            	ret	
1335                     	xref	_TSL_SCKey_DetectionTimeout
1336                     	xref	_TSL_SCKey_DES
1337                     	xref	_TSL_SCKey_SetDisabledState
1338                     	xref	_TSL_SCKey_SetErrorState
1339                     	xref	_TSL_SCKey_BackToDetectedState
1340                     	xref	_TSL_SCKey_SetPostDetectState
1341                     	xref	_TSL_SCKey_SetDetectedState
1342                     	xref	_TSL_SCKey_SetPreDetectState
1343                     	xref	_TSL_SCKey_BackToIdleState
1344                     	xref	_TSL_SCKey_SetIdleState
1345                     	xref	_TSL_DeltaCalculation
1346                     	xref	_TSL_SetStructPointer
1347                     	xref.b	_TSL_TempGlobalState
1348                     	xref.b	_TSL_TempGlobalSetting
1349                     	xref.b	_Delta
1350                     	xref.b	_KeyIndex
1351                     	xref	_TSL_IO_Acquisition
1352                     	xref	_Table_SCKEY_BITS
1353                     	xref.b	_sTouchIO
1354                     	xref	_TSL_SCKey_SetCalibrationState
1355                     	xref.b	_EndDetectionIntegrator
1356                     	xref.b	_DetectionIntegrator
1357                     	xref.b	_sSCKeyInfo
1358                     	xref.b	_pKeyStruct
1359                     	xdef	_TSL_SCKey_CheckErrorCondition
1360                     	xdef	_TSL_SCKey_CheckEnabled
1361                     	xdef	_TSL_SCKey_CheckDisabled
1362                     	xdef	_TSL_SCKey_CalibrationTreatment
1363                     	xdef	_TSL_SCKey_PreRecalibrationTreatment
1364                     	xdef	_TSL_SCKey_PostDetectTreatment
1365                     	xdef	_TSL_SCKey_DetectedTreatment
1366                     	xdef	_TSL_SCKey_PreDetectTreatment
1367                     	xdef	_TSL_SCKey_IdleTreatment
1368                     	xdef	_TSL_SCKey_Process
1369                     	xdef	_TSL_SCKEY_P3_Acquisition
1370                     	xdef	_TSL_SCKEY_P2_Acquisition
1371                     	xdef	_TSL_SCKEY_P1_Acquisition
1372                     	xdef	_TSL_SCKey_Init
1373                     	xref.b	c_y
1392                     	end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -