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

📄 stm8s_i2c.ls

📁 STM8-触摸例程
💻 LS
📖 第 1 页 / 共 3 页
字号:
1744                     ; 672   assert_param(IS_I2C_FLAG_OK(Flag));
1746                     ; 675   switch ((u16)Flag & (u16)0xF000)
1748  021f 01            	rrwa	x,a
1749  0220 9f            	ld	a,xl
1750  0221 a4f0          	and	a,#240
1751  0223 97            	ld	xl,a
1752  0224 4f            	clr	a
1753  0225 02            	rlwa	x,a
1755                     ; 723     default:
1755                     ; 724       break;
1756  0226 1d1000        	subw	x,#4096
1757  0229 270c          	jreq	L136
1758  022b 1d1000        	subw	x,#4096
1759  022e 270c          	jreq	L336
1760  0230 1d1000        	subw	x,#4096
1761  0233 2714          	jreq	L536
1762  0235 201b          	jra	L147
1763  0237               L136:
1764                     ; 679     case 0x1000:
1764                     ; 680       /* Check the status of the specified I2C flag */
1764                     ; 681       if ((I2C->SR1 & (u8)Flag) != 0)
1766  0237 c65217        	ld	a,21015
1767                     ; 684         bitstatus = SET;
1769  023a 2003          	jp	LC005
1770                     ; 689         bitstatus = RESET;
1771  023c               L336:
1772                     ; 694     case 0x2000:
1772                     ; 695       /* Check the status of the specified I2C flag */
1772                     ; 696       if ((I2C->SR2 & (u8)Flag) != 0)
1774  023c c65218        	ld	a,21016
1775  023f               LC005:
1776  023f 1503          	bcp	a,(OFST+2,sp)
1777  0241 270d          	jreq	L357
1778                     ; 699         bitstatus = SET;
1780  0243               LC004:
1783  0243 a601          	ld	a,#1
1784  0245 6b01          	ld	(OFST+0,sp),a
1786  0247 2009          	jra	L147
1787                     ; 704         bitstatus = RESET;
1788  0249               L536:
1789                     ; 709     case 0x3000:
1789                     ; 710       /* Check the status of the specified I2C flag */
1789                     ; 711       if ((I2C->SR3 & (u8)Flag) != 0)
1791  0249 c65219        	ld	a,21017
1792  024c 1503          	bcp	a,(OFST+2,sp)
1793                     ; 714         bitstatus = SET;
1795  024e 26f3          	jrne	LC004
1796  0250               L357:
1797                     ; 719         bitstatus = RESET;
1801  0250 0f01          	clr	(OFST+0,sp)
1802                     ; 723     default:
1802                     ; 724       break;
1804  0252               L147:
1805                     ; 729   return bitstatus;
1807  0252 7b01          	ld	a,(OFST+0,sp)
1810  0254 5b03          	addw	sp,#3
1811  0256 81            	ret	
1873                     ; 748 void I2C_ClearFlag(I2C_Flag_TypeDef Flag)
1873                     ; 749 {
1874                     	switch	.text
1875  0257               _I2C_ClearFlag:
1877  0257 89            	pushw	x
1878  0258 5204          	subw	sp,#4
1879       00000004      OFST:	set	4
1882                     ; 750   u8 tmp1 = 0;
1884                     ; 751   u8 tmp2 = 0;
1886                     ; 752   u16 tmp3 = 0;
1888                     ; 755   assert_param(IS_I2C_CLEAR_FLAG_OK(Flag));
1890                     ; 758   tmp3 = ((u16)Flag & (u16)0x0F00);
1892  025a 7b05          	ld	a,(OFST+1,sp)
1893  025c a40f          	and	a,#15
1894  025e 97            	ld	xl,a
1895  025f 4f            	clr	a
1896  0260 02            	rlwa	x,a
1897  0261 1f03          	ldw	(OFST-1,sp),x
1898                     ; 761   if(tmp3 == 0x0100)
1900  0263 a30100        	cpw	x,#256
1901  0266 2608          	jrne	L1101
1902                     ; 764       I2C->SR2 = (u8)(~(u8)Flag);
1904  0268 7b06          	ld	a,(OFST+2,sp)
1905  026a 43            	cpl	a
1906  026b c75218        	ld	21016,a
1908  026e 2023          	jra	L3101
1909  0270               L1101:
1910                     ; 767   else if(tmp3 == 0x0200)
1912  0270 a30200        	cpw	x,#512
1913  0273 260a          	jrne	L5101
1914                     ; 770       tmp1 = I2C->SR1;
1916  0275 c65217        	ld	a,21015
1917                     ; 772       I2C->CR2 = I2C->CR2;
1919  0278 5552115211    	mov	21009,21009
1921  027d 2014          	jra	L3101
1922  027f               L5101:
1923                     ; 775   else if(tmp3 == 0x0300)
1925  027f a30300        	cpw	x,#768
1926  0282 2608          	jrne	L1201
1927                     ; 779       tmp1 = I2C->SR1;
1929  0284 c65217        	ld	a,21015
1930                     ; 781       tmp2 = I2C->SR3;
1932  0287 c65219        	ld	a,21017
1934  028a 2007          	jra	L3101
1935  028c               L1201:
1936                     ; 788       tmp1 = I2C->SR1;
1938  028c c65217        	ld	a,21015
1939                     ; 790       tmp2 = I2C->DR;
1941  028f c65216        	ld	a,21014
1942  0292 97            	ld	xl,a
1943  0293               L3101:
1944                     ; 792 }
1947  0293 5b06          	addw	sp,#6
1948  0295 81            	ret	
2096                     ; 811 ITStatus I2C_GetITStatus(I2C_ITPendingBit_TypeDef ITPendingBit)
2096                     ; 812 {
2097                     	switch	.text
2098  0296               _I2C_GetITStatus:
2100  0296 89            	pushw	x
2101  0297 88            	push	a
2102       00000001      OFST:	set	1
2105                     ; 813     ITStatus itstatus = RESET;
2107  0298 0f01          	clr	(OFST+0,sp)
2108                     ; 816     assert_param(IS_I2C_ITPENDINGBIT_OK(ITPendingBit));
2110                     ; 819     if (((u16)ITPendingBit & 0xF000) == 0x1000) /* Returns whether the status register to check is SR1 */
2112  029a 01            	rrwa	x,a
2113  029b 9f            	ld	a,xl
2114  029c a4f0          	and	a,#240
2115  029e 97            	ld	xl,a
2116  029f 4f            	clr	a
2117  02a0 02            	rlwa	x,a
2118  02a1 a31000        	cpw	x,#4096
2119  02a4 2609          	jrne	L3011
2120                     ; 822         if ((I2C->SR1 & (u8)ITPendingBit) != 0)
2122  02a6 c65217        	ld	a,21015
2123  02a9 1503          	bcp	a,(OFST+2,sp)
2124  02ab 270d          	jreq	L3111
2125                     ; 825             itstatus = SET;
2127  02ad 2007          	jp	LC007
2128                     ; 830             itstatus = RESET;
2129  02af               L3011:
2130                     ; 836         if ((I2C->SR2 & (u8)ITPendingBit) != 0)
2132  02af c65218        	ld	a,21016
2133  02b2 1503          	bcp	a,(OFST+2,sp)
2134  02b4 2704          	jreq	L3111
2135                     ; 839             itstatus = SET;
2137  02b6               LC007:
2139  02b6 a601          	ld	a,#1
2141  02b8 2001          	jra	L1111
2142  02ba               L3111:
2143                     ; 844             itstatus = RESET;
2146  02ba 4f            	clr	a
2147  02bb               L1111:
2148                     ; 849     return itstatus;
2152  02bb 5b03          	addw	sp,#3
2153  02bd 81            	ret	
2216                     ; 868 void I2C_ClearITPendingBit(I2C_ITPendingBit_TypeDef ITPendingBit)
2216                     ; 869 {
2217                     	switch	.text
2218  02be               _I2C_ClearITPendingBit:
2220  02be 89            	pushw	x
2221  02bf 5204          	subw	sp,#4
2222       00000004      OFST:	set	4
2225                     ; 870   u8 tmp1 = 0;
2227                     ; 871   u8 tmp2 = 0;
2229                     ; 872   u16 tmp3 = 0;
2231                     ; 875   assert_param(IS_I2C_ITPENDINGBIT_OK(ITPendingBit));
2233                     ; 878   tmp3 = ((u16)ITPendingBit & (u16)0x0F00);
2235  02c1 7b05          	ld	a,(OFST+1,sp)
2236  02c3 a40f          	and	a,#15
2237  02c5 97            	ld	xl,a
2238  02c6 4f            	clr	a
2239  02c7 02            	rlwa	x,a
2240  02c8 1f03          	ldw	(OFST-1,sp),x
2241                     ; 881   if(tmp3 == 0x0100)
2243  02ca a30100        	cpw	x,#256
2244  02cd 2608          	jrne	L1511
2245                     ; 884       I2C->SR2 = (u8)(~(u8)ITPendingBit);
2247  02cf 7b06          	ld	a,(OFST+2,sp)
2248  02d1 43            	cpl	a
2249  02d2 c75218        	ld	21016,a
2251  02d5 2023          	jra	L3511
2252  02d7               L1511:
2253                     ; 887   else if(tmp3 == 0x0200)
2255  02d7 a30200        	cpw	x,#512
2256  02da 260a          	jrne	L5511
2257                     ; 890       tmp1 = I2C->SR1;
2259  02dc c65217        	ld	a,21015
2260                     ; 892       I2C->CR2 = I2C->CR2;
2262  02df 5552115211    	mov	21009,21009
2264  02e4 2014          	jra	L3511
2265  02e6               L5511:
2266                     ; 895   else if(tmp3 == 0x0300)
2268  02e6 a30300        	cpw	x,#768
2269  02e9 2608          	jrne	L1611
2270                     ; 899       tmp1 = I2C->SR1;
2272  02eb c65217        	ld	a,21015
2273                     ; 901       tmp2 = I2C->SR3;
2275  02ee c65219        	ld	a,21017
2277  02f1 2007          	jra	L3511
2278  02f3               L1611:
2279                     ; 908       tmp1 = I2C->SR1;
2281  02f3 c65217        	ld	a,21015
2282                     ; 910       tmp2 = I2C->DR;
2284  02f6 c65216        	ld	a,21014
2285  02f9 97            	ld	xl,a
2286  02fa               L3511:
2287                     ; 912 }
2290  02fa 5b06          	addw	sp,#6
2291  02fc 81            	ret	
2304                     	xdef	_I2C_ClearITPendingBit
2305                     	xdef	_I2C_GetITStatus
2306                     	xdef	_I2C_ClearFlag
2307                     	xdef	_I2C_GetFlagStatus
2308                     	xdef	_I2C_SendData
2309                     	xdef	_I2C_Send7bitAddress
2310                     	xdef	_I2C_ReceiveData
2311                     	xdef	_I2C_CheckEvent
2312                     	xdef	_I2C_ITConfig
2313                     	xdef	_I2C_FastModeDutyCycleConfig
2314                     	xdef	_I2C_AcknowledgeConfig
2315                     	xdef	_I2C_StretchClockCmd
2316                     	xdef	_I2C_SoftwareResetCmd
2317                     	xdef	_I2C_GenerateSTOP
2318                     	xdef	_I2C_GenerateSTART
2319                     	xdef	_I2C_GeneralCallCmd
2320                     	xdef	_I2C_Cmd
2321                     	xdef	_I2C_Init
2322                     	xdef	_I2C_DeInit
2323                     	xref.b	c_lreg
2324                     	xref.b	c_x
2343                     	xref	c_sdivx
2344                     	xref	c_ludv
2345                     	xref	c_rtol
2346                     	xref	c_smul
2347                     	xref	c_lmul
2348                     	xref	c_lcmp
2349                     	xref	c_ltor
2350                     	end

⌨️ 快捷键说明

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