GPIO Settings struct
instead of calling various functions to setup a GPIO, create an instance of this struct, fill in the details, and pass it to tr_hal_gpio_init()
there is also a way to setup a GPIO with reasonable defaults, and just change the options that you need to, example:
// default setting for an input (for use as a button)
tr_hal_gpio_settings_t button_cfg = DEFAULT_GPIO_INPUT_CONFIG;
// we want to wake from deep sleep, so adjust that
button_cfg.wake_from_deep_sleep = true;
// set pin 9 for the button config
tr_hal_gpio_pin_t button_pin = { 9 }
tr_hal_gpio_init(button_pin, button_cfg);
// default setting for an output (for use as an LED)
tr_hal_gpio_settings_t led_cfg = DEFAULT_GPIO_OUTPUT_CONFIG;
// we want to adjust pull mode
led_cfg.pull_mode = TR_HAL_PULLOPT_PULL_DOWN_1M;
// set pin 15 for an LED
tr_hal_gpio_pin_t led_pin = { 15 }
tr_hal_gpio_init(led_pin, led_cfg);