📄 stm32f10x_i2c.lst
字号:
409 * - NewState: new state of the I2C Acknowledgement.
410 * This parameter can be: ENABLE or DISABLE.
411 * Output : None
412 * Return : None.
413 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
414 void I2C_AcknowledgeConfig(I2C_TypeDef* I2Cx, FunctionalState NewState)
415 {
416 /* Check the parameters */
417 assert_param(IS_FUNCTIONAL_STATE(NewState));
418
419 if (NewState != DISABLE)
\ I2C_AcknowledgeConfig:
\ 00000000 C9B2 UXTB R1,R1 ;; ZeroExtS R1,R1,#+24,#+24
\ 00000002 0029 CMP R1,#+0
\ 00000004 04D0 BEQ.N ??I2C_AcknowledgeConfig_0
420 {
421 /* Enable the acknowledgement */
422 I2Cx->CR1 |= CR1_ACK_Set;
\ 00000006 0288 LDRH R2,[R0, #+0]
\ 00000008 52F48062 ORRS R2,R2,#0x400
\ 0000000C 0280 STRH R2,[R0, #+0]
\ 0000000E 03E0 B.N ??I2C_AcknowledgeConfig_1
423 }
424 else
425 {
426 /* Disable the acknowledgement */
427 I2Cx->CR1 &= CR1_ACK_Reset;
\ ??I2C_AcknowledgeConfig_0:
\ 00000010 0288 LDRH R2,[R0, #+0]
\ 00000012 024B LDR.N R3,??I2C_AcknowledgeConfig_2 ;; 0xfbff
\ 00000014 1340 ANDS R3,R3,R2
\ 00000016 0380 STRH R3,[R0, #+0]
428 }
429 }
\ ??I2C_AcknowledgeConfig_1:
\ 00000018 7047 BX LR ;; return
\ 0000001A 00BF Nop
\ ??I2C_AcknowledgeConfig_2:
\ 0000001C FFFB0000 DC32 0xfbff
430
431 /*******************************************************************************
432 * Function Name : I2C_OwnAddress2Config
433 * Description : Configures the specified I2C own address2.
434 * Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
435 * - Address: specifies the 7bit I2C own address2.
436 * Output : None
437 * Return : None.
438 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
439 void I2C_OwnAddress2Config(I2C_TypeDef* I2Cx, u8 Address)
440 {
441 u16 tmpreg = 0;
\ I2C_OwnAddress2Config:
\ 00000000 0023 MOVS R3,#+0
\ 00000002 1A00 MOVS R2,R3
442
443 /* Get the old register value */
444 tmpreg = I2Cx->OAR2;
\ 00000004 8389 LDRH R3,[R0, #+12]
\ 00000006 1A00 MOVS R2,R3
445 /* Reset I2Cx Own address2 bit [7:1] */
446 tmpreg &= OAR2_ADD2_Reset;
\ 00000008 1300 MOVS R3,R2
\ 0000000A 044A LDR.N R2,??I2C_OwnAddress2Config_0 ;; 0xff01
\ 0000000C 1A40 ANDS R2,R2,R3
447 /* Set I2Cx Own address2 */
448 tmpreg |= (u16)(Address & (u16)0x00FE);
\ 0000000E 1300 MOVS R3,R2
\ 00000010 C9B2 UXTB R1,R1 ;; ZeroExtS R1,R1,#+24,#+24
\ 00000012 11F0FE02 ANDS R2,R1,#0xFE
\ 00000016 1A43 ORRS R2,R2,R3
449 /* Store the new register value */
450 I2Cx->OAR2 = tmpreg;
\ 00000018 8281 STRH R2,[R0, #+12]
451 }
\ 0000001A 7047 BX LR ;; return
\ ??I2C_OwnAddress2Config_0:
\ 0000001C 01FF0000 DC32 0xff01
452
453 /*******************************************************************************
454 * Function Name : I2C_DualAddressCmd
455 * Description : Enables or disables the specified I2C dual addressing mode.
456 * Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
457 * - NewState: new state of the I2C dual addressing mode.
458 * This parameter can be: ENABLE or DISABLE.
459 * Output : None
460 * Return : None
461 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
462 void I2C_DualAddressCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
463 {
464 /* Check the parameters */
465 assert_param(IS_FUNCTIONAL_STATE(NewState));
466
467 if (NewState != DISABLE)
\ I2C_DualAddressCmd:
\ 00000000 C9B2 UXTB R1,R1 ;; ZeroExtS R1,R1,#+24,#+24
\ 00000002 0029 CMP R1,#+0
\ 00000004 04D0 BEQ.N ??I2C_DualAddressCmd_0
468 {
469 /* Enable dual addressing mode */
470 I2Cx->OAR2 |= OAR2_ENDUAL_Set;
\ 00000006 8289 LDRH R2,[R0, #+12]
\ 00000008 52F00102 ORRS R2,R2,#0x1
\ 0000000C 8281 STRH R2,[R0, #+12]
\ 0000000E 03E0 B.N ??I2C_DualAddressCmd_1
471 }
472 else
473 {
474 /* Disable dual addressing mode */
475 I2Cx->OAR2 &= OAR2_ENDUAL_Reset;
\ ??I2C_DualAddressCmd_0:
\ 00000010 8289 LDRH R2,[R0, #+12]
\ 00000012 .... LDR.N R3,??DataTable5 ;; 0xfffe
\ 00000014 1340 ANDS R3,R3,R2
\ 00000016 8381 STRH R3,[R0, #+12]
476 }
477 }
\ ??I2C_DualAddressCmd_1:
\ 00000018 7047 BX LR ;; return
478
479 /*******************************************************************************
480 * Function Name : I2C_GeneralCallCmd
481 * Description : Enables or disables the specified I2C general call feature.
482 * Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
483 * - NewState: new state of the I2C General call.
484 * This parameter can be: ENABLE or DISABLE.
485 * Output : None
486 * Return : None
487 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
488 void I2C_GeneralCallCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
489 {
490 /* Check the parameters */
491 assert_param(IS_FUNCTIONAL_STATE(NewState));
492
493 if (NewState != DISABLE)
\ I2C_GeneralCallCmd:
\ 00000000 C9B2 UXTB R1,R1 ;; ZeroExtS R1,R1,#+24,#+24
\ 00000002 0029 CMP R1,#+0
\ 00000004 04D0 BEQ.N ??I2C_GeneralCallCmd_0
494 {
495 /* Enable generall call */
496 I2Cx->CR1 |= CR1_ENGC_Set;
\ 00000006 0288 LDRH R2,[R0, #+0]
\ 00000008 52F04002 ORRS R2,R2,#0x40
\ 0000000C 0280 STRH R2,[R0, #+0]
\ 0000000E 03E0 B.N ??I2C_GeneralCallCmd_1
497 }
498 else
499 {
500 /* Disable generall call */
501 I2Cx->CR1 &= CR1_ENGC_Reset;
\ ??I2C_GeneralCallCmd_0:
\ 00000010 0288 LDRH R2,[R0, #+0]
\ 00000012 024B LDR.N R3,??I2C_GeneralCallCmd_2 ;; 0xffbf
\ 00000014 1340 ANDS R3,R3,R2
\ 00000016 0380 STRH R3,[R0, #+0]
502 }
503 }
\ ??I2C_GeneralCallCmd_1:
\ 00000018 7047 BX LR ;; return
\ 0000001A 00BF Nop
\ ??I2C_GeneralCallCmd_2:
\ 0000001C BFFF0000 DC32 0xffbf
504
505 /*******************************************************************************
506 * Function Name : I2C_ITConfig
507 * Description : Enables or disables the specified I2C interrupts.
508 * Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
509 * - I2C_IT: specifies the I2C interrupts sources to be enabled
510 * or disabled.
511 * This parameter can be any combination of the following values:
512 * - I2C_IT_BUF: Buffer interrupt mask
513 * - I2C_IT_EVT: Event interrupt mask
514 * - I2C_IT_ERR: Error interrupt mask
515 * - NewState: new state of the specified I2C interrupts.
516 * This parameter can be: ENABLE or DISABLE.
517 * Output : None
518 * Return : None
519 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
520 void I2C_ITConfig(I2C_TypeDef* I2Cx, u16 I2C_IT, FunctionalState NewState)
521 {
522 /* Check the parameters */
523 assert_param(IS_FUNCTIONAL_STATE(NewState));
524 assert_param(IS_I2C_CONFIG_IT(I2C_IT));
525
526 if (NewState != DISABLE)
\ I2C_ITConfig:
\ 00000000 D2B2 UXTB R2,R2 ;; ZeroExtS R2,R2,#+24,#+24
\ 00000002 002A CMP R2,#+0
\ 00000004 03D0 BEQ.N ??I2C_ITConfig_0
527 {
528 /* Enable the selected I2C interrupts */
529 I2Cx->CR2 |= I2C_IT;
\ 00000006 8388 LDRH R3,[R0, #+4]
\ 00000008 0B43 ORRS R3,R3,R1
\ 0000000A 8380 STRH R3,[R0, #+4]
\ 0000000C 02E0 B.N ??I2C_ITConfig_1
530 }
531 else
532 {
533 /* Disable the selected I2C interrupts */
534 I2Cx->CR2 &= (u16)~I2C_IT;
\ ??I2C_ITConfig_0:
\ 0000000E 8388 LDRH R3,[R0, #+4]
\ 00000010 8B43 BICS R3,R3,R1
\ 00000012 8380 STRH R3,[R0, #+4]
535 }
536 }
\ ??I2C_ITConfig_1:
\ 00000014 7047 BX LR ;; return
537
538 /*******************************************************************************
539 * Function Name : I2C_SendData
540 * Description : Sends a data byte through the I2Cx peripheral.
541 * Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
542 * - Data: Byte to be transmitted..
543 * Output : None
544 * Return : None
545 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
546 void I2C_SendData(I2C_TypeDef* I2Cx, u8 Data)
547 {
548 /* Write in the DR register the data to be sent */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -