📄 stm8s_gpio.ls
字号:
1 ; C Compiler for STM8 (COSMIC Software)
2 ; Generator V4.2.8 - 03 Dec 2008
3 ; Optimizer V4.2.8 - 03 Dec 2008
99 ; 65 void GPIO_DeInit(GPIO_TypeDef* GPIOx)
99 ; 66 {
101 switch .text
102 0000 _GPIO_DeInit:
106 ; 67 GPIOx->ODR = GPIO_ODR_RESET_VALUE; /* Reset Output Data Register */
108 0000 7f clr (x)
109 ; 68 GPIOx->DDR = GPIO_DDR_RESET_VALUE; /* Reset Data Direction Register */
111 0001 6f02 clr (2,x)
112 ; 69 GPIOx->CR1 = GPIO_CR1_RESET_VALUE; /* Reset Control Register 1 */
114 0003 6f03 clr (3,x)
115 ; 70 GPIOx->CR2 = GPIO_CR2_RESET_VALUE; /* Reset Control Register 2 */
117 0005 6f04 clr (4,x)
118 ; 71 }
121 0007 81 ret
361 ; 92 void GPIO_Init(GPIO_TypeDef* GPIOx,
361 ; 93 GPIO_Pin_TypeDef GPIO_Pin,
361 ; 94 GPIO_Mode_TypeDef GPIO_Mode)
361 ; 95 {
362 switch .text
363 0008 _GPIO_Init:
365 0008 89 pushw x
366 00000000 OFST: set 0
369 ; 100 assert_param(IS_GPIO_MODE_OK(GPIO_Mode));
371 ; 101 assert_param(IS_GPIO_PIN_OK(GPIO_Pin));
373 ; 107 if ((((u8)(GPIO_Mode)) & (u8)0x80) != (u8)0x00) /* Output mode */
375 0009 7b06 ld a,(OFST+6,sp)
376 000b 2a18 jrpl L771
377 ; 109 if ((((u8)(GPIO_Mode)) & (u8)0x10) != (u8)0x00) /* High level */
379 000d a510 bcp a,#16
380 000f 2705 jreq L102
381 ; 111 GPIOx->ODR |= GPIO_Pin;
383 0011 f6 ld a,(x)
384 0012 1a05 or a,(OFST+5,sp)
386 0014 2006 jra L302
387 0016 L102:
388 ; 114 GPIOx->ODR &= (u8)(~(GPIO_Pin));
390 0016 1e01 ldw x,(OFST+1,sp)
391 0018 7b05 ld a,(OFST+5,sp)
392 001a 43 cpl a
393 001b f4 and a,(x)
394 001c L302:
395 001c f7 ld (x),a
396 ; 117 GPIOx->DDR |= GPIO_Pin;
398 001d 1e01 ldw x,(OFST+1,sp)
399 001f e602 ld a,(2,x)
400 0021 1a05 or a,(OFST+5,sp)
402 0023 2007 jra L502
403 0025 L771:
404 ; 121 GPIOx->DDR &= (u8)(~(GPIO_Pin));
406 0025 1e01 ldw x,(OFST+1,sp)
407 0027 7b05 ld a,(OFST+5,sp)
408 0029 43 cpl a
409 002a e402 and a,(2,x)
410 002c L502:
411 002c e702 ld (2,x),a
412 ; 128 if ((((u8)(GPIO_Mode)) & (u8)0x40) != (u8)0x00) /* Pull-Up or Push-Pull */
414 002e 7b06 ld a,(OFST+6,sp)
415 0030 a540 bcp a,#64
416 0032 2706 jreq L702
417 ; 130 GPIOx->CR1 |= GPIO_Pin;
419 0034 e603 ld a,(3,x)
420 0036 1a05 or a,(OFST+5,sp)
422 0038 2005 jra L112
423 003a L702:
424 ; 133 GPIOx->CR1 &= (u8)(~(GPIO_Pin));
426 003a 7b05 ld a,(OFST+5,sp)
427 003c 43 cpl a
428 003d e403 and a,(3,x)
429 003f L112:
430 003f e703 ld (3,x),a
431 ; 140 if ((((u8)(GPIO_Mode)) & (u8)0x20) != (u8)0x00) /* Interrupt or Slow slope */
433 0041 7b06 ld a,(OFST+6,sp)
434 0043 a520 bcp a,#32
435 0045 2706 jreq L312
436 ; 142 GPIOx->CR2 |= GPIO_Pin;
438 0047 e604 ld a,(4,x)
439 0049 1a05 or a,(OFST+5,sp)
441 004b 2005 jra L512
442 004d L312:
443 ; 145 GPIOx->CR2 &= (u8)(~(GPIO_Pin));
445 004d 7b05 ld a,(OFST+5,sp)
446 004f 43 cpl a
447 0050 e404 and a,(4,x)
448 0052 L512:
449 0052 e704 ld (4,x),a
450 ; 148 }
453 0054 85 popw x
454 0055 81 ret
500 ; 166 void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal)
500 ; 167 {
501 switch .text
502 0056 _GPIO_Write:
504 0056 89 pushw x
505 00000000 OFST: set 0
508 ; 168 GPIOx->ODR = PortVal;
510 0057 1e01 ldw x,(OFST+1,sp)
511 0059 7b05 ld a,(OFST+5,sp)
512 005b f7 ld (x),a
513 ; 169 }
516 005c 85 popw x
517 005d 81 ret
564 ; 187 void GPIO_WriteHigh(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef PortPins)
564 ; 188 {
565 switch .text
566 005e _GPIO_WriteHigh:
568 005e 89 pushw x
569 00000000 OFST: set 0
572 ; 189 GPIOx->ODR |= PortPins;
574 005f f6 ld a,(x)
575 0060 1a05 or a,(OFST+5,sp)
576 0062 f7 ld (x),a
577 ; 190 }
580 0063 85 popw x
581 0064 81 ret
628 ; 208 void GPIO_WriteLow(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef PortPins)
628 ; 209 {
629 switch .text
630 0065 _GPIO_WriteLow:
632 0065 89 pushw x
633 00000000 OFST: set 0
636 ; 210 GPIOx->ODR &= (u8)(~PortPins);
638 0066 7b05 ld a,(OFST+5,sp)
639 0068 43 cpl a
640 0069 f4 and a,(x)
641 006a f7 ld (x),a
642 ; 211 }
645 006b 85 popw x
646 006c 81 ret
693 ; 229 void GPIO_WriteReverse(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef PortPins)
693 ; 230 {
694 switch .text
695 006d _GPIO_WriteReverse:
697 006d 89 pushw x
698 00000000 OFST: set 0
701 ; 231 GPIOx->ODR ^= PortPins;
703 006e f6 ld a,(x)
704 006f 1805 xor a,(OFST+5,sp)
705 0071 f7 ld (x),a
706 ; 232 }
709 0072 85 popw x
710 0073 81 ret
748 ; 249 u8 GPIO_ReadOutputData(GPIO_TypeDef* GPIOx)
748 ; 250 {
749 switch .text
750 0074 _GPIO_ReadOutputData:
754 ; 251 return ((u8)GPIOx->ODR);
756 0074 f6 ld a,(x)
759 0075 81 ret
796 ; 269 u8 GPIO_ReadInputData(GPIO_TypeDef* GPIOx)
796 ; 270 {
797 switch .text
798 0076 _GPIO_ReadInputData:
802 ; 271 return ((u8)GPIOx->IDR);
804 0076 e601 ld a,(1,x)
807 0078 81 ret
875 ; 292 BitStatus GPIO_ReadInputPin(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef GPIO_Pin)
875 ; 293 {
876 switch .text
877 0079 _GPIO_ReadInputPin:
879 0079 89 pushw x
880 00000000 OFST: set 0
883 ; 294 return ((BitStatus)(GPIOx->IDR & (u8)GPIO_Pin));
885 007a e601 ld a,(1,x)
886 007c 1405 and a,(OFST+5,sp)
889 007e 85 popw x
890 007f 81 ret
968 ; 314 void GPIO_ExternalPullUpConfig(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef GPIO_Pin, FunctionalState NewState)
968 ; 315 {
969 switch .text
970 0080 _GPIO_ExternalPullUpConfig:
972 0080 89 pushw x
973 00000000 OFST: set 0
976 ; 317 assert_param(IS_GPIO_PIN_OK(GPIO_Pin));
978 ; 318 assert_param(IS_FUNCTIONALSTATE_OK(NewState));
980 ; 320 if (NewState != DISABLE) /* External Pull-Up Set*/
982 0081 7b06 ld a,(OFST+6,sp)
983 0083 2706 jreq L374
984 ; 322 GPIOx->CR1 |= GPIO_Pin;
986 0085 e603 ld a,(3,x)
987 0087 1a05 or a,(OFST+5,sp)
989 0089 2007 jra L574
990 008b L374:
991 ; 325 GPIOx->CR1 &= (u8)(~(GPIO_Pin));
993 008b 1e01 ldw x,(OFST+1,sp)
994 008d 7b05 ld a,(OFST+5,sp)
995 008f 43 cpl a
996 0090 e403 and a,(3,x)
997 0092 L574:
998 0092 e703 ld (3,x),a
999 ; 327 }
1002 0094 85 popw x
1003 0095 81 ret
1016 xdef _GPIO_ExternalPullUpConfig
1017 xdef _GPIO_ReadInputPin
1018 xdef _GPIO_ReadOutputData
1019 xdef _GPIO_ReadInputData
1020 xdef _GPIO_WriteReverse
1021 xdef _GPIO_WriteLow
1022 xdef _GPIO_WriteHigh
1023 xdef _GPIO_Write
1024 xdef _GPIO_Init
1025 xdef _GPIO_DeInit
1044 end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -