mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-22 17:12:55 +08:00
379 lines
16 KiB
C
379 lines
16 KiB
C
/******************************************************************************************************************************************
|
||
* <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>: SWM320_gpio.c
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: SWM320<32><30>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* <20><><EFBFBD><EFBFBD>֧<EFBFBD><D6A7>: http://www.synwit.com.cn/e/tool/gbook/?bid=1
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||
* <20>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>: V1.1.0 2017<31><37>10<31><30>25<32><35>
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼:
|
||
*
|
||
*
|
||
*******************************************************************************************************************************************
|
||
* @attention
|
||
*
|
||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION
|
||
* REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, SYNWIT SHALL NOT BE HELD LIABLE
|
||
* FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
|
||
* OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONN-
|
||
* -ECTION WITH THEIR PRODUCTS.
|
||
*
|
||
* COPYRIGHT 2012 Synwit Technology
|
||
*******************************************************************************************************************************************/
|
||
#include "SWM320.h"
|
||
#include "SWM320_gpio.h"
|
||
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_Init()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <09><><EFBFBD>ų<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>衢<EFBFBD><E8A1A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>衢<EFBFBD><E8A1A2>©<EFBFBD><C2A9><EFBFBD><EFBFBD>
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOM<4F><4D>GPION<4F><4E>GPIOP
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN22<32><32>PIN23
|
||
* uint32_t dir <20><><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD>0 <20><><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD>
|
||
* uint32_t pull_up <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>裬0 <20>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* uint32_t pull_down <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>裬0 <20>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIOA<4F><41>GPIOC<4F><43>GPIOM<4F><4D>GPIOPֻ<50><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GPIOB<4F><42>GPIONֻ<4E><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_Init(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t dir, uint32_t pull_up, uint32_t pull_down)
|
||
{
|
||
switch((uint32_t)GPIOx)
|
||
{
|
||
case ((uint32_t)GPIOA):
|
||
SYS->CLKEN |= (0x01 << SYS_CLKEN_GPIOA_Pos);
|
||
|
||
PORT_Init(PORTA, n, 0, 1); //PORTA.PINn<4E><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪGPIO<49><4F><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뿪<EFBFBD><EBBFAA>
|
||
if(dir == 1)
|
||
{
|
||
GPIOA->DIR |= (0x01 << n);
|
||
}
|
||
else
|
||
{
|
||
GPIOA->DIR &= ~(0x01 << n);
|
||
}
|
||
|
||
if(pull_up == 1)
|
||
PORT->PORTA_PULLU |= (0x01 << n);
|
||
else
|
||
PORT->PORTA_PULLU &= ~(0x01 << n);
|
||
break;
|
||
|
||
case ((uint32_t)GPIOB):
|
||
SYS->CLKEN |= (0x01 << SYS_CLKEN_GPIOB_Pos);
|
||
|
||
PORT_Init(PORTB, n, 0, 1); //PORTB.PINn<4E><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪGPIO<49><4F><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뿪<EFBFBD><EBBFAA>
|
||
if(dir == 1)
|
||
{
|
||
GPIOB->DIR |= (0x01 << n);
|
||
}
|
||
else
|
||
{
|
||
GPIOB->DIR &= ~(0x01 << n);
|
||
}
|
||
|
||
if(pull_down == 1)
|
||
PORT->PORTB_PULLD |= (0x01 << n);
|
||
else
|
||
PORT->PORTB_PULLD &= ~(0x01 << n);
|
||
break;
|
||
|
||
case ((uint32_t)GPIOC):
|
||
SYS->CLKEN |= (0x01 << SYS_CLKEN_GPIOC_Pos);
|
||
|
||
PORT_Init(PORTC, n, 0, 1); //PORTC.PINn<4E><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪGPIO<49><4F><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뿪<EFBFBD><EBBFAA>
|
||
if(dir == 1)
|
||
{
|
||
GPIOC->DIR |= (0x01 << n);
|
||
}
|
||
else
|
||
{
|
||
GPIOC->DIR &= ~(0x01 << n);
|
||
}
|
||
|
||
if(pull_up == 1)
|
||
PORT->PORTC_PULLU |= (0x01 << n);
|
||
else
|
||
PORT->PORTC_PULLU &= ~(0x01 << n);
|
||
break;
|
||
|
||
case ((uint32_t)GPIOM):
|
||
SYS->CLKEN |= (0x01 << SYS_CLKEN_GPIOM_Pos);
|
||
|
||
PORT_Init(PORTM, n, 0, 1); //PORTM.PINn<4E><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪGPIO<49><4F><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뿪<EFBFBD><EBBFAA>
|
||
if(dir == 1)
|
||
{
|
||
GPIOM->DIR |= (0x01 << n);
|
||
}
|
||
else
|
||
{
|
||
GPIOM->DIR &= ~(0x01 << n);
|
||
}
|
||
|
||
if(pull_up == 1)
|
||
PORT->PORTM_PULLU |= (0x01 << n);
|
||
else
|
||
PORT->PORTM_PULLU &= ~(0x01 << n);
|
||
break;
|
||
|
||
case ((uint32_t)GPION):
|
||
SYS->CLKEN |= (0x01 << SYS_CLKEN_GPION_Pos);
|
||
|
||
PORT_Init(PORTN, n, 0, 1); //PORTN.PINn<4E><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪGPIO<49><4F><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뿪<EFBFBD><EBBFAA>
|
||
if(dir == 1)
|
||
{
|
||
GPION->DIR |= (0x01 << n);
|
||
}
|
||
else
|
||
{
|
||
GPION->DIR &= ~(0x01 << n);
|
||
}
|
||
|
||
if(pull_down == 1)
|
||
PORT->PORTN_PULLD |= (0x01 << n);
|
||
else
|
||
PORT->PORTN_PULLD &= ~(0x01 << n);
|
||
break;
|
||
|
||
case ((uint32_t)GPIOP):
|
||
SYS->CLKEN |= (0x01 << SYS_CLKEN_GPIOP_Pos);
|
||
|
||
PORT_Init(PORTP, n, 0, 1); //PORTP.PINn<4E><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪGPIO<49><4F><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뿪<EFBFBD><EBBFAA>
|
||
if(dir == 1)
|
||
{
|
||
GPIOP->DIR |= (0x01 << n);
|
||
}
|
||
else
|
||
{
|
||
GPIOP->DIR &= ~(0x01 << n);
|
||
}
|
||
|
||
if(pull_up == 1)
|
||
PORT->PORTP_PULLU |= (0x01 << n);
|
||
else
|
||
PORT->PORTP_PULLU &= ~(0x01 << n);
|
||
break;
|
||
}
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_SetBit()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD>ø<EFBFBD>
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOM<4F><4D>GPION<4F><4E>GPIOP
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN22<32><32>PIN23
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_SetBit(GPIO_TypeDef * GPIOx, uint32_t n)
|
||
{
|
||
GPIOx->DATA |= (0x01 << n);
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_ClrBit()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD>õ<EFBFBD>
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOM<4F><4D>GPION<4F><4E>GPIOP
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN22<32><32>PIN23
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_ClrBit(GPIO_TypeDef * GPIOx, uint32_t n)
|
||
{
|
||
GPIOx->DATA &= ~(0x01 << n);
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_InvBit()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD><C6BD>ת
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOM<4F><4D>GPION<4F><4E>GPIOP
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN22<32><32>PIN23
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_InvBit(GPIO_TypeDef * GPIOx, uint32_t n)
|
||
{
|
||
GPIOx->DATA ^= (0x01 << n);
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_GetBit()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <09><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĵ<C5B5>ƽ״̬
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOM<4F><4D>GPION<4F><4E>GPIOP
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN22<32><32>PIN23
|
||
* <20><> <20><>: <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĵ<C5B5>ƽ״̬ 0 <20>͵<EFBFBD>ƽ 1 <20>ߵ<EFBFBD>ƽ
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
uint32_t GPIO_GetBit(GPIO_TypeDef * GPIOx, uint32_t n)
|
||
{
|
||
return ((GPIOx->DATA >> n) & 0x01);
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_SetBits()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>Ĵ<EFBFBD>n<EFBFBD><6E>ʼ<EFBFBD><CABC>wλ<77><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĵ<C5B5>ƽ<EFBFBD>ø<EFBFBD>
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOM<4F><4D>GPION<4F><4E>GPIOP
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN22<32><32>PIN23
|
||
* uint32_t w ָ<><D6B8>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD>øߵ<C3B8><DFB5><EFBFBD><EFBFBD>ŵĸ<C5B5><C4B8><EFBFBD>
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_SetBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w)
|
||
{
|
||
uint32_t bits;
|
||
|
||
bits = 0xFFFFFF >> (24 - w);
|
||
|
||
GPIOx->DATA |= (bits << n);
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_ClrBits()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>Ĵ<EFBFBD>n<EFBFBD><6E>ʼ<EFBFBD><CABC>wλ<77><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĵ<C5B5>ƽ<EFBFBD>õ<EFBFBD>
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOM<4F><4D>GPION<4F><4E>GPIOP
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN22<32><32>PIN23
|
||
* uint32_t w ָ<><D6B8>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD>õ͵<C3B5><CDB5><EFBFBD><EFBFBD>ŵĸ<C5B5><C4B8><EFBFBD>
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_ClrBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w)
|
||
{
|
||
uint32_t bits;
|
||
|
||
bits = 0xFFFFFF >> (24 - w);
|
||
|
||
GPIOx->DATA &= ~(bits << n);
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_InvBits()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>Ĵ<EFBFBD>n<EFBFBD><6E>ʼ<EFBFBD><CABC>wλ<77><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĵ<C5B5>ƽ<EFBFBD><C6BD>ת
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOM<4F><4D>GPION<4F><4E>GPIOP
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN22<32><32>PIN23
|
||
* uint32_t w ָ<><D6B8>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD><C6BD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD>ŵĸ<C5B5><C4B8><EFBFBD>
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_InvBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w)
|
||
{
|
||
uint32_t bits;
|
||
|
||
bits = 0xFFFFFF >> (24 - w);
|
||
|
||
GPIOx->DATA ^= (bits << n);
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_GetBits()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>Ĵ<EFBFBD>n<EFBFBD><6E>ʼ<EFBFBD><CABC>wλ<77><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĵ<C5B5>ƽ״̬
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOM<4F><4D>GPION<4F><4E>GPIOP
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN22<32><32>PIN23
|
||
* uint32_t w ָ<><D6B8>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD>øߵ<C3B8><DFB5><EFBFBD><EFBFBD>ŵĸ<C5B5><C4B8><EFBFBD>
|
||
* <20><> <20><>: <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>Ĵ<EFBFBD>n<EFBFBD><6E>ʼ<EFBFBD><CABC>wλ<77><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĵ<C5B5>ƽ״̬ 0 <20>͵<EFBFBD>ƽ 1 <20>ߵ<EFBFBD>ƽ
|
||
* <09><><EFBFBD><EFBFBD>ֵ<EFBFBD>ĵ<EFBFBD>0λ<30><CEBB>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>n<EFBFBD>ĵ<EFBFBD>ƽ״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>ĵ<EFBFBD>1λ<31><CEBB>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>n+1<>ĵ<EFBFBD>ƽ״̬... ...<2E><><EFBFBD><EFBFBD>ֵ<EFBFBD>ĵ<EFBFBD>wλ<77><CEBB>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>n+w<>ĵ<EFBFBD>ƽ״̬
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
uint32_t GPIO_GetBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w)
|
||
{
|
||
uint32_t bits;
|
||
|
||
bits = 0xFFFFFF >> (24 - w);
|
||
|
||
return ((GPIOx->DATA >> n) & bits);
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_AtomicSetBit()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD>øߣ<C3B8>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>š<EFBFBD><C5A1><EFBFBD>-<2D><>-д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ISR<53><52><EFBFBD>ϣ<EFBFBD>
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOD
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN14<31><34>PIN15
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>GPIOx<4F><78>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ж<EFBFBD>ISR<53>в<EFBFBD><D0B2><EFBFBD>ʱ<EFBFBD><CAB1>GPIOx<4F><78><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1>붼<EFBFBD><EBB6BC>GPIO_Atomic<69><63><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_AtomicSetBit(GPIO_TypeDef * GPIOx, uint32_t n)
|
||
{
|
||
*((volatile uint32_t *)(0x42000000 + ((uint32_t)&GPIOx->DATA - 0x40000000)*32 + n*4)) = 1;
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_AtomicClrBit()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD>õͣ<C3B5>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>š<EFBFBD><C5A1><EFBFBD>-<2D><>-д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ISR<53><52><EFBFBD>ϣ<EFBFBD>
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOD
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN14<31><34>PIN15
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>GPIOx<4F><78>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ж<EFBFBD>ISR<53>в<EFBFBD><D0B2><EFBFBD>ʱ<EFBFBD><CAB1>GPIOx<4F><78><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1>붼<EFBFBD><EBB6BC>GPIO_Atomic<69><63><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_AtomicClrBit(GPIO_TypeDef * GPIOx, uint32_t n)
|
||
{
|
||
*((volatile uint32_t *)(0x42000000 + ((uint32_t)&GPIOx->DATA - 0x40000000)*32 + n*4)) = 0;
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_AtomicInvBit()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD><C6BD>ת<EFBFBD><D7AA>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>š<EFBFBD><C5A1><EFBFBD>-<2D><>-д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ISR<53><52><EFBFBD>ϣ<EFBFBD>
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOD
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN14<31><34>PIN15
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>GPIOx<4F><78>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ж<EFBFBD>ISR<53>в<EFBFBD><D0B2><EFBFBD>ʱ<EFBFBD><CAB1>GPIOx<4F><78><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1>붼<EFBFBD><EBB6BC>GPIO_Atomic<69><63><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_AtomicInvBit(GPIO_TypeDef * GPIOx, uint32_t n)
|
||
{
|
||
*((volatile uint32_t *)(0x42000000 + ((uint32_t)&GPIOx->DATA - 0x40000000)*32 + n*4)) = 1 - *((volatile uint32_t *)(0x42000000 + ((uint32_t)&GPIOx->DATA - 0x40000000)*32 + n*4));
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_AtomicSetBits()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>Ĵ<EFBFBD>n<EFBFBD><6E>ʼ<EFBFBD><CABC>wλ<77><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĵ<C5B5>ƽ<EFBFBD>øߣ<C3B8>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>š<EFBFBD><C5A1><EFBFBD>-<2D><>-д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ISR<53><52><EFBFBD>ϣ<EFBFBD>
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOD
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN14<31><34>PIN15
|
||
* uint32_t w ָ<><D6B8>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD>øߵ<C3B8><DFB5><EFBFBD><EFBFBD>ŵĸ<C5B5><C4B8><EFBFBD>
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>GPIOx<4F><78>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ж<EFBFBD>ISR<53>в<EFBFBD><D0B2><EFBFBD>ʱ<EFBFBD><CAB1>GPIOx<4F><78><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1>붼<EFBFBD><EBB6BC>GPIO_Atomic<69><63><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_AtomicSetBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w)
|
||
{
|
||
uint32_t bits;
|
||
|
||
bits = 0xFFFFFF >> (24 - w);
|
||
|
||
__disable_irq();
|
||
GPIOx->DATA |= (bits << n);
|
||
__enable_irq();
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_AtomicClrBits()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>Ĵ<EFBFBD>n<EFBFBD><6E>ʼ<EFBFBD><CABC>wλ<77><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĵ<C5B5>ƽ<EFBFBD>õͣ<C3B5>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>š<EFBFBD><C5A1><EFBFBD>-<2D><>-д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ISR<53><52><EFBFBD>ϣ<EFBFBD>
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOD
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN14<31><34>PIN15
|
||
* uint32_t w ָ<><D6B8>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD>õ͵<C3B5><CDB5><EFBFBD><EFBFBD>ŵĸ<C5B5><C4B8><EFBFBD>
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>GPIOx<4F><78>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ж<EFBFBD>ISR<53>в<EFBFBD><D0B2><EFBFBD>ʱ<EFBFBD><CAB1>GPIOx<4F><78><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1>붼<EFBFBD><EBB6BC>GPIO_Atomic<69><63><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_AtomicClrBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w)
|
||
{
|
||
uint32_t bits;
|
||
|
||
bits = 0xFFFFFF >> (24 - w);
|
||
|
||
__disable_irq();
|
||
GPIOx->DATA &= ~(bits << n);
|
||
__enable_irq();
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_AtomicInvBits()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>Ĵ<EFBFBD>n<EFBFBD><6E>ʼ<EFBFBD><CABC>wλ<77><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĵ<C5B5>ƽ<EFBFBD><C6BD>ת<EFBFBD><D7AA>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>š<EFBFBD><C5A1><EFBFBD>-<2D><>-д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ISR<53><52><EFBFBD>ϣ<EFBFBD>
|
||
* <20><> <20><>: GPIO_TypeDef * GPIOx ָ<><D6B8>GPIO<49>˿ڣ<CBBF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>GPIOA<4F><41>GPIOB<4F><42>GPIOC<4F><43>GPIOD
|
||
* uint32_t n ָ<><D6B8>GPIO<49><4F><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>PIN0<4E><30>PIN1<4E><31>PIN2<4E><32>... ... PIN14<31><34>PIN15
|
||
* uint32_t w ָ<><D6B8>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ƽ<EFBFBD><C6BD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD>ŵĸ<C5B5><C4B8><EFBFBD>
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>GPIOx<4F><78>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ж<EFBFBD>ISR<53>в<EFBFBD><D0B2><EFBFBD>ʱ<EFBFBD><CAB1>GPIOx<4F><78><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1>붼<EFBFBD><EBB6BC>GPIO_Atomic<69><63><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
******************************************************************************************************************************************/
|
||
void GPIO_AtomicInvBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w)
|
||
{
|
||
uint32_t bits;
|
||
|
||
bits = 0xFFFFFF >> (24 - w);
|
||
|
||
__disable_irq();
|
||
GPIOx->DATA ^= (bits << n);
|
||
__enable_irq();
|
||
}
|