当前位置:网站首页>Huada 4a0gpio settings

Huada 4a0gpio settings

2022-06-24 22:15:00 Paper tape

typedef struct
{
    uint16_t u16PinState;     /*!< Set pin state to High or Low, @ref GPIO_PinState_Sel for details       */
    uint16_t u16PinDir;       /*!< Pin mode setting, @ref GPIO_PinDirection_Sel for details               */
    uint16_t u16PinOType;     /*!< Output type setting, @ref GPIO_PinOutType_Sel for details              */
    uint16_t u16PinDrv;       /*!< Pin drive capacity setting, @ref GPIO_PinDrv_Sel for details           */
    uint16_t u16Latch;        /*!< Pin latch setting, @ref GPIO_PinLatch_Sel for details                  */
    uint16_t u16PullUp;       /*!< Internal pull-up resistor setting, @ref GPIO_PinPU_Sel for details     */
    uint16_t u16Invert;       /*!< Pin input/output invert setting, @ref GPIO_PinInvert_Sel               */
    uint16_t u16PinIType;     /*!< Input type setting, @ref GPIO_PinInType_Sel                            */
    uint16_t u16ExInt;        /*!< External interrupt pin setting, @ref GPIO_PinExInt_Sel for details     */
    uint16_t u16PinAttr;      /*!< Digital or analog attribute setting, @ref GPIO_PinMode_Sel for details */
} stc_gpio_init_t;
        pstcGpioInit->u16PinState   = PIN_STATE_RESET;// Set the pin status to high and low level 
        pstcGpioInit->u16PinDir     = PIN_DIR_IN;// Set input or output 
        pstcGpioInit->u16PinOType   = PIN_OTYPE_CMOS;// Set yes NMOS still PMOS Output 
        pstcGpioInit->u16PinDrv     = PIN_DRV_LOW;// Set push-pull output mode , High and low medium speed output 
        pstcGpioInit->u16Latch      = PIN_LATCH_OFF;// Latch enable // Latch disable 
        pstcGpioInit->u16PullUp     = PIN_PU_OFF;/ Internal pull-up enable adjustment 
        pstcGpioInit->u16Invert     = PIN_INVERT_OFF;// Input and output . Reverse enable 
        pstcGpioInit->u16PinIType   = PIN_ITYPE_SMT;// The input methods are divided into SMT Input CMOS The input of 
        pstcGpioInit->u16ExInt      = PIN_EXINT_OFF;// External interrupt 
        pstcGpioInit->u16PinAttr    = PIN_ATTR_DIGITAL;// Digital and analog properties 

  About 4A0 A general step in the application of :

    stc_gpio_init_t stcGpioInit;// Make a statement gpio Configuration of struct.

    /* Register write enable for some required peripherals. */
    Peripheral_WE();

    /* LED initialize */
    (void)GPIO_StructInit(&stcGpioInit);// About gpio Setting of each attribute .
    (void)GPIO_Init(LED_GREEN_PORT, LED_GREEN_PIN, &stcGpioInit);// Setting of a certain pin , After an initialization .

    /* Register write protected for some required peripherals. */
    Peripheral_WP();

    /* "Turn off" LED before set to output */
    GPIO_ResetPins(LED_GREEN_PORT, LED_GREEN_PIN);// Set separate high and low level output inputs 

    /* Output enable */
    GPIO_OE(LED_GREEN_PORT, LED_GREEN_PIN, Enable);// Set high and low level output 
    for (;;)
    {
        /* LED */
        GPIO_SetPins(LED_GREEN_PORT, LED_GREEN_PIN);//
        DDL_DelayMS(2000UL);// Time delay 
        GPIO_ResetPins(LED_GREEN_PORT, LED_GREEN_PIN);//
        DDL_DelayMS(2000UL);// Time delay 
        /* De-init port if necessary */
        //GPIO_DeInit();
    }

原网站

版权声明
本文为[Paper tape]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241608431512.html