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

📄 stm32f10x_i2c.lst

📁 针对STM32F103的UCOS移植
💻 LST
📖 第 1 页 / 共 5 页
字号:
    426              /* Enable the acknowledgement */
    427              I2Cx->CR1 |= CR1_ACK_Set;
   \   00000006   51F48061           ORRS     R1,R1,#0x400
   \   0000000A   0180               STRH     R1,[R0, #+0]
   \   0000000C   7047               BX       LR
    428            }
    429            else
    430            {
    431              /* Disable the acknowledgement */
    432              I2Cx->CR1 &= CR1_ACK_Reset;
   \                     ??I2C_AcknowledgeConfig_0:
   \   0000000E   024A               LDR.N    R2,??I2C_AcknowledgeConfig_1  ;; 0xfbff
   \   00000010   0A40               ANDS     R2,R2,R1
   \   00000012   0280               STRH     R2,[R0, #+0]
    433            }
    434          }
   \   00000014   7047               BX       LR               ;; return
   \   00000016   00BF               Nop      
   \                     ??I2C_AcknowledgeConfig_1:
   \   00000018   FFFB0000           DC32     0xfbff
    435          
    436          /*******************************************************************************
    437          * Function Name  : I2C_OwnAddress2Config
    438          * Description    : Configures the specified I2C own address2.
    439          * Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
    440          *                  - Address: specifies the 7bit I2C own address2.
    441          * Output         : None
    442          * Return         : None.
    443          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    444          void I2C_OwnAddress2Config(I2C_TypeDef* I2Cx, u8 Address)
    445          {
    446            u16 tmpreg = 0;
    447          
    448            /* Get the old register value */
    449            tmpreg = I2Cx->OAR2;
   \                     I2C_OwnAddress2Config:
   \   00000000   8289               LDRH     R2,[R0, #+12]
    450            /* Reset I2Cx Own address2 bit [7:1] */
    451            tmpreg &= OAR2_ADD2_Reset;
    452            /* Set I2Cx Own address2 */
    453            tmpreg |= (u16)(Address & (u16)0x00FE);
    454            /* Store the new register value */
    455            I2Cx->OAR2 = tmpreg;
   \   00000002   034B               LDR.N    R3,??I2C_OwnAddress2Config_0  ;; 0xff01
   \   00000004   1340               ANDS     R3,R3,R2
   \   00000006   11F0FE01           ANDS     R1,R1,#0xFE
   \   0000000A   1943               ORRS     R1,R1,R3
   \   0000000C   8181               STRH     R1,[R0, #+12]
    456          }
   \   0000000E   7047               BX       LR               ;; return
   \                     ??I2C_OwnAddress2Config_0:
   \   00000010   01FF0000           DC32     0xff01
    457          
    458          /*******************************************************************************
    459          * Function Name  : I2C_DualAddressCmd
    460          * Description    : Enables or disables the specified I2C dual addressing mode.
    461          * Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
    462          *                  - NewState: new state of the I2C dual addressing mode.
    463          *                    This parameter can be: ENABLE or DISABLE.
    464          * Output         : None
    465          * Return         : None
    466          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    467          void I2C_DualAddressCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
    468          {
    469            /* Check the parameters */
    470            assert(IS_FUNCTIONAL_STATE(NewState));
    471          
    472            if (NewState != DISABLE)
   \                     I2C_DualAddressCmd:
   \   00000000   0029               CMP      R1,#+0
   \   00000002   8189               LDRH     R1,[R0, #+12]
   \   00000004   03D0               BEQ.N    ??I2C_DualAddressCmd_0
    473            {
    474              /* Enable dual addressing mode */
    475              I2Cx->OAR2 |= OAR2_ENDUAL_Set;
   \   00000006   51F00101           ORRS     R1,R1,#0x1
   \   0000000A   8181               STRH     R1,[R0, #+12]
   \   0000000C   7047               BX       LR
    476            }
    477            else
    478            {
    479              /* Disable dual addressing mode */
    480              I2Cx->OAR2 &= OAR2_ENDUAL_Reset;
   \                     ??I2C_DualAddressCmd_0:
   \   0000000E   ....               LDR.N    R2,??DataTable5  ;; 0xfffe
   \   00000010   0A40               ANDS     R2,R2,R1
   \   00000012   8281               STRH     R2,[R0, #+12]
    481            }
    482          }
   \   00000014   7047               BX       LR               ;; return
    483          
    484          /*******************************************************************************
    485          * Function Name  : I2C_GeneralCallCmd
    486          * Description    : Enables or disables the specified I2C general call feature.
    487          * Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
    488          *                  - NewState: new state of the I2C General call.
    489          *                    This parameter can be: ENABLE or DISABLE.
    490          * Output         : None
    491          * Return         : None
    492          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    493          void I2C_GeneralCallCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
    494          {
    495            /* Check the parameters */
    496            assert(IS_FUNCTIONAL_STATE(NewState));
    497          
    498            if (NewState != DISABLE)
   \                     I2C_GeneralCallCmd:
   \   00000000   0029               CMP      R1,#+0
   \   00000002   0188               LDRH     R1,[R0, #+0]
   \   00000004   03D0               BEQ.N    ??I2C_GeneralCallCmd_0
    499            {
    500              /* Enable generall call */
    501              I2Cx->CR1 |= CR1_ENGC_Set;
   \   00000006   51F04001           ORRS     R1,R1,#0x40
   \   0000000A   0180               STRH     R1,[R0, #+0]
   \   0000000C   7047               BX       LR
    502            }
    503            else
    504            {
    505              /* Disable generall call */
    506              I2Cx->CR1 &= CR1_ENGC_Reset;
   \                     ??I2C_GeneralCallCmd_0:
   \   0000000E   024A               LDR.N    R2,??I2C_GeneralCallCmd_1  ;; 0xffbf
   \   00000010   0A40               ANDS     R2,R2,R1
   \   00000012   0280               STRH     R2,[R0, #+0]
    507            }
    508          }
   \   00000014   7047               BX       LR               ;; return
   \   00000016   00BF               Nop      
   \                     ??I2C_GeneralCallCmd_1:
   \   00000018   BFFF0000           DC32     0xffbf
    509          
    510          /*******************************************************************************
    511          * Function Name  : I2C_ITConfig
    512          * Description    : Enables or disables the specified I2C interrupts.
    513          * Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
    514          *                  - I2C_IT: specifies the I2C interrupts sources to be enabled
    515          *                    or disabled. 
    516          *                    This parameter can be any combination of the following values:
    517          *                       - I2C_IT_BUF: Buffer interrupt mask
    518          *                       - I2C_IT_EVT: Event interrupt mask
    519          *                       - I2C_IT_ERR: Error interrupt mask
    520          *                  - NewState: new state of the specified I2C interrupts.
    521          *                    This parameter can be: ENABLE or DISABLE.
    522          * Output         : None
    523          * Return         : None
    524          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    525          void I2C_ITConfig(I2C_TypeDef* I2Cx, u16 I2C_IT, FunctionalState NewState)
    526          {
    527            /* Check the parameters */
    528            assert(IS_FUNCTIONAL_STATE(NewState));
    529            assert(IS_I2C_CONFIG_IT(I2C_IT));
    530            
    531            if (NewState != DISABLE)
   \                     I2C_ITConfig:
   \   00000000   002A               CMP      R2,#+0
   \   00000002   8288               LDRH     R2,[R0, #+4]
   \   00000004   02D0               BEQ.N    ??I2C_ITConfig_0
    532            {
    533              /* Enable the selected I2C interrupts */
    534              I2Cx->CR2 |= I2C_IT;
   \   00000006   1143               ORRS     R1,R1,R2
   \   00000008   8180               STRH     R1,[R0, #+4]
   \   0000000A   7047               BX       LR
    535            }
    536            else
    537            {
    538              /* Disable the selected I2C interrupts */
    539              I2Cx->CR2 &= (u16)~I2C_IT;
   \                     ??I2C_ITConfig_0:
   \   0000000C   8A43               BICS     R2,R2,R1
   \   0000000E   8280               STRH     R2,[R0, #+4]
    540            }
    541          }
   \   00000010   7047               BX       LR               ;; return
    542          
    543          /*******************************************************************************
    544          * Function Name  : I2C_SendData
    545          * Description    : Sends a data byte through the I2Cx peripheral.
    546          * Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
    547          *                  - Data: Byte to be transmitted..
    548          * Output         : None
    549          * Return         : None
    550          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    551          void I2C_SendData(I2C_TypeDef* I2Cx, u8 Data)
    552          {
    553            /* Write in the DR register the data to be sent */
    554            I2Cx->DR = Data;
   \                     I2C_SendData:
   \   00000000   0182               STRH     R1,[R0, #+16]
    555          }
   \   00000002   7047               BX       LR               ;; return
    556          
    557          /*******************************************************************************
    558          * Function Name  : I2C_ReceiveData
    559          * Description    : Returns the most recent received data by the I2Cx peripheral.
    560          * Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
    561          * Output         : None
    562          * Return         : The value of the received data.
    563          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    564          u8 I2C_ReceiveData(I2C_TypeDef* I2Cx)
    565          {
    566            /* Return the data in the DR register */
    567            return (u8)I2Cx->DR;
   \                     I2C_ReceiveData:
   \   00000000   008A               LDRH     R0,[R0, #+16]
   \   00000002   C0B2               UXTB     R0,R0
   \   00000004   7047               BX       LR               ;; return
    568          }
    569          
    570          /*******************************************************************************
    571          * Function Name  : I2C_Send7bitAddress
    572          * Description    : Transmits the address byte to select the slave device.
    573          * Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
    574          *                  - Address: specifies the slave address which will be transmitted
    575          *                  - I2C_Direction: specifies whether the I2C device will be a
    576          *                    Transmitter or a Receiver. 
    577          *                    This parameter can be one of the following values
    578          *                       - I2C_Direction_Transmitter: Transmitter mode
    579          *                       - I2C_Direction_Receiver: Receiver mode
    580          * Output         : None

⌨️ 快捷键说明

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