Trident IoT SDK
 
Loading...
Searching...
No Matches
tr_hal_gpio_settings_t Struct Reference

#include <T32CM11_gpio.h>

+ Collaboration diagram for tr_hal_gpio_settings_t:

Data Fields

tr_hal_direction_t direction
 
tr_hal_level_t output_level
 
bool enable_open_drain
 
tr_hal_drive_strength_t drive_strength
 
tr_hal_trigger_t interrupt_trigger
 
tr_hal_gpio_event_callback_t event_handler_fx
 
tr_hal_pullopt_t pull_mode
 
bool enable_debounce
 
tr_hal_wake_mode_t wake_mode
 

Detailed Description


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);

Field Documentation

◆ direction

tr_hal_direction_t tr_hal_gpio_settings_t::direction

◆ drive_strength

tr_hal_drive_strength_t tr_hal_gpio_settings_t::drive_strength

◆ enable_debounce

bool tr_hal_gpio_settings_t::enable_debounce

◆ enable_open_drain

bool tr_hal_gpio_settings_t::enable_open_drain

◆ event_handler_fx

tr_hal_gpio_event_callback_t tr_hal_gpio_settings_t::event_handler_fx

◆ interrupt_trigger

tr_hal_trigger_t tr_hal_gpio_settings_t::interrupt_trigger

◆ output_level

tr_hal_level_t tr_hal_gpio_settings_t::output_level

◆ pull_mode

tr_hal_pullopt_t tr_hal_gpio_settings_t::pull_mode

◆ wake_mode

tr_hal_wake_mode_t tr_hal_gpio_settings_t::wake_mode

The documentation for this struct was generated from the following files: