Trident IoT SDK
Loading...
Searching...
No Matches
tr_hal_gpio.h
Go to the documentation of this file.
1
10
11#ifndef TR_HAL_GPIO_H_
12#define TR_HAL_GPIO_H_
13
14#include "tr_hal_platform.h"
15
16
17// ****************************************************************************
18// GPIO Driver API functions
19// ****************************************************************************
20
26
27
28// ***************************************************************************
29// ---- init, uninit, read back settings, read input ----
30// ***************************************************************************
31
32
37 tr_hal_gpio_settings_t* gpio_settings);
38
43
48 tr_hal_gpio_settings_t* gpio_settings);
49
53 tr_hal_level_t* read_value);
54
55
56// ***************************************************************************
57// ---- is pin available, are pins equal ----
58// ***************************************************************************
59
63
68
69
70// ***************************************************************************
71// ---- APIs used by HAL modules to ensure GPIOs are only used by 1 module ----
72// ***************************************************************************
73
76 tr_hal_status_t new_setting);
77
80
83
84
85// ***************************************************************************
86// ---- setting/getting direction, output state ----
87// ***************************************************************************
88
89// do not need these if use the settings struct and the init function
90
92 tr_hal_direction_t direction);
93
95 tr_hal_direction_t* direction);
96
98 tr_hal_level_t level);
99
101 tr_hal_level_t* level);
102
104
105
106// ***************************************************************************
107// ---- setting interrupt trigger/priority/callback ----
108// ***************************************************************************
109
110// do not need these if use the settings struct and the init function
111
113 tr_hal_trigger_t trigger);
114
116 tr_hal_trigger_t* trigger);
117
119
121
123 tr_hal_gpio_event_callback_t callback_function);
124
126 tr_hal_gpio_event_callback_t* callback_function);
127
128
129// ***************************************************************************
130// ---- setting/getting open drain and pull mode ----
131// ***************************************************************************
132
133// do not need these if use the settings struct and the init function
134
136 bool enable);
137
139 bool* drain_enabled);
140
142 tr_hal_pullopt_t mode);
143
145 tr_hal_pullopt_t* mode);
146
147
148// ***************************************************************************
149// ---- setting/getting debounce ----
150// ***************************************************************************
151
152// do not need these if use the settings struct and the init function
153
155 bool enable);
156
158 bool* debounce_enabled);
159
161
163
164
165// ***************************************************************************
166// ---- setting/getting drive strength ----
167// ***************************************************************************
168
169// do not need these if use the settings struct and the init function
170
172 tr_hal_drive_strength_t new_drive_strength);
173
175 tr_hal_drive_strength_t* drive_strength);
176
177
178// ***************************************************************************
179// ---- enable/disable wake on deep sleep ----
180// ***************************************************************************
181
182// do not need these if use the settings struct and the init function
183
185 tr_hal_wake_mode_t wake_mode);
186
188 tr_hal_wake_mode_t* wake_mode);
189
190// ***************************************************************************
191// ---- set/get the pin mode (GPIO, UART, SPI, etc) for this pin ----
192// ***************************************************************************
194 tr_hal_pin_mode_t mode);
195
197 tr_hal_pin_mode_t* mode);
198
199// ***************************************************************************
200// ---- print a pin in a debug print ----
201// ***************************************************************************
203
204
208
209
210#endif //TR_HAL_GPIO_H_
tr_hal_int_pri_t
values and a range checking function for setting the interrupt priority in the Trident HAL APIs
Definition tr_hal_platform.h:34
tr_hal_status_t
Definition tr_hal_common.h:25
tr_hal_drive_strength_t
values for setting the GPIO drive strength in the Trident HAL APIs NOTE: these CANNOT be changed....
Definition T32CM11_gpio.h:246
tr_hal_wake_mode_t
values for setting the GPIO wake mode
Definition T32CM11_gpio.h:260
tr_hal_pullopt_t
values for setting the pull option in the Trident HAL GPIO APIs NOTE: these CANNOT be changed....
Definition T32CM11_gpio.h:208
tr_hal_direction_t
values for setting the direction in the Trident HAL GPIO APIs
Definition T32CM11_gpio.h:172
tr_hal_pin_mode_t
these are the pin MODEs to be passed to tr_hal_gpio_set_mode note that these are defined by the chip ...
Definition T32CM11_gpio.h:137
tr_hal_debounce_time_t
values for setting the debounce time register each individual GPIO can be set to enable or disable de...
Definition T32CM11_gpio.h:228
tr_hal_trigger_t
values for setting the interrupt trigger in the Trident HAL GPIO APIs
Definition T32CM11_gpio.h:192
void(* tr_hal_gpio_event_callback_t)(tr_hal_gpio_pin_t pin, tr_hal_gpio_event_t event)
Definition T32CM11_gpio.h:285
tr_hal_level_t
values for setting the level in the Trident HAL GPIO APIs
Definition T32CM11_gpio.h:182
tr_hal_status_t tr_hal_gpio_set_output(tr_hal_gpio_pin_t pin, tr_hal_level_t level)
tr_hal_status_t tr_hal_gpio_set_drive_strength(tr_hal_gpio_pin_t pin, tr_hal_drive_strength_t new_drive_strength)
tr_hal_status_t tr_hal_gpio_get_output(tr_hal_gpio_pin_t pin, tr_hal_level_t *level)
tr_hal_status_t tr_hal_gpio_mgr_reserve_gpio(tr_hal_gpio_pin_t pin, tr_hal_status_t new_setting)
the HAL modules call this when using GPIOs to reserve one
tr_hal_status_t tr_hal_gpio_read_settings(tr_hal_gpio_pin_t pin, tr_hal_gpio_settings_t *gpio_settings)
char * tr_hal_gpio_get_string(tr_hal_gpio_pin_t pin)
tr_hal_status_t tr_hal_gpio_toggle_output(tr_hal_gpio_pin_t pin)
tr_hal_status_t tr_hal_gpio_get_debounce(tr_hal_gpio_pin_t pin, bool *debounce_enabled)
bool tr_hal_gpio_is_available(tr_hal_gpio_pin_t pin)
tr_hal_status_t tr_hal_gpio_get_debounce_time(tr_hal_debounce_time_t *debounce_time)
tr_hal_status_t tr_hal_gpio_uninit(tr_hal_gpio_pin_t pin)
tr_hal_status_t tr_hal_gpio_set_pull_mode(tr_hal_gpio_pin_t pin, tr_hal_pullopt_t mode)
tr_hal_status_t tr_hal_gpio_set_open_drain(tr_hal_gpio_pin_t pin, bool enable)
tr_hal_status_t tr_hal_gpio_set_direction(tr_hal_gpio_pin_t pin, tr_hal_direction_t direction)
tr_hal_status_t tr_hal_gpio_init(tr_hal_gpio_pin_t pin, tr_hal_gpio_settings_t *gpio_settings)
tr_hal_status_t tr_hal_gpio_get_interrupt_trigger(tr_hal_gpio_pin_t pin, tr_hal_trigger_t *trigger)
tr_hal_status_t tr_hal_gpio_set_debounce(tr_hal_gpio_pin_t pin, bool enable)
tr_hal_status_t tr_hal_gpio_get_mode(tr_hal_gpio_pin_t pin, tr_hal_pin_mode_t *mode)
tr_hal_status_t tr_hal_gpio_get_wake_mode(tr_hal_gpio_pin_t pin, tr_hal_wake_mode_t *wake_mode)
tr_hal_status_t tr_hal_gpio_mgr_check_gpio(tr_hal_gpio_pin_t pin)
the HAL modules call this when seeing if a GPIO is available for use
tr_hal_status_t tr_hal_gpio_set_wake_mode(tr_hal_gpio_pin_t pin, tr_hal_wake_mode_t wake_mode)
tr_hal_status_t tr_hal_gpio_read_input(tr_hal_gpio_pin_t pin, tr_hal_level_t *read_value)
tr_hal_status_t tr_hal_gpio_mgr_release_gpio(tr_hal_gpio_pin_t pin)
the HAL modules call this when done with a GPIO, normally in uninit
tr_hal_status_t tr_hal_gpio_set_interrupt_priority(tr_hal_int_pri_t new_interrupt_priority)
tr_hal_status_t tr_hal_gpio_get_interrupt_callback(tr_hal_gpio_pin_t pin, tr_hal_gpio_event_callback_t *callback_function)
tr_hal_status_t tr_hal_gpio_get_drive_strength(tr_hal_gpio_pin_t pin, tr_hal_drive_strength_t *drive_strength)
bool tr_hal_gpio_are_pins_equal(tr_hal_gpio_pin_t pin1, tr_hal_gpio_pin_t pin2)
tr_hal_status_t tr_hal_gpio_set_interrupt_trigger(tr_hal_gpio_pin_t pin, tr_hal_trigger_t trigger)
tr_hal_status_t tr_hal_gpio_set_interrupt_callback(tr_hal_gpio_pin_t pin, tr_hal_gpio_event_callback_t callback_function)
tr_hal_status_t tr_hal_gpio_set_mode(tr_hal_gpio_pin_t pin, tr_hal_pin_mode_t mode)
tr_hal_status_t tr_hal_gpio_set_debounce_time(tr_hal_debounce_time_t new_debounce_time)
tr_hal_status_t tr_hal_gpio_get_direction(tr_hal_gpio_pin_t pin, tr_hal_direction_t *direction)
tr_hal_status_t tr_hal_gpio_get_open_drain(tr_hal_gpio_pin_t pin, bool *drain_enabled)
tr_hal_status_t tr_hal_gpio_get_pull_mode(tr_hal_gpio_pin_t pin, tr_hal_pullopt_t *mode)
tr_hal_status_t tr_hal_gpio_get_interrupt_priority(tr_hal_int_pri_t *interrupt_priority)
pin type
Definition tr_hal_platform.h:23
Definition T32CM11_gpio.h:319