Richon FR8008A GPIO Application Guide

1. Introduction to GPIO functions

      The GPIO of the FR8008A chip can be multiplexed into different functions, with functions such as external interrupt and wake-up. The control right of GPIO
can be handed over to two modules: normal control unit and low power consumption control unit. When the system is in normal working mode, both control units can be used for control; when the system is in low power consumption mode, the common control unit is in a power-off state, and only the low power consumption control unit can be controlled.
 

2. How to use GPIO

Here we mainly explain the method 2 of using components\driver\driver_gpio.c.

2.1 Setting the output

    // Output 
    GPIO_Handle.Pin       = GPIO_PIN_0|GPIO_PIN_1;
    GPIO_Handle.Mode      = GPIO_MODE_OUTPUT_PP;

    gpio_init(GPIO_B, &GPIO_Handle);

    // Output HIGH
    gpio_write_pin(GPIO_B, GPIO_PIN_0|GPIO_PIN_1, GPIO_PIN_SET);
    
    // Output LOW
    gpio_write_pin(GPIO_B, GPIO_PIN_0|GPIO_PIN_1, GPIO_PIN_CLEAR);

2.2 Setting input

   // Input
    GPIO_Handle.Pin       = GPIO_PIN_0|GPIO_PIN_1;
    GPIO_Handle.Mode      = GPIO_MODE_INPUT;
    GPIO_Handle.Pull      = GPIO_PULLDOWN;

    gpio_init(GPIO_A, &GPIO_Handle);
   

Guess you like

Origin blog.csdn.net/Joon2020/article/details/126552204