📄 stm8l15x_tim2.ls
字号:
3053 switch .text
3054 032a _TIM2_PWMIConfig:
3056 032a 89 pushw x
3057 032b 89 pushw x
3058 00000002 OFST: set 2
3061 ; 1235 uint8_t icpolarity = TIM2_ICPolarity_Rising;
3063 ; 1236 uint8_t icselection = TIM2_ICSelection_DirectTI;
3065 ; 1239 assert_param(IS_TIM2_CHANNEL(TIM2_Channel));
3067 ; 1242 if (TIM2_ICPolarity == TIM2_ICPolarity_Rising)
3069 032c 9f ld a,xl
3070 032d 4d tnz a
3071 032e 2606 jrne L7351
3072 ; 1244 icpolarity = TIM2_ICPolarity_Falling;
3074 0330 a601 ld a,#1
3075 0332 6b01 ld (OFST-1,sp),a
3077 0334 2002 jra L1451
3078 0336 L7351:
3079 ; 1248 icpolarity = TIM2_ICPolarity_Rising;
3081 0336 0f01 clr (OFST-1,sp)
3082 0338 L1451:
3083 ; 1252 if (TIM2_ICSelection == TIM2_ICSelection_DirectTI)
3085 0338 7b07 ld a,(OFST+5,sp)
3086 033a a101 cp a,#1
3087 033c 2606 jrne L3451
3088 ; 1254 icselection = TIM2_ICSelection_IndirectTI;
3090 033e a602 ld a,#2
3091 0340 6b02 ld (OFST+0,sp),a
3093 0342 2004 jra L5451
3094 0344 L3451:
3095 ; 1258 icselection = TIM2_ICSelection_DirectTI;
3097 0344 a601 ld a,#1
3098 0346 6b02 ld (OFST+0,sp),a
3099 0348 L5451:
3100 ; 1261 if (TIM2_Channel == TIM2_Channel_1)
3102 0348 0d03 tnz (OFST+1,sp)
3103 034a 2626 jrne L7451
3104 ; 1264 TI1_Config(TIM2_ICPolarity, TIM2_ICSelection,
3104 ; 1265 TIM2_ICFilter);
3106 034c 7b09 ld a,(OFST+7,sp)
3107 034e 88 push a
3108 034f 7b08 ld a,(OFST+6,sp)
3109 0351 97 ld xl,a
3110 0352 7b05 ld a,(OFST+3,sp)
3111 0354 95 ld xh,a
3112 0355 cd060e call L3_TI1_Config
3114 0358 84 pop a
3115 ; 1268 TIM2_SetIC1Prescaler(TIM2_ICPrescaler);
3117 0359 7b08 ld a,(OFST+6,sp)
3118 035b cd03e3 call _TIM2_SetIC1Prescaler
3120 ; 1271 TI2_Config((TIM2_ICPolarity_TypeDef)icpolarity, (TIM2_ICSelection_TypeDef)icselection, TIM2_ICFilter);
3122 035e 7b09 ld a,(OFST+7,sp)
3123 0360 88 push a
3124 0361 7b03 ld a,(OFST+1,sp)
3125 0363 97 ld xl,a
3126 0364 7b02 ld a,(OFST+0,sp)
3127 0366 95 ld xh,a
3128 0367 cd064b call L5_TI2_Config
3130 036a 84 pop a
3131 ; 1274 TIM2_SetIC2Prescaler(TIM2_ICPrescaler);
3133 036b 7b08 ld a,(OFST+6,sp)
3134 036d cd03fd call _TIM2_SetIC2Prescaler
3137 0370 2022 jra L1551
3138 0372 L7451:
3139 ; 1279 TI2_Config(TIM2_ICPolarity, TIM2_ICSelection,
3139 ; 1280 TIM2_ICFilter);
3141 0372 7b09 ld a,(OFST+7,sp)
3142 0374 88 push a
3143 0375 7b08 ld a,(OFST+6,sp)
3144 0377 97 ld xl,a
3145 0378 7b05 ld a,(OFST+3,sp)
3146 037a 95 ld xh,a
3147 037b cd064b call L5_TI2_Config
3149 037e 84 pop a
3150 ; 1283 TIM2_SetIC2Prescaler(TIM2_ICPrescaler);
3152 037f 7b08 ld a,(OFST+6,sp)
3153 0381 ad7a call _TIM2_SetIC2Prescaler
3155 ; 1286 TI1_Config((TIM2_ICPolarity_TypeDef)icpolarity, (TIM2_ICSelection_TypeDef)icselection, TIM2_ICFilter);
3157 0383 7b09 ld a,(OFST+7,sp)
3158 0385 88 push a
3159 0386 7b03 ld a,(OFST+1,sp)
3160 0388 97 ld xl,a
3161 0389 7b02 ld a,(OFST+0,sp)
3162 038b 95 ld xh,a
3163 038c cd060e call L3_TI1_Config
3165 038f 84 pop a
3166 ; 1289 TIM2_SetIC1Prescaler(TIM2_ICPrescaler);
3168 0390 7b08 ld a,(OFST+6,sp)
3169 0392 ad4f call _TIM2_SetIC1Prescaler
3171 0394 L1551:
3172 ; 1291 }
3175 0394 5b04 addw sp,#4
3176 0396 81 ret
3228 ; 1298 uint16_t TIM2_GetCapture1(void)
3228 ; 1299 {
3229 switch .text
3230 0397 _TIM2_GetCapture1:
3232 0397 5204 subw sp,#4
3233 00000004 OFST: set 4
3236 ; 1300 uint16_t tmpccr1 = 0;
3238 ; 1303 tmpccr1h = TIM2->CCR1H;
3240 0399 c65261 ld a,21089
3241 039c 6b02 ld (OFST-2,sp),a
3242 ; 1304 tmpccr1l = TIM2->CCR1L;
3244 039e c65262 ld a,21090
3245 03a1 6b01 ld (OFST-3,sp),a
3246 ; 1306 tmpccr1 = (uint16_t)(tmpccr1l);
3248 03a3 7b01 ld a,(OFST-3,sp)
3249 03a5 5f clrw x
3250 03a6 97 ld xl,a
3251 03a7 1f03 ldw (OFST-1,sp),x
3252 ; 1307 tmpccr1 |= (uint16_t)((uint16_t)tmpccr1h << 8);
3254 03a9 7b02 ld a,(OFST-2,sp)
3255 03ab 5f clrw x
3256 03ac 97 ld xl,a
3257 03ad 4f clr a
3258 03ae 02 rlwa x,a
3259 03af 01 rrwa x,a
3260 03b0 1a04 or a,(OFST+0,sp)
3261 03b2 01 rrwa x,a
3262 03b3 1a03 or a,(OFST-1,sp)
3263 03b5 01 rrwa x,a
3264 03b6 1f03 ldw (OFST-1,sp),x
3265 ; 1309 return ((uint16_t)tmpccr1);
3267 03b8 1e03 ldw x,(OFST-1,sp)
3270 03ba 5b04 addw sp,#4
3271 03bc 81 ret
3323 ; 1317 uint16_t TIM2_GetCapture2(void)
3323 ; 1318 {
3324 switch .text
3325 03bd _TIM2_GetCapture2:
3327 03bd 5204 subw sp,#4
3328 00000004 OFST: set 4
3331 ; 1319 uint16_t tmpccr2 = 0;
3333 ; 1322 tmpccr2h = TIM2->CCR2H;
3335 03bf c65263 ld a,21091
3336 03c2 6b02 ld (OFST-2,sp),a
3337 ; 1323 tmpccr2l = TIM2->CCR2L;
3339 03c4 c65264 ld a,21092
3340 03c7 6b01 ld (OFST-3,sp),a
3341 ; 1325 tmpccr2 = (uint16_t)(tmpccr2l);
3343 03c9 7b01 ld a,(OFST-3,sp)
3344 03cb 5f clrw x
3345 03cc 97 ld xl,a
3346 03cd 1f03 ldw (OFST-1,sp),x
3347 ; 1326 tmpccr2 |= (uint16_t)((uint16_t)tmpccr2h << 8);
3349 03cf 7b02 ld a,(OFST-2,sp)
3350 03d1 5f clrw x
3351 03d2 97 ld xl,a
3352 03d3 4f clr a
3353 03d4 02 rlwa x,a
3354 03d5 01 rrwa x,a
3355 03d6 1a04 or a,(OFST+0,sp)
3356 03d8 01 rrwa x,a
3357 03d9 1a03 or a,(OFST-1,sp)
3358 03db 01 rrwa x,a
3359 03dc 1f03 ldw (OFST-1,sp),x
3360 ; 1328 return ((uint16_t)tmpccr2);
3362 03de 1e03 ldw x,(OFST-1,sp)
3365 03e0 5b04 addw sp,#4
3366 03e2 81 ret
3411 ; 1341 void TIM2_SetIC1Prescaler(TIM2_ICPSC_TypeDef TIM2_IC1Prescaler)
3411 ; 1342 {
3412 switch .text
3413 03e3 _TIM2_SetIC1Prescaler:
3415 03e3 88 push a
3416 03e4 88 push a
3417 00000001 OFST: set 1
3420 ; 1343 uint8_t tmpccmr1 = 0;
3422 ; 1346 assert_param(IS_TIM2_IC_PRESCALER(TIM2_IC1Prescaler));
3424 ; 1348 tmpccmr1 = TIM2->CCMR1;
3426 03e5 c65259 ld a,21081
3427 03e8 6b01 ld (OFST+0,sp),a
3428 ; 1351 tmpccmr1 &= (uint8_t)(~TIM_CCMR_ICxPSC);
3430 03ea 7b01 ld a,(OFST+0,sp)
3431 03ec a4f3 and a,#243
3432 03ee 6b01 ld (OFST+0,sp),a
3433 ; 1354 tmpccmr1 |= (uint8_t)TIM2_IC1Prescaler;
3435 03f0 7b01 ld a,(OFST+0,sp)
3436 03f2 1a02 or a,(OFST+1,sp)
3437 03f4 6b01 ld (OFST+0,sp),a
3438 ; 1356 TIM2->CCMR1 = tmpccmr1;
3440 03f6 7b01 ld a,(OFST+0,sp)
3441 03f8 c75259 ld 21081,a
3442 ; 1357 }
3445 03fb 85 popw x
3446 03fc 81 ret
3491 ; 1369 void TIM2_SetIC2Prescaler(TIM2_ICPSC_TypeDef TIM2_IC2Prescaler)
3491 ; 1370 {
3492 switch .text
3493 03fd _TIM2_SetIC2Prescaler:
3495 03fd 88 push a
3496 03fe 88 push a
3497 00000001 OFST: set 1
3500 ; 1371 uint8_t tmpccmr2 = 0;
3502 ; 1374 assert_param(IS_TIM2_IC_PRESCALER(TIM2_IC2Prescaler));
3504 ; 1376 tmpccmr2 = TIM2->CCMR2;
3506 03ff c6525a ld a,21082
3507 0402 6b01 ld (OFST+0,sp),a
3508 ; 1379 tmpccmr2 &= (uint8_t)(~TIM_CCMR_ICxPSC);
3510 0404 7b01 ld a,(OFST+0,sp)
3511 0406 a4f3 and a,#243
3512 0408 6b01 ld (OFST+0,sp),a
3513 ; 1382 tmpccmr2 |= (uint8_t)TIM2_IC2Prescaler;
3515 040a 7b01 ld a,(OFST+0,sp)
3516 040c 1a02 or a,(OFST+1,sp)
3517 040e 6b01 ld (OFST+0,sp),a
3518 ; 1384 TIM2->CCMR2 = tmpccmr2;
3520 0410 7b01 ld a,(OFST+0,sp)
3521 0412 c7525a ld 21082,a
3522 ; 1385 }
3525 0415 85 popw x
3526 0416 81 ret
3612 ; 1416 void TIM2_ITConfig(TIM2_IT_TypeDef TIM2_IT, FunctionalState NewState)
3612 ; 1417 {
3613 switch .text
3614 0417 _TIM2_ITConfig:
3616 0417 89 pushw x
3617 00000000 OFST: set 0
3620 ; 1419 assert_param(IS_TIM2_IT(TIM2_IT));
3622 ; 1420 assert_param(IS_FUNCTIONAL_STATE(NewState));
3624 ; 1422 if (NewState != DISABLE)
3626 0418 9f ld a,xl
3627 0419 4d tnz a
3628 041a 2709 jreq L3371
3629 ; 1425 TIM2->IER |= (uint8_t)TIM2_IT;
3631 041c 9e ld a,xh
3632 041d ca5255 or a,21077
3633 0420 c75255 ld 21077,a
3635 0423 2009 jra L5371
3636 0425 L3371:
3637 ; 1430 TIM2->IER &= (uint8_t)(~(uint8_t)TIM2_IT);
3639 0425 7b01 ld a,(OFST+1,sp)
3640 0427 43 cpl a
3641 0428 c45255 and a,21077
3642 042b c75255 ld 21077,a
3643 042e L5371:
3644 ; 1432 }
3647 042e 85 popw x
3648 042f 81 ret
3729 ; 1445 void TIM2_GenerateEvent(TIM2_EventSource_TypeDef TIM2_EventSource)
3729 ; 1446 {
3730 switch .text
3731 0430 _TIM2_GenerateEvent:
3735 ; 1448 assert_param(IS_TIM2_EVENT_SOURCE((uint8_t)TIM2_EventSource));
3737 ; 1451 TIM2->EGR |= (uint8_t)TIM2_EventSource;
3739 0430 ca5258 or a,21080
3740 0433 c75258 ld 21080,a
3741 ; 1452 }
3744 0436 81 ret
3883 ; 1467 FlagStatus TIM2_GetFlagStatus(TIM2_FLAG_TypeDef TIM2_FLAG)
3883 ; 1468 {
3884 switch .text
3885 0437 _TIM2_GetFlagStatus:
3887 0437 89 pushw x
3888 0438 89 pushw x
3889 00000002 OFST: set 2
3892 ; 1469 FlagStatus bitstatus = RESET;
3894 ; 1470 uint8_t tim2_flag_l = 0, tim2_flag_h = 0;
3898 ; 1473 assert_param(IS_TIM2_GET_FLAG(TIM2_FLAG));
3900 ; 1475 tim2_flag_l = (uint8_t)(TIM2->SR1 & (uint8_t)(TIM2_FLAG));
3902 0439 9f ld a,xl
3903 043a c45256 and a,21078
3904 043d 6b01 ld (OFST-1,sp),a
3905 ; 1476 tim2_flag_h = (uint8_t)(TIM2->SR2 & (uint8_t)((uint16_t)TIM2_FLAG >> 8));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -