GPIO_init

Function GPIO_init 

Source
pub unsafe extern "C" fn GPIO_init(
    this_gpio: *mut gpio_instance_t,
    base_addr: addr_t,
    bus_width: gpio_apb_width_t,
)
Expand description

The GPIO_init() function initializes a CoreGPIO hardware instance and the data structure associated with the CoreGPIO hardware instance. Note that a CoreGPIO hardware instance is generated with a fixed configuration for some or all of its IOs as part of the hardware flow. Attempting to modify the configuration of such a hardware-configured IO using the GPIO_config() function has no effect.

@param this_gpio Pointer to the gpio_instance_t data structure instance holding all data regarding the CoreGPIO hardware instance being initialized. A pointer to the same data structure is used in subsequent calls to the CoreGPIO driver functions in order to identify the CoreGPIO instance that must perform the operation implemented by the called driver function.

@param base_addr The base_addr parameter is the base address in the memory map of the processor for the registers of the GPIO instance being initialized.

@param bus_width The bus_width parameter informs the driver of the APB bus width selected during the hardware flow configuration of the CoreGPIO hardware instance. It indicates to the driver whether the CoreGPIO hardware registers are visible as 8, 16, or 32-bits registers. Allowed values are:

  • GPIO_APB_8_BITS_BUS
  • GPIO_APB_16_BITS_BUS
  • GPIO_APB_32_BITS_BUS

@return none.

@example @code #define COREGPIO_BASE_ADDR 0xC2000000

gpio_instance_t g_gpio;

void system_init( void ) { GPIO_init( &g_gpio, COREGPIO_BASE_ADDR, GPIO_APB_32_BITS_BUS ); } @endcode