23.8.1.1.3 Workflow

  1. Create a PINMUX module pin configuration struct, which can be filled out to adjust the configuration of a single port pin.
    struct system_pinmux_config config_pinmux;
    
  2. Initialize the pin configuration struct with the module's default values.
    system_pinmux_get_config_defaults(&config_pinmux);
    
    Note: This should always be performed before using the configuration struct to ensure that all values are initialized to known default settings.
  3. Adjust the configuration struct to request an input pin with pull-up connected to the GPIO peripheral.
    config_pinmux.mux_position = SYSTEM_PINMUX_GPIO;
    config_pinmux.direction    = SYSTEM_PINMUX_PIN_DIR_INPUT;
    config_pinmux.input_pull   = SYSTEM_PINMUX_PIN_PULL_UP;
    
  4. Configure GPIO10 with the initialized pin configuration struct, to enable the input sampler on the pin.
    system_pinmux_pin_set_config(10, &config_pinmux);