GPIO Driver

The RTOS supports GPIO driver. Under RT-Thread finsh, enable pin command can manipulate the output and input of GPIO, taking GPIO47 as an example:
msh />pin mode 47 output 
msh />pin write 47 low 
msh />pin read 47     
pin[47] = low
msh />pin write 47 high
msh />pin read 47 
pin[47] = high

Result: You can check the high and low voltage levels by measuring GPIO47.

RTOS supports GPIO interrupt drivers. Since there is only one GPIO interrupt resource, and it is assumed to be occupied by Linux, RTOS can only use GPIO interrupt when Linux is not using it. In VisionFive 2 SDK, due to the use of GPIO interrupts on the Linux side, RT-Thread does not activate GPIO interrupts by default. If GPIO interrupts need to be activated, BSP_USING_GPIO needs to be enabled in the RT-Thread configuration.