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

📄 stm32f10x_gpio.txt

📁 STM32+ov7670
💻 TXT
📖 第 1 页 / 共 3 页
字号:
000150  f1bc0f48          CMP      r12,#0x48
000154  d105              BNE      |L1.354|
;;;176              {
;;;177                GPIOx->BSRR = (((u32)0x01) << pinpos);
000156  f04f0c01          MOV      r12,#1
00015a  fa0cfc00          LSL      r12,r12,r0
00015e  f8c2c010          STR      r12,[r2,#0x10]
                  |L1.354|
000162  1c40              ADDS     r0,r0,#1              ;151
                  |L1.356|
000164  2808              CMP      r0,#8                 ;151
000166  d3d1              BCC      |L1.268|
;;;178              }
;;;179            }
;;;180          }
;;;181        }
;;;182        GPIOx->CRL = tmpreg;
000168  6014              STR      r4,[r2,#0]
                  |L1.362|
;;;183      }
;;;184    
;;;185    /*---------------------------- GPIO CRH Configuration ------------------------*/
;;;186      /* Configure the eight high port pins */
;;;187      if (GPIO_InitStruct->GPIO_Pin > 0x00FF)
00016a  f8b1c000          LDRH     r12,[r1,#0]
00016e  f1bc0fff          CMP      r12,#0xff
000172  dd34              BLE      |L1.478|
;;;188      {
;;;189        tmpreg = GPIOx->CRH;
000174  6854              LDR      r4,[r2,#4]
;;;190        for (pinpos = 0x00; pinpos < 0x08; pinpos++)
000176  2000              MOVS     r0,#0
000178  e02e              B        |L1.472|
                  |L1.378|
;;;191        {
;;;192          pos = (((u32)0x01) << (pinpos + 0x08));
00017a  f1000c08          ADD      r12,r0,#8
00017e  f04f0801          MOV      r8,#1
000182  fa08f30c          LSL      r3,r8,r12
;;;193          /* Get the port pins position */
;;;194          currentpin = ((GPIO_InitStruct->GPIO_Pin) & pos);
000186  f8b1c000          LDRH     r12,[r1,#0]
00018a  ea0c0603          AND      r6,r12,r3
;;;195          if (currentpin == pos)
00018e  429e              CMP      r6,r3
000190  d121              BNE      |L1.470|
;;;196          {
;;;197            pos = pinpos << 2;
000192  0083              LSLS     r3,r0,#2
;;;198            /* Clear the corresponding high control register bits */
;;;199            pinmask = ((u32)0x0F) << pos;
000194  f04f0c0f          MOV      r12,#0xf
000198  fa0cf703          LSL      r7,r12,r3
;;;200            tmpreg &= ~pinmask;
00019c  43bc              BICS     r4,r4,r7
;;;201    
;;;202            /* Write the mode configuration in the corresponding bits */
;;;203            tmpreg |= (currentmode << pos);
00019e  fa05fc03          LSL      r12,r5,r3
0001a2  ea4c0404          ORR      r4,r12,r4
;;;204    
;;;205            /* Reset the corresponding ODR bit */
;;;206            if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
0001a6  f891c003          LDRB     r12,[r1,#3]
0001aa  f1bc0f28          CMP      r12,#0x28
0001ae  d105              BNE      |L1.444|
;;;207            {
;;;208              GPIOx->BRR = (((u32)0x01) << (pinpos + 0x08));
0001b0  f1000c08          ADD      r12,r0,#8
0001b4  fa08f80c          LSL      r8,r8,r12
0001b8  f8c28014          STR      r8,[r2,#0x14]
                  |L1.444|
;;;209            }
;;;210            /* Set the corresponding ODR bit */
;;;211            if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
0001bc  f891c003          LDRB     r12,[r1,#3]
0001c0  f1bc0f48          CMP      r12,#0x48
0001c4  d107              BNE      |L1.470|
;;;212            {
;;;213              GPIOx->BSRR = (((u32)0x01) << (pinpos + 0x08));
0001c6  f1000c08          ADD      r12,r0,#8
0001ca  f04f0801          MOV      r8,#1
0001ce  fa08f80c          LSL      r8,r8,r12
0001d2  f8c28010          STR      r8,[r2,#0x10]
                  |L1.470|
0001d6  1c40              ADDS     r0,r0,#1              ;190
                  |L1.472|
0001d8  2808              CMP      r0,#8                 ;190
0001da  d3ce              BCC      |L1.378|
;;;214            }
;;;215          }
;;;216        }
;;;217        GPIOx->CRH = tmpreg;
0001dc  6054              STR      r4,[r2,#4]
                  |L1.478|
;;;218      }
;;;219    }
0001de  e8bd81f0          POP      {r4-r8,pc}
;;;220    
                          ENDP

                  GPIO_StructInit PROC
;;;228    *******************************************************************************/
;;;229    void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
0001e2  f64f71ff          MOV      r1,#0xffff
;;;230    {
;;;231      /* Reset GPIO init structure parameters values */
;;;232      GPIO_InitStruct->GPIO_Pin  = GPIO_Pin_All;
0001e6  8001              STRH     r1,[r0,#0]
;;;233      GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz;
0001e8  2102              MOVS     r1,#2
0001ea  7081              STRB     r1,[r0,#2]
;;;234      GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN_FLOATING;
0001ec  2104              MOVS     r1,#4
0001ee  70c1              STRB     r1,[r0,#3]
;;;235    }
0001f0  4770              BX       lr
;;;236    
                          ENDP

                  GPIO_ReadInputDataBit PROC
;;;245    *******************************************************************************/
;;;246    u8 GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
0001f2  4602              MOV      r2,r0
;;;247    {
;;;248      u8 bitstatus = 0x00;
0001f4  2000              MOVS     r0,#0
;;;249      
;;;250      /* Check the parameters */
;;;251      assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
;;;252      assert_param(IS_GET_GPIO_PIN(GPIO_Pin)); 
;;;253      
;;;254      if ((GPIOx->IDR & GPIO_Pin) != (u32)Bit_RESET)
0001f6  6893              LDR      r3,[r2,#8]
0001f8  420b              TST      r3,r1
0001fa  d001              BEQ      |L1.512|
;;;255      {
;;;256        bitstatus = (u8)Bit_SET;
0001fc  2001              MOVS     r0,#1
0001fe  e000              B        |L1.514|
                  |L1.512|
;;;257      }
;;;258      else
;;;259      {
;;;260        bitstatus = (u8)Bit_RESET;
000200  2000              MOVS     r0,#0
                  |L1.514|
;;;261      }
;;;262      return bitstatus;
;;;263    }
000202  4770              BX       lr
;;;264    
                          ENDP

                  GPIO_ReadInputData PROC
;;;271    *******************************************************************************/
;;;272    u16 GPIO_ReadInputData(GPIO_TypeDef* GPIOx)
000204  4601              MOV      r1,r0
;;;273    {
;;;274      /* Check the parameters */
;;;275      assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
;;;276      
;;;277      return ((u16)GPIOx->IDR);
000206  6888              LDR      r0,[r1,#8]
000208  b280              UXTH     r0,r0
;;;278    }
00020a  4770              BX       lr
;;;279    
                          ENDP

                  GPIO_ReadOutputDataBit PROC
;;;288    *******************************************************************************/
;;;289    u8 GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
00020c  4602              MOV      r2,r0
;;;290    {
;;;291      u8 bitstatus = 0x00;
00020e  2000              MOVS     r0,#0
;;;292    
;;;293      /* Check the parameters */
;;;294      assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
;;;295      assert_param(IS_GET_GPIO_PIN(GPIO_Pin)); 
;;;296      
;;;297      if ((GPIOx->ODR & GPIO_Pin) != (u32)Bit_RESET)
000210  68d3              LDR      r3,[r2,#0xc]
000212  420b              TST      r3,r1
000214  d001              BEQ      |L1.538|
;;;298      {
;;;299        bitstatus = (u8)Bit_SET;
000216  2001              MOVS     r0,#1
000218  e000              B        |L1.540|
                  |L1.538|
;;;300      }
;;;301      else
;;;302      {
;;;303        bitstatus = (u8)Bit_RESET;
00021a  2000              MOVS     r0,#0
                  |L1.540|
;;;304      }
;;;305      return bitstatus;
;;;306    }
00021c  4770              BX       lr
;;;307    
                          ENDP

                  GPIO_ReadOutputData PROC
;;;314    *******************************************************************************/
;;;315    u16 GPIO_ReadOutputData(GPIO_TypeDef* GPIOx)
00021e  4601              MOV      r1,r0
;;;316    {
;;;317      /* Check the parameters */
;;;318      assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
;;;319        
;;;320      return ((u16)GPIOx->ODR);
000220  68c8              LDR      r0,[r1,#0xc]
000222  b280              UXTH     r0,r0
;;;321    }
000224  4770              BX       lr
;;;322    
                          ENDP

                  GPIO_SetBits PROC
;;;332    *******************************************************************************/
;;;333    void GPIO_SetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
000226  6101              STR      r1,[r0,#0x10]
;;;334    {
;;;335      /* Check the parameters */
;;;336      assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
;;;337      assert_param(IS_GPIO_PIN(GPIO_Pin));
;;;338      
;;;339      GPIOx->BSRR = GPIO_Pin;
;;;340    }
000228  4770              BX       lr
;;;341    
                          ENDP

                  GPIO_ResetBits PROC
;;;351    *******************************************************************************/
;;;352    void GPIO_ResetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
00022a  6141              STR      r1,[r0,#0x14]
;;;353    {
;;;354      /* Check the parameters */
;;;355      assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
;;;356      assert_param(IS_GPIO_PIN(GPIO_Pin));
;;;357      
;;;358      GPIOx->BRR = GPIO_Pin;
;;;359    }
00022c  4770              BX       lr
;;;360    
                          ENDP

                  GPIO_WriteBit PROC
;;;373    *******************************************************************************/
;;;374    void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin, BitAction BitVal)
00022e  b10a              CBZ      r2,|L1.564|
;;;375    {
;;;376      /* Check the parameters */
;;;377      assert_param(IS_GPIO_ALL_PERIPH(GPIOx));

⌨️ 快捷键说明

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