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

📄 stm8s_gpio.ls

📁 STM8全部资料
💻 LS
字号:
   1                     ; C Compiler for STM8 (COSMIC Software)
   2                     ; Parser V4.8.32.1 - 30 Mar 2010
   3                     ; Generator V4.3.4 - 23 Mar 2010
 109                     ; 65 void GPIO_DeInit(GPIO_TypeDef* GPIOx)
 109                     ; 66 {
 111                     	switch	.text
 112  0000               _GPIO_DeInit:
 116                     ; 67   GPIOx->ODR = GPIO_ODR_RESET_VALUE; /* Reset Output Data Register */
 118  0000 7f            	clr	(x)
 119                     ; 68   GPIOx->DDR = GPIO_DDR_RESET_VALUE; /* Reset Data Direction Register */
 121  0001 6f02          	clr	(2,x)
 122                     ; 69   GPIOx->CR1 = GPIO_CR1_RESET_VALUE; /* Reset Control Register 1 */
 124  0003 6f03          	clr	(3,x)
 125                     ; 70   GPIOx->CR2 = GPIO_CR2_RESET_VALUE; /* Reset Control Register 2 */
 127  0005 6f04          	clr	(4,x)
 128                     ; 71 }
 131  0007 81            	ret
 371                     ; 92 void GPIO_Init(GPIO_TypeDef* GPIOx,
 371                     ; 93                GPIO_Pin_TypeDef GPIO_Pin,
 371                     ; 94                GPIO_Mode_TypeDef GPIO_Mode)
 371                     ; 95 {
 372                     	switch	.text
 373  0008               _GPIO_Init:
 375  0008 89            	pushw	x
 376       00000000      OFST:	set	0
 379                     ; 100   assert_param(IS_GPIO_MODE_OK(GPIO_Mode));
 381                     ; 101   assert_param(IS_GPIO_PIN_OK(GPIO_Pin));
 383                     ; 107   if ((((u8)(GPIO_Mode)) & (u8)0x80) != (u8)0x00) /* Output mode */
 385  0009 7b06          	ld	a,(OFST+6,sp)
 386  000b a580          	bcp	a,#128
 387  000d 271d          	jreq	L771
 388                     ; 109     if ((((u8)(GPIO_Mode)) & (u8)0x10) != (u8)0x00) /* High level */
 390  000f 7b06          	ld	a,(OFST+6,sp)
 391  0011 a510          	bcp	a,#16
 392  0013 2706          	jreq	L102
 393                     ; 111       GPIOx->ODR |= GPIO_Pin;
 395  0015 f6            	ld	a,(x)
 396  0016 1a05          	or	a,(OFST+5,sp)
 397  0018 f7            	ld	(x),a
 399  0019 2007          	jra	L302
 400  001b               L102:
 401                     ; 114       GPIOx->ODR &= (u8)(~(GPIO_Pin));
 403  001b 1e01          	ldw	x,(OFST+1,sp)
 404  001d 7b05          	ld	a,(OFST+5,sp)
 405  001f 43            	cpl	a
 406  0020 f4            	and	a,(x)
 407  0021 f7            	ld	(x),a
 408  0022               L302:
 409                     ; 117     GPIOx->DDR |= GPIO_Pin;
 411  0022 1e01          	ldw	x,(OFST+1,sp)
 412  0024 e602          	ld	a,(2,x)
 413  0026 1a05          	or	a,(OFST+5,sp)
 414  0028 e702          	ld	(2,x),a
 416  002a 2009          	jra	L502
 417  002c               L771:
 418                     ; 121     GPIOx->DDR &= (u8)(~(GPIO_Pin));
 420  002c 1e01          	ldw	x,(OFST+1,sp)
 421  002e 7b05          	ld	a,(OFST+5,sp)
 422  0030 43            	cpl	a
 423  0031 e402          	and	a,(2,x)
 424  0033 e702          	ld	(2,x),a
 425  0035               L502:
 426                     ; 128   if ((((u8)(GPIO_Mode)) & (u8)0x40) != (u8)0x00) /* Pull-Up or Push-Pull */
 428  0035 7b06          	ld	a,(OFST+6,sp)
 429  0037 a540          	bcp	a,#64
 430  0039 270a          	jreq	L702
 431                     ; 130     GPIOx->CR1 |= GPIO_Pin;
 433  003b 1e01          	ldw	x,(OFST+1,sp)
 434  003d e603          	ld	a,(3,x)
 435  003f 1a05          	or	a,(OFST+5,sp)
 436  0041 e703          	ld	(3,x),a
 438  0043 2009          	jra	L112
 439  0045               L702:
 440                     ; 133     GPIOx->CR1 &= (u8)(~(GPIO_Pin));
 442  0045 1e01          	ldw	x,(OFST+1,sp)
 443  0047 7b05          	ld	a,(OFST+5,sp)
 444  0049 43            	cpl	a
 445  004a e403          	and	a,(3,x)
 446  004c e703          	ld	(3,x),a
 447  004e               L112:
 448                     ; 140   if ((((u8)(GPIO_Mode)) & (u8)0x20) != (u8)0x00) /* Interrupt or Slow slope */
 450  004e 7b06          	ld	a,(OFST+6,sp)
 451  0050 a520          	bcp	a,#32
 452  0052 270a          	jreq	L312
 453                     ; 142     GPIOx->CR2 |= GPIO_Pin;
 455  0054 1e01          	ldw	x,(OFST+1,sp)
 456  0056 e604          	ld	a,(4,x)
 457  0058 1a05          	or	a,(OFST+5,sp)
 458  005a e704          	ld	(4,x),a
 460  005c 2009          	jra	L512
 461  005e               L312:
 462                     ; 145     GPIOx->CR2 &= (u8)(~(GPIO_Pin));
 464  005e 1e01          	ldw	x,(OFST+1,sp)
 465  0060 7b05          	ld	a,(OFST+5,sp)
 466  0062 43            	cpl	a
 467  0063 e404          	and	a,(4,x)
 468  0065 e704          	ld	(4,x),a
 469  0067               L512:
 470                     ; 148 }
 473  0067 85            	popw	x
 474  0068 81            	ret
 518                     ; 166 void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal)
 518                     ; 167 {
 519                     	switch	.text
 520  0069               _GPIO_Write:
 522  0069 89            	pushw	x
 523       00000000      OFST:	set	0
 526                     ; 168   GPIOx->ODR = PortVal;
 528  006a 7b05          	ld	a,(OFST+5,sp)
 529  006c 1e01          	ldw	x,(OFST+1,sp)
 530  006e f7            	ld	(x),a
 531                     ; 169 }
 534  006f 85            	popw	x
 535  0070 81            	ret
 582                     ; 187 void GPIO_WriteHigh(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef PortPins)
 582                     ; 188 {
 583                     	switch	.text
 584  0071               _GPIO_WriteHigh:
 586  0071 89            	pushw	x
 587       00000000      OFST:	set	0
 590                     ; 189   GPIOx->ODR |= PortPins;
 592  0072 f6            	ld	a,(x)
 593  0073 1a05          	or	a,(OFST+5,sp)
 594  0075 f7            	ld	(x),a
 595                     ; 190 }
 598  0076 85            	popw	x
 599  0077 81            	ret
 646                     ; 208 void GPIO_WriteLow(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef PortPins)
 646                     ; 209 {
 647                     	switch	.text
 648  0078               _GPIO_WriteLow:
 650  0078 89            	pushw	x
 651       00000000      OFST:	set	0
 654                     ; 210   GPIOx->ODR &= (u8)(~PortPins);
 656  0079 7b05          	ld	a,(OFST+5,sp)
 657  007b 43            	cpl	a
 658  007c f4            	and	a,(x)
 659  007d f7            	ld	(x),a
 660                     ; 211 }
 663  007e 85            	popw	x
 664  007f 81            	ret
 711                     ; 229 void GPIO_WriteReverse(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef PortPins)
 711                     ; 230 {
 712                     	switch	.text
 713  0080               _GPIO_WriteReverse:
 715  0080 89            	pushw	x
 716       00000000      OFST:	set	0
 719                     ; 231   GPIOx->ODR ^= PortPins;
 721  0081 f6            	ld	a,(x)
 722  0082 1805          	xor	a,	(OFST+5,sp)
 723  0084 f7            	ld	(x),a
 724                     ; 232 }
 727  0085 85            	popw	x
 728  0086 81            	ret
 766                     ; 249 u8 GPIO_ReadOutputData(GPIO_TypeDef* GPIOx)
 766                     ; 250 {
 767                     	switch	.text
 768  0087               _GPIO_ReadOutputData:
 772                     ; 251   return ((u8)GPIOx->ODR);
 774  0087 f6            	ld	a,(x)
 777  0088 81            	ret
 814                     ; 269 u8 GPIO_ReadInputData(GPIO_TypeDef* GPIOx)
 814                     ; 270 {
 815                     	switch	.text
 816  0089               _GPIO_ReadInputData:
 820                     ; 271   return ((u8)GPIOx->IDR);
 822  0089 e601          	ld	a,(1,x)
 825  008b 81            	ret
 893                     ; 292 BitStatus GPIO_ReadInputPin(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef GPIO_Pin)
 893                     ; 293 {
 894                     	switch	.text
 895  008c               _GPIO_ReadInputPin:
 897  008c 89            	pushw	x
 898       00000000      OFST:	set	0
 901                     ; 294   return ((BitStatus)(GPIOx->IDR & (u8)GPIO_Pin));
 903  008d e601          	ld	a,(1,x)
 904  008f 1405          	and	a,(OFST+5,sp)
 907  0091 85            	popw	x
 908  0092 81            	ret
 986                     ; 314 void GPIO_ExternalPullUpConfig(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef GPIO_Pin, FunctionalState NewState)
 986                     ; 315 {
 987                     	switch	.text
 988  0093               _GPIO_ExternalPullUpConfig:
 990  0093 89            	pushw	x
 991       00000000      OFST:	set	0
 994                     ; 317   assert_param(IS_GPIO_PIN_OK(GPIO_Pin));
 996                     ; 318   assert_param(IS_FUNCTIONALSTATE_OK(NewState));
 998                     ; 320   if (NewState != DISABLE) /* External Pull-Up Set*/
1000  0094 0d06          	tnz	(OFST+6,sp)
1001  0096 2708          	jreq	L174
1002                     ; 322     GPIOx->CR1 |= GPIO_Pin;
1004  0098 e603          	ld	a,(3,x)
1005  009a 1a05          	or	a,(OFST+5,sp)
1006  009c e703          	ld	(3,x),a
1008  009e 2009          	jra	L374
1009  00a0               L174:
1010                     ; 325     GPIOx->CR1 &= (u8)(~(GPIO_Pin));
1012  00a0 1e01          	ldw	x,(OFST+1,sp)
1013  00a2 7b05          	ld	a,(OFST+5,sp)
1014  00a4 43            	cpl	a
1015  00a5 e403          	and	a,(3,x)
1016  00a7 e703          	ld	(3,x),a
1017  00a9               L374:
1018                     ; 327 }
1021  00a9 85            	popw	x
1022  00aa 81            	ret
1035                     	xdef	_GPIO_ExternalPullUpConfig
1036                     	xdef	_GPIO_ReadInputPin
1037                     	xdef	_GPIO_ReadOutputData
1038                     	xdef	_GPIO_ReadInputData
1039                     	xdef	_GPIO_WriteReverse
1040                     	xdef	_GPIO_WriteLow
1041                     	xdef	_GPIO_WriteHigh
1042                     	xdef	_GPIO_Write
1043                     	xdef	_GPIO_Init
1044                     	xdef	_GPIO_DeInit
1063                     	end

⌨️ 快捷键说明

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