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

📄 stm32f10x_i2c.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 5 页
字号:
    429            assert_param(IS_FUNCTIONAL_STATE(NewState));
    430          
    431            if (NewState != DISABLE)
   \                     I2C_AcknowledgeConfig:
   \   00000000   0029               CMP      R1,#+0
   \   00000002   0188               LDRH     R1,[R0, #+0]
   \   00000004   03D0               BEQ.N    ??I2C_AcknowledgeConfig_0
    432            {
    433              /* Enable the acknowledgement */
    434              I2Cx->CR1 |= CR1_ACK_Set;
   \   00000006   51F48061           ORRS     R1,R1,#0x400
   \   0000000A   0180               STRH     R1,[R0, #+0]
   \   0000000C   7047               BX       LR
    435            }
    436            else
    437            {
    438              /* Disable the acknowledgement */
    439              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]
    440            }
    441          }
   \   00000014   7047               BX       LR               ;; return
   \   00000016   00BF               Nop      
   \                     ??I2C_AcknowledgeConfig_1:
   \   00000018   FFFB0000           DC32     0xfbff
    442          
    443          /*******************************************************************************
    444          * Function Name  : I2C_OwnAddress2Config
    445          * Description    : Configures the specified I2C own address2.
    446          * Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
    447          *                  - Address: specifies the 7bit I2C own address2.
    448          * Output         : None
    449          * Return         : None.
    450          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    451          void I2C_OwnAddress2Config(I2C_TypeDef* I2Cx, u8 Address)
    452          {
    453            u16 tmpreg = 0;
    454          
    455            /* Check the parameters */
    456            assert_param(IS_I2C_ALL_PERIPH(I2Cx));
    457          
    458            /* Get the old register value */
    459            tmpreg = I2Cx->OAR2;
   \                     I2C_OwnAddress2Config:
   \   00000000   8289               LDRH     R2,[R0, #+12]
    460            /* Reset I2Cx Own address2 bit [7:1] */
    461            tmpreg &= OAR2_ADD2_Reset;
    462            /* Set I2Cx Own address2 */
    463            tmpreg |= (u16)(Address & (u16)0x00FE);
    464            /* Store the new register value */
    465            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]
    466          }
   \   0000000E   7047               BX       LR               ;; return
   \                     ??I2C_OwnAddress2Config_0:
   \   00000010   01FF0000           DC32     0xff01
    467          
    468          /*******************************************************************************
    469          * Function Name  : I2C_DualAddressCmd
    470          * Description    : Enables or disables the specified I2C dual addressing mode.
    471          * Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
    472          *                  - NewState: new state of the I2C dual addressing mode.
    473          *                    This parameter can be: ENABLE or DISABLE.
    474          * Output         : None
    475          * Return         : None
    476          *******************************************************************************/

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

   \                                 In segment CODE, align 4, keep-with-next
    504          void I2C_GeneralCallCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
    505          {
    506            /* Check the parameters */
    507            assert_param(IS_I2C_ALL_PERIPH(I2Cx));
    508            assert_param(IS_FUNCTIONAL_STATE(NewState));
    509          
    510            if (NewState != DISABLE)
   \                     I2C_GeneralCallCmd:
   \   00000000   0029               CMP      R1,#+0
   \   00000002   0188               LDRH     R1,[R0, #+0]
   \   00000004   03D0               BEQ.N    ??I2C_GeneralCallCmd_0
    511            {
    512              /* Enable generall call */
    513              I2Cx->CR1 |= CR1_ENGC_Set;
   \   00000006   51F04001           ORRS     R1,R1,#0x40
   \   0000000A   0180               STRH     R1,[R0, #+0]
   \   0000000C   7047               BX       LR
    514            }
    515            else
    516            {
    517              /* Disable generall call */
    518              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]
    519            }
    520          }
   \   00000014   7047               BX       LR               ;; return
   \   00000016   00BF               Nop      
   \                     ??I2C_GeneralCallCmd_1:
   \   00000018   BFFF0000           DC32     0xffbf
    521          
    522          /*******************************************************************************
    523          * Function Name  : I2C_ITConfig
    524          * Description    : Enables or disables the specified I2C interrupts.
    525          * Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
    526          *                  - I2C_IT: specifies the I2C interrupts sources to be enabled
    527          *                    or disabled. 
    528          *                    This parameter can be any combination of the following values:
    529          *                       - I2C_IT_BUF: Buffer interrupt mask
    530          *                       - I2C_IT_EVT: Event interrupt mask
    531          *                       - I2C_IT_ERR: Error interrupt mask
    532          *                  - NewState: new state of the specified I2C interrupts.
    533          *                    This parameter can be: ENABLE or DISABLE.
    534          * Output         : None
    535          * Return         : None
    536          *******************************************************************************/

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

   \                                 In segment CODE, align 4, keep-with-next
    564          void I2C_SendData(I2C_TypeDef* I2Cx, u8 Data)
    565          {
    566            /* Check the parameters */
    567            assert_param(IS_I2C_ALL_PERIPH(I2Cx));
    568          
    569            /* Write in the DR register the data to be sent */
    570            I2Cx->DR = Data;
   \                     I2C_SendData:
   \   00000000   0182               STRH     R1,[R0, #+16]
    571          }
   \   00000002   7047               BX       LR               ;; return
    572          
    573          /*******************************************************************************
    574          * Function Name  : I2C_ReceiveData
    575          * Description    : Returns the most recent received data by the I2Cx peripheral.
    576          * Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
    577          * Output         : None
    578          * Return         : The value of the received data.
    579          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    580          u8 I2C_ReceiveData(I2C_TypeDef* I2Cx)
    581          {
    582            /* Check the parameters */
    583            assert_param(IS_I2C_ALL_PERIPH(I2Cx));

⌨️ 快捷键说明

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