Contiki-NG
gpio-hal.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, George Oikonomou - http://www.spd.gr
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 /*---------------------------------------------------------------------------*/
32 /**
33  * \addtogroup dev
34  * @{
35  *
36  * \defgroup gpio-hal GPIO Hardware Abstraction Layer
37  *
38  * The GPIO HAL provides a set of common functions that can be used in a
39  * platform-independent fashion.
40  *
41  * Internally, the GPIO HAL handles edge detection handling and also provides
42  * fallback functions for GPIO pin toggling if the hardware does not have
43  * a direct method of toggling pins through direct register access.
44  *
45  * @{
46  *
47  * \file
48  * Header file for the GPIO HAL
49  */
50 /*---------------------------------------------------------------------------*/
51 #ifndef GPIO_HAL_H_
52 #define GPIO_HAL_H_
53 /*---------------------------------------------------------------------------*/
54 #include "contiki.h"
55 
56 #include <stdint.h>
57 /*---------------------------------------------------------------------------*/
58 /**
59  * \brief Specifies whether the HAL should support a port/pin convention
60  *
61  * Some MCUs specify GPIOs as a port/pin combination, whereas some others
62  * only use a pin number. Our GPIO HAL supports both conventions in a portable
63  * fashion and this define is used to set the HAL in the desired of the two
64  * modes.
65  *
66  * The port developer should define GPIO_HAL_CONF_PORT_PIN_NUMBERING as a if
67  * the platform uses port/pin numbering, or to 0 if the platform only uses
68  * a simple number.
69  */
70 #ifdef GPIO_HAL_CONF_PORT_PIN_NUMBERING
71 #define GPIO_HAL_PORT_PIN_NUMBERING GPIO_HAL_CONF_PORT_PIN_NUMBERING
72 #else
73 #define GPIO_HAL_PORT_PIN_NUMBERING 1
74 #endif
75 /*---------------------------------------------------------------------------*/
76 /**
77  * \brief Specifies whether software-based pin toggle is required
78  *
79  * Some MCUs allow GPIO pin toggling via direct register access. For these
80  * MCUs, define GPIO_HAL_CONF_ARCH_SW_TOGGLE to 0 and then implement
81  * gpio_hal_arch_toggle_pin() and gpio_hal_arch_toggle_pins()
82  *
83  * \sa gpio_hal_arch_toggle_pin()
84  * \sa gpio_hal_arch_toggle_pins()
85  */
86 #ifdef GPIO_HAL_CONF_ARCH_SW_TOGGLE
87 #define GPIO_HAL_ARCH_SW_TOGGLE GPIO_HAL_CONF_ARCH_SW_TOGGLE
88 #else
89 #define GPIO_HAL_ARCH_SW_TOGGLE 1
90 #endif
91 /*---------------------------------------------------------------------------*/
92 /**
93  * \brief Convenience macro to use this as the port argument of macros
94  *
95  * Use this as the port \e argument of macros when GPIO_HAL_PORT_PIN_NUMBERING
96  * is zero
97  */
98 #define GPIO_HAL_NULL_PORT 0
99 /*---------------------------------------------------------------------------*/
100 /**
101  * \brief GPIO pin number representation
102  */
103 typedef uint8_t gpio_hal_pin_t;
104 
105 /**
106  * \brief A data structure that represents ports.
107  *
108  * This is only relevant if GPIO_HAL_PORT_PIN_NUMBERING is non-zero
109  */
110 typedef uint8_t gpio_hal_port_t;
111 
112 /**
113  * \brief GPIO pin configuration
114  *
115  * A logical representation of a pin's configuration. It is an OR combination
116  * of GPIO_HAL_PIN_CFG_xyz macros.
117  */
118 typedef uint32_t gpio_hal_pin_cfg_t;
119 
120 /**
121  * \brief Specifies the total number of pins on a device
122  *
123  * This macro has no effect if GPIO_HAL_PORT_PIN_NUMBERING is non-zero.
124  */
125 #ifdef GPIO_HAL_CONF_PIN_COUNT
126 #define GPIO_HAL_PIN_COUNT GPIO_HAL_CONF_PIN_COUNT
127 #else
128 #define GPIO_HAL_PIN_COUNT 32
129 #endif
130 
131 #if GPIO_HAL_PIN_COUNT > 32 && !GPIO_HAL_PORT_PIN_NUMBERING
132 typedef uint64_t gpio_hal_pin_mask_t;
133 #else
134 /**
135  * \brief GPIO pin mask representation
136  *
137  * A mask that can be used to represent multiple pins using a single variable.
138  *
139  * When GPIO_HAL_PORT_PIN_NUMBERING is non-zero, such variables can only be
140  * used to represent pins within the same port.
141  */
142 typedef uint32_t gpio_hal_pin_mask_t;
143 #endif
144 /*---------------------------------------------------------------------------*/
145 #if GPIO_HAL_PORT_PIN_NUMBERING
146 typedef void (*gpio_hal_callback_t)(gpio_hal_port_t port,
147  gpio_hal_pin_mask_t pin_mask);
148 #else
149 typedef void (*gpio_hal_callback_t)(gpio_hal_pin_mask_t pin_mask);
150 #endif
151 /*---------------------------------------------------------------------------*/
152 #define GPIO_HAL_PIN_CFG_PULL_NONE 0x00
153 #define GPIO_HAL_PIN_CFG_PULL_UP 0x01
154 #define GPIO_HAL_PIN_CFG_PULL_DOWN 0x02
155 #define GPIO_HAL_PIN_CFG_PULL_MASK (GPIO_HAL_PIN_CFG_PULL_UP | \
156  GPIO_HAL_PIN_CFG_PULL_DOWN)
157 
158 #define GPIO_HAL_PIN_CFG_HYSTERESIS 0x10
159 
160 #define GPIO_HAL_PIN_CFG_EDGE_NONE 0x00
161 #define GPIO_HAL_PIN_CFG_EDGE_RISING 0x04
162 #define GPIO_HAL_PIN_CFG_EDGE_FALLING 0x08
163 #define GPIO_HAL_PIN_CFG_EDGE_BOTH (GPIO_HAL_PIN_CFG_EDGE_RISING | \
164  GPIO_HAL_PIN_CFG_EDGE_FALLING)
165 
166 #define GPIO_HAL_PIN_CFG_INT_DISABLE 0x00
167 #define GPIO_HAL_PIN_CFG_INT_ENABLE 0x80
168 #define GPIO_HAL_PIN_CFG_INT_MASK 0x80
169 /*---------------------------------------------------------------------------*/
170 /**
171  * \brief Datatype for GPIO event handlers
172  *
173  * A GPIO event handler is a function that gets called whenever a pin triggers
174  * an event. The same handler can be registered to handle events for more than
175  * one pin by setting the respective pin's position but in \e pin_mask.
176  *
177  * If GPIO_HAL_PORT_PIN_NUMBERING is non-zero, a separate handler is required
178  * per port.
179  */
180 typedef struct gpio_hal_event_handler_s {
181  struct gpio_hal_event_handler_s *next;
182  gpio_hal_callback_t handler;
183 #if GPIO_HAL_PORT_PIN_NUMBERING
184  gpio_hal_port_t port;
185 #endif
186  gpio_hal_pin_mask_t pin_mask;
188 /*---------------------------------------------------------------------------*/
189 /**
190  * \brief Unknown GPIO
191  *
192  * A default GPIO value for unknown GPIO
193  */
194 #define GPIO_HAL_PIN_UNKNOWN 0xFF
195 /*---------------------------------------------------------------------------*/
196 /**
197  * \name Core GPIO functions
198  *
199  * Functions implemented by the HAL itself
200  * @{
201  */
202 /**
203  * \brief Initialise the GPIO HAL
204  */
205 void gpio_hal_init(void);
206 
207 /**
208  * \brief Register a function to be called whenever a pin triggers an event
209  * \param handler The handler representation
210  *
211  * The handler must be pre-allocated statically by the caller.
212  *
213  * This function can be used to register a function to be called by the HAL
214  * whenever a GPIO interrupt occurs.
215  *
216  * \sa gpio_hal_event_handler
217  */
219 
220 #if GPIO_HAL_PORT_PIN_NUMBERING
221 /**
222  * \brief The platform-independent GPIO event handler
223  * \param port The GPIO port, if applicable
224  * \param pins OR mask of pins that generated an event
225  *
226  * Whenever a GPIO input interrupt occurs (edge or level detection) and an ISR
227  * is triggered, the ISR must call this function, passing as argument an ORd
228  * mask of the pins that triggered the interrupt. This function will then
229  * call the registered event handlers (if any) for the pins that triggered the
230  * event. The platform code should make no assumptions as to the order that
231  * the handlers will be called.
232  *
233  * If a pin set in the mask has an event handler registered, this function
234  * will call the registered handler.
235  *
236  * If GPIO_HAL_PORT_PIN_NUMBERING is non-zero the function will also accept
237  * as its first argument the port associated to the pins that triggered the
238  * edge detection.
239  *
240  * This function will not clear any CPU interrupt flags, this should be done
241  * by the calling ISR.
242  *
243  * \sa gpio_hal_register_handler
244  */
246 #else
248 #endif
249 
250 /**
251  * \brief Convert a pin to a pin mask
252  * \param pin The pin
253  * \return The corresponding mask
254  */
255 #define gpio_hal_pin_to_mask(pin) ((gpio_hal_pin_mask_t)1 << (pin))
256 /** @} */
257 /*---------------------------------------------------------------------------*/
258 /**
259  * \name GPIO pin manipulation functions to be provided by the platform code.
260  *
261  * All functions have two flavours:
262  * - gpio_hal_arch_port_foo are used when GPIO_HAL_PORT_PIN_NUMBERING is
263  * non-zero and expect a gpio_hal_port_t as one of their arguments
264  * - gpio_hal_arch_no_port_foo are used when GPIO_HAL_PORT_PIN_NUMBERING is 0
265  * and do _not_ expect a gpio_hal_port_t as one of their arguments
266  *
267  * Macros are provided that automatically expand to the desirable prototype
268  * depending on the value of GPIO_HAL_PORT_PIN_NUMBERING. In order to achieve
269  * code portability, all platform-independent code should use those macros to
270  * manipulate GPIOs instead of using the port_ / no_port_ functions directly.
271  * A convenience macro GPIO_HAL_NULL_PORT is provided to be used as the port
272  * argument of macros when GPIO_HAL_PORT_PIN_NUMBERING is zero.
273  *
274  * All the functions below must be provided by the platform's developer. The
275  * HAL offers the developer a number of options of how to provide the required
276  * functionality.
277  *
278  * - The developer can provide a symbol. For example, the developer can create
279  * a .c file and implement a function called gpio_hal_arch_set_port_pin().
280  * In this scenario the developer only needs to provide a symbol for the
281  * gpio_hal_arch_port_foo / gpio_hal_arch_no_port_foo that applies.
282  *
283  * - The developer can provide a function-like macro that has the same name as
284  * one of the manipulation macros declared here. In this scenario, the
285  * declaration here will be removed by the pre-processor. For example, the
286  * developer can do something like:
287  *
288  * \code
289  * #define gpio_hal_arch_write_pin(port, pin, v) sdk_function(port, pin, v)
290  * \endcode
291  *
292  * - The developer can provide a static inline implementation. For this to
293  * work, the developer can do something like:
294  *
295  * \code
296  * #define gpio_hal_arch_set_pin(port, pin) set_pin(port, pin)
297  * static inline void set_pin(gpio_hal_port_t port, gpio_hal_pin_t pin) { ... }
298  * \endcode
299  *
300  * In the latter two cases, the developer will likely provide implementations
301  * in a header file. In this scenario, one of the platform's configuration
302  * files must define GPIO_HAL_CONF_ARCH_HDR_PATH to the name of this header
303  * file. For example:
304  *
305  * \code
306  * #define GPIO_HAL_CONF_ARCH_HDR_PATH "dev/gpio-hal-arch.h"
307  * \endcode
308  * @{
309  */
310 /*---------------------------------------------------------------------------*/
311 /* Include Arch-Specific conf */
312 #ifdef GPIO_HAL_CONF_ARCH_HDR_PATH
313 #include GPIO_HAL_CONF_ARCH_HDR_PATH
314 #endif /* GPIO_HAL_CONF_ARCH_HDR_PATH */
315 /*---------------------------------------------------------------------------*/
316 #ifndef gpio_hal_arch_init
317 /**
318  * \brief Perform architecture specific gpio initaliaztion
319  *
320  * It is the platform developer's responsibility to provide an implementation.
321  *
322  * The implementation can be provided as a global symbol, an inline function
323  * or a function-like macro, as described above.
324  */
325 void gpio_hal_arch_init(void);
326 #endif
327 /*---------------------------------------------------------------------------*/
328 #ifndef gpio_hal_arch_interrupt_enable
329 /**
330  * \brief Enable interrupts for a gpio pin
331  * \param port The GPIO port
332  * \param pin The GPIO pin number
333  *
334  * It is the platform developer's responsibility to provide an implementation.
335  *
336  * The implementation can be provided as a global symbol, an inline function
337  * or a function-like macro, as described above.
338  *
339  * \note Code should not call this function directly. Use GPIO manipulation
340  * macros instead.
341  */
343  gpio_hal_pin_t pin);
344 
345 /**
346  * \brief Enable interrupts for a gpio pin
347  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
348  *
349  * It is the platform developer's responsibility to provide an implementation.
350  *
351  * The implementation can be provided as a global symbol, an inline function
352  * or a function-like macro, as described above.
353  *
354  * \note Code should not call this function directly. Use GPIO manipulation
355  * macros instead.
356  */
358 
359 #if GPIO_HAL_PORT_PIN_NUMBERING
360 #define gpio_hal_arch_interrupt_enable(port, pin) \
361  gpio_hal_arch_port_interrupt_enable(port, pin)
362 #else
363 #define gpio_hal_arch_interrupt_enable(port, pin) \
364  gpio_hal_arch_no_port_interrupt_enable(pin)
365 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
366 #endif /* gpio_hal_arch_interrupt_enable */
367 /*---------------------------------------------------------------------------*/
368 #ifndef gpio_hal_arch_interrupt_disable
369 /**
370  * \brief Disable interrupts for a gpio pin
371  * \param port The GPIO port
372  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
373  *
374  * It is the platform developer's responsibility to provide an implementation.
375  *
376  * The implementation can be provided as a global symbol, an inline function
377  * or a function-like macro, as described above.
378  *
379  * \note Code should not call this function directly. Use GPIO manipulation
380  * macros instead.
381  */
383  gpio_hal_pin_t pin);
384 
385 /**
386  * \brief Disable interrupts for a gpio pin
387  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
388  *
389  * It is the platform developer's responsibility to provide an implementation.
390  *
391  * The implementation can be provided as a global symbol, an inline function
392  * or a function-like macro, as described above.
393  *
394  * \note Code should not call this function directly. Use GPIO manipulation
395  * macros instead.
396  */
398 
399 #if GPIO_HAL_PORT_PIN_NUMBERING
400 #define gpio_hal_arch_interrupt_disable(port, pin) \
401  gpio_hal_arch_port_interrupt_disable(port, pin)
402 #else
403 #define gpio_hal_arch_interrupt_disable(port, pin) \
404  gpio_hal_arch_no_port_interrupt_disable(pin)
405 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
406 #endif /* gpio_hal_arch_interrupt_disable */
407 /*---------------------------------------------------------------------------*/
408 #ifndef gpio_hal_arch_pin_cfg_set
409 /**
410  * \brief Configure a gpio pin
411  * \param port The GPIO port
412  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
413  * \param cfg The configuration
414  *
415  * \e cfg is an OR mask of GPIO_HAL_PIN_CFG_xyz
416  *
417  * The implementation of this function also has to make sure that \e pin is
418  * configured as software-controlled GPIO.
419  *
420  * It is the platform developer's responsibility to provide an implementation.
421  *
422  * The implementation can be provided as a global symbol, an inline function
423  * or a function-like macro, as described above.
424  *
425  * \note Code should not call this function directly. Use GPIO manipulation
426  * macros instead.
427  */
429  gpio_hal_pin_t pin,
430  gpio_hal_pin_cfg_t cfg);
431 
432 /**
433  * \brief Configure a gpio pin
434  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
435  * \param cfg The configuration
436  *
437  * \e cfg is an OR mask of GPIO_HAL_PIN_CFG_xyz
438  *
439  * The implementation of this function also has to make sure that \e pin is
440  * configured as software-controlled GPIO.
441  *
442  * It is the platform developer's responsibility to provide an implementation.
443  *
444  * The implementation can be provided as a global symbol, an inline function
445  * or a function-like macro, as described above.
446  *
447  * \note Code should not call this function directly. Use GPIO manipulation
448  * macros instead.
449  */
451  gpio_hal_pin_cfg_t cfg);
452 
453 #if GPIO_HAL_PORT_PIN_NUMBERING
454 #define gpio_hal_arch_pin_cfg_set(port, pin, cfg) \
455  gpio_hal_arch_port_pin_cfg_set(port, pin, cfg)
456 #else
457 #define gpio_hal_arch_pin_cfg_set(port, pin, cfg) \
458  gpio_hal_arch_no_port_pin_cfg_set(pin, cfg)
459 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
460 #endif /* gpio_hal_arch_pin_cfg_set */
461 /*---------------------------------------------------------------------------*/
462 #ifndef gpio_hal_arch_pin_cfg_get
463 /**
464  * \brief Read the configuration of a GPIO pin
465  * \param port The GPIO port
466  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
467  * \return An OR mask of GPIO_HAL_PIN_CFG_xyz
468  *
469  * It is the platform developer's responsibility to provide an implementation.
470  *
471  * The implementation can be provided as a global symbol, an inline function
472  * or a function-like macro, as described above.
473  *
474  * \note Code should not call this function directly. Use GPIO manipulation
475  * macros instead.
476  */
478  gpio_hal_pin_t pin);
479 
480 /**
481  * \brief Read the configuration of a GPIO pin
482  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
483  * \return An OR mask of GPIO_HAL_PIN_CFG_xyz
484  *
485  * It is the platform developer's responsibility to provide an implementation.
486  *
487  * The implementation can be provided as a global symbol, an inline function
488  * or a function-like macro, as described above.
489  *
490  * \note Code should not call this function directly. Use GPIO manipulation
491  * macros instead.
492  */
494 
495 #if GPIO_HAL_PORT_PIN_NUMBERING
496 #define gpio_hal_arch_pin_cfg_get(port, pin) \
497  gpio_hal_arch_port_pin_cfg_get(port, pin)
498 #else
499 #define gpio_hal_arch_pin_cfg_get(port, pin) \
500  gpio_hal_arch_no_port_pin_cfg_get(pin)
501 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
502 #endif /* gpio_hal_arch_pin_cfg_get */
503 /*---------------------------------------------------------------------------*/
504 #ifndef gpio_hal_arch_pin_set_input
505 /**
506  * \brief Configure a pin as GPIO input
507  * \param port The GPIO port
508  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
509  *
510  * The implementation of this function also has to make sure that \e pin is
511  * configured as software-controlled GPIO.
512  *
513  * It is the platform developer's responsibility to provide an implementation.
514  *
515  * The implementation can be provided as a global symbol, an inline function
516  * or a function-like macro, as described above.
517  *
518  * \note Code should not call this function directly. Use GPIO manipulation
519  * macros instead.
520  */
522  gpio_hal_pin_t pin);
523 
524 /**
525  * \brief Configure a pin as GPIO input
526  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
527  *
528  * The implementation of this function also has to make sure that \e pin is
529  * configured as software-controlled GPIO.
530  *
531  * It is the platform developer's responsibility to provide an implementation.
532  *
533  * The implementation can be provided as a global symbol, an inline function
534  * or a function-like macro, as described above.
535  *
536  * \note Code should not call this function directly. Use GPIO manipulation
537  * macros instead.
538  */
540 
541 #if GPIO_HAL_PORT_PIN_NUMBERING
542 #define gpio_hal_arch_pin_set_input(port, pin) \
543  gpio_hal_arch_port_pin_set_input(port, pin)
544 #else
545 #define gpio_hal_arch_pin_set_input(port, pin) \
546  gpio_hal_arch_no_port_pin_set_input(pin)
547 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
548 #endif /* gpio_hal_arch_pin_set_input */
549 /*---------------------------------------------------------------------------*/
550 #ifndef gpio_hal_arch_pin_set_output
551 /**
552  * \brief Configure a pin as GPIO output
553  * \param port The GPIO port
554  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
555  *
556  * The implementation of this function also has to make sure that \e pin is
557  * configured as software-controlled GPIO.
558  *
559  * It is the platform developer's responsibility to provide an implementation.
560  *
561  * The implementation can be provided as a global symbol, an inline function
562  * or a function-like macro, as described above.
563  *
564  * \note Code should not call this function directly. Use GPIO manipulation
565  * macros instead.
566  */
568  gpio_hal_pin_t pin);
569 
570 /**
571  * \brief Configure a pin as GPIO output
572  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
573  *
574  * The implementation of this function also has to make sure that \e pin is
575  * configured as software-controlled GPIO.
576  *
577  * It is the platform developer's responsibility to provide an implementation.
578  *
579  * The implementation can be provided as a global symbol, an inline function
580  * or a function-like macro, as described above.
581  *
582  * \note Code should not call this function directly. Use GPIO manipulation
583  * macros instead.
584  */
586 
587 #if GPIO_HAL_PORT_PIN_NUMBERING
588 #define gpio_hal_arch_pin_set_output(port, pin) \
589  gpio_hal_arch_port_pin_set_output(port, pin)
590 #else
591 #define gpio_hal_arch_pin_set_output(port, pin) \
592  gpio_hal_arch_no_port_pin_set_output(pin)
593 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
594 #endif /* gpio_hal_arch_pin_set_output */
595 /*---------------------------------------------------------------------------*/
596 #ifndef gpio_hal_arch_set_pin
597 /**
598  * \brief Set a GPIO pin to logical high
599  * \param port The GPIO port
600  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
601  *
602  * It is the platform developer's responsibility to provide an implementation.
603  *
604  * The implementation can be provided as a global symbol, an inline function
605  * or a function-like macro, as described above.
606  *
607  * \note Code should not call this function directly. Use GPIO manipulation
608  * macros instead.
609  */
611 
612 /**
613  * \brief Set a GPIO pin to logical high
614  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
615  *
616  * It is the platform developer's responsibility to provide an implementation.
617  *
618  * The implementation can be provided as a global symbol, an inline function
619  * or a function-like macro, as described above.
620  *
621  * \note Code should not call this function directly. Use GPIO manipulation
622  * macros instead.
623  */
625 
626 #if GPIO_HAL_PORT_PIN_NUMBERING
627 #define gpio_hal_arch_set_pin(port, pin) \
628  gpio_hal_arch_port_set_pin(port, pin)
629 #else
630 #define gpio_hal_arch_set_pin(port, pin) \
631  gpio_hal_arch_no_port_set_pin(pin)
632 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
633 #endif /* gpio_hal_arch_set_pin */
634 /*---------------------------------------------------------------------------*/
635 #ifndef gpio_hal_arch_clear_pin
636 /**
637  * \brief Clear a GPIO pin (logical low)
638  * \param port The GPIO port
639  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
640  *
641  * It is the platform developer's responsibility to provide an implementation.
642  *
643  * The implementation can be provided as a global symbol, an inline function
644  * or a function-like macro, as described above.
645  *
646  * \note Code should not call this function directly. Use GPIO manipulation
647  * macros instead.
648  */
650 
651 /**
652  * \brief Clear a GPIO pin (logical low)
653  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
654  *
655  * It is the platform developer's responsibility to provide an implementation.
656  *
657  * The implementation can be provided as a global symbol, an inline function
658  * or a function-like macro, as described above.
659  *
660  * \note Code should not call this function directly. Use GPIO manipulation
661  * macros instead.
662  */
664 
665 #if GPIO_HAL_PORT_PIN_NUMBERING
666 #define gpio_hal_arch_clear_pin(port, pin) \
667  gpio_hal_arch_port_clear_pin(port, pin)
668 #else
669 #define gpio_hal_arch_clear_pin(port, pin) \
670  gpio_hal_arch_no_port_clear_pin(pin)
671 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
672 #endif /* gpio_hal_arch_clear_pin */
673 /*---------------------------------------------------------------------------*/
674 #ifndef gpio_hal_arch_toggle_pin
675 /**
676  * \brief Toggle a GPIO pin
677  * \param port The GPIO port
678  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
679  *
680  * Some MCUs allow GPIO pin toggling directly via register access. In this
681  * case, it is a good idea to provide an implementation of this function.
682  * However, a default, software-based implementation is also provided by the
683  * HAL and can be used if the MCU does not have a pin toggle register. To use
684  * the HAL function, define GPIO_HAL_ARCH_SW_TOGGLE as 1. To provide your own
685  * implementation, define GPIO_HAL_ARCH_SW_TOGGLE as 0.
686  *
687  * The implementation can be provided as a global symbol, an inline function
688  * or a function-like macro, as described above.
689  *
690  * \note Code should not call this function directly. Use GPIO manipulation
691  * macros instead.
692  */
694 
695 /**
696  * \brief Toggle a GPIO pin
697  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
698  *
699  * Some MCUs allow GPIO pin toggling directly via register access. In this
700  * case, it is a good idea to provide an implementation of this function.
701  * However, a default, software-based implementation is also provided by the
702  * HAL and can be used if the MCU does not have a pin toggle register. To use
703  * the HAL function, define GPIO_HAL_ARCH_SW_TOGGLE as 1. To provide your own
704  * implementation, define GPIO_HAL_ARCH_SW_TOGGLE as 0.
705  *
706  * The implementation can be provided as a global symbol, an inline function
707  * or a function-like macro, as described above.
708  *
709  * \note Code should not call this function directly. Use GPIO manipulation
710  * macros instead.
711  */
713 
714 #if GPIO_HAL_PORT_PIN_NUMBERING
715 #define gpio_hal_arch_toggle_pin(port, pin) \
716  gpio_hal_arch_port_toggle_pin(port, pin)
717 #else
718 #define gpio_hal_arch_toggle_pin(port, pin) \
719  gpio_hal_arch_no_port_toggle_pin(pin)
720 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
721 #endif /* gpio_hal_arch_toggle_pin */
722 /*---------------------------------------------------------------------------*/
723 #ifndef gpio_hal_arch_read_pin
724 /**
725  * \brief Read a GPIO pin
726  * \param port The GPIO port
727  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
728  * \retval 0 The pin is logical low
729  * \retval 1 The pin is logical high
730  *
731  * It is the platform developer's responsibility to provide an implementation.
732  *
733  * The implementation can be provided as a global symbol, an inline function
734  * or a function-like macro, as described above.
735  *
736  * \note Code should not call this function directly. Use GPIO manipulation
737  * macros instead.
738  */
740 
741 /**
742  * \brief Read a GPIO pin
743  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
744  * \retval 0 The pin is logical low
745  * \retval 1 The pin is logical high
746  *
747  * It is the platform developer's responsibility to provide an implementation.
748  *
749  * The implementation can be provided as a global symbol, an inline function
750  * or a function-like macro, as described above.
751  *
752  * \note Code should not call this function directly. Use GPIO manipulation
753  * macros instead.
754  */
756 
757 #if GPIO_HAL_PORT_PIN_NUMBERING
758 #define gpio_hal_arch_read_pin(port, pin) \
759  gpio_hal_arch_port_read_pin(port, pin)
760 #else
761 #define gpio_hal_arch_read_pin(port, pin) \
762  gpio_hal_arch_no_port_read_pin(pin)
763 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
764 #endif /* gpio_hal_arch_read_pin */
765 /*---------------------------------------------------------------------------*/
766 #ifndef gpio_hal_arch_write_pin
767 /**
768  * \brief Write a GPIO pin
769  * \param port The GPIO port
770  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
771  * \param value 0: Logical low; 1: Logical high
772  *
773  * It is the platform developer's responsibility to provide an implementation.
774  *
775  * The implementation can be provided as a global symbol, an inline function
776  * or a function-like macro, as described above.
777  *
778  * \note Code should not call this function directly. Use GPIO manipulation
779  * macros instead.
780  */
782  gpio_hal_pin_t pin,
783  uint8_t value);
784 
785 /**
786  * \brief Write a GPIO pin
787  * \param pin The GPIO pin number (0...GPIO_HAL_PIN_COUNT - 1)
788  * \param value 0: Logical low; 1: Logical high
789  *
790  * It is the platform developer's responsibility to provide an implementation.
791  *
792  * The implementation can be provided as a global symbol, an inline function
793  * or a function-like macro, as described above.
794  *
795  * \note Code should not call this function directly. Use GPIO manipulation
796  * macros instead.
797  */
798 void gpio_hal_arch_no_port_write_pin(gpio_hal_pin_t pin, uint8_t value);
799 
800 #if GPIO_HAL_PORT_PIN_NUMBERING
801 #define gpio_hal_arch_write_pin(port, pin, value) \
802  gpio_hal_arch_port_write_pin(port, pin, value)
803 #else
804 #define gpio_hal_arch_write_pin(port, pin, value) \
805  gpio_hal_arch_no_port_write_pin(pin, value)
806 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
807 #endif /* gpio_hal_arch_write_pin */
808 /*---------------------------------------------------------------------------*/
809 #ifndef gpio_hal_arch_set_pins
810 /**
811  * \brief Set multiple pins to logical high
812  * \param port The GPIO port
813  * \param pins An ORd pin mask of the pins to set
814  *
815  * A pin will be set to logical high if its position in \e pins is set. For
816  * example you can set pins 0 and 3 by passing 0x09.
817  *
818  * It is the platform developer's responsibility to provide an implementation.
819  *
820  * The implementation can be provided as a global symbol, an inline function
821  * or a function-like macro, as described above.
822  *
823  * \note Code should not call this function directly. Use GPIO manipulation
824  * macros instead.
825  */
827  gpio_hal_pin_mask_t pins);
828 
829 /**
830  * \brief Set multiple pins to logical high
831  * \param pins An ORd pin mask of the pins to set
832  *
833  * A pin will be set to logical high if its position in \e pins is set. For
834  * example you can set pins 0 and 3 by passing 0x09.
835  *
836  * It is the platform developer's responsibility to provide an implementation.
837  *
838  * The implementation can be provided as a global symbol, an inline function
839  * or a function-like macro, as described above.
840  *
841  * \note Code should not call this function directly. Use GPIO manipulation
842  * macros instead.
843  */
845 
846 #if GPIO_HAL_PORT_PIN_NUMBERING
847 #define gpio_hal_arch_set_pins(port, pin) \
848  gpio_hal_arch_port_set_pins(port, pin)
849 #else
850 #define gpio_hal_arch_set_pins(port, pin) \
851  gpio_hal_arch_no_port_set_pins(pin)
852 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
853 #endif /* gpio_hal_arch_set_pins */
854 /*---------------------------------------------------------------------------*/
855 #ifndef gpio_hal_arch_clear_pins
856 /**
857  * \brief Clear multiple pins to logical low
858  * \param port The GPIO port
859  * \param pins An ORd pin mask of the pins to clear
860  *
861  * A pin will be set to logical low if its position in \e pins is set. For
862  * example you can clear pins 0 and 3 by passing 0x09.
863  *
864  * It is the platform developer's responsibility to provide an implementation.
865  *
866  * The implementation can be provided as a global symbol, an inline function
867  * or a function-like macro, as described above.
868  *
869  * \note Code should not call this function directly. Use GPIO manipulation
870  * macros instead.
871  */
873  gpio_hal_pin_mask_t pins);
874 
875 /**
876  * \brief Clear multiple pins to logical low
877  * \param pins An ORd pin mask of the pins to clear
878  *
879  * A pin will be set to logical low if its position in \e pins is set. For
880  * example you can clear pins 0 and 3 by passing 0x09.
881  *
882  * It is the platform developer's responsibility to provide an implementation.
883  *
884  * The implementation can be provided as a global symbol, an inline function
885  * or a function-like macro, as described above.
886  *
887  * \note Code should not call this function directly. Use GPIO manipulation
888  * macros instead.
889  */
891 
892 #if GPIO_HAL_PORT_PIN_NUMBERING
893 #define gpio_hal_arch_clear_pins(port, pin) \
894  gpio_hal_arch_port_clear_pins(port, pin)
895 #else
896 #define gpio_hal_arch_clear_pins(port, pin) \
897  gpio_hal_arch_no_port_clear_pins(pin)
898 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
899 #endif /* gpio_hal_arch_clear_pins */
900 /*---------------------------------------------------------------------------*/
901 #ifndef gpio_hal_arch_toggle_pins
902 /**
903  * \brief Toggle multiple pins
904  * \param port The GPIO port
905  * \param pins An ORd pin mask of the pins to toggle
906  *
907  * A pin will be toggled if its position in \e pins is set. For example you
908  * can toggle pins 0 and 3 by passing 0x09.
909  *
910  * Some MCUs allow GPIO pin toggling directly via register access. In this
911  * case, it is a good idea to provide an implementation of this function.
912  * However, a default, software-based implementation is also provided by the
913  * HAL and can be used if the MCU does not have a pin toggle register. To use
914  * the HAL function, define GPIO_HAL_ARCH_SW_TOGGLE as 1. To provide your own
915  * implementation, define GPIO_HAL_ARCH_SW_TOGGLE as 0.
916  *
917  * The implementation can be provided as a global symbol, an inline function
918  * or a function-like macro, as described above.
919  *
920  * \note Code should not call this function directly. Use GPIO manipulation
921  * macros instead.
922  */
924  gpio_hal_pin_mask_t pins);
925 
926 /**
927  * \brief Toggle multiple pins
928  * \param pins An ORd pin mask of the pins to toggle
929  *
930  * A pin will be toggled if its position in \e pins is set. For example you
931  * can toggle pins 0 and 3 by passing 0x09.
932  *
933  * Some MCUs allow GPIO pin toggling directly via register access. In this
934  * case, it is a good idea to provide an implementation of this function.
935  * However, a default, software-based implementation is also provided by the
936  * HAL and can be used if the MCU does not have a pin toggle register. To use
937  * the HAL function, define GPIO_HAL_ARCH_SW_TOGGLE as 1. To provide your own
938  * implementation, define GPIO_HAL_ARCH_SW_TOGGLE as 0.
939  *
940  * The implementation can be provided as a global symbol, an inline function
941  * or a function-like macro, as described above.
942  *
943  * \note Code should not call this function directly. Use GPIO manipulation
944  * macros instead.
945  */
947 
948 #if GPIO_HAL_PORT_PIN_NUMBERING
949 #define gpio_hal_arch_toggle_pins(port, pin) \
950  gpio_hal_arch_port_toggle_pins(port, pin)
951 #else
952 #define gpio_hal_arch_toggle_pins(port, pin) \
953  gpio_hal_arch_no_port_toggle_pins(pin)
954 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
955 #endif /* gpio_hal_arch_toggle_pins */
956 /*---------------------------------------------------------------------------*/
957 #ifndef gpio_hal_arch_read_pins
958 /**
959  * \brief Read multiple pins
960  * \param port The GPIO port
961  * \param pins An ORd pin mask of the pins to read
962  * \retval An ORd mask of the pins that are high
963  *
964  * If the position of the pin in \e pins is set and the pin is logical high
965  * then the position of the pin in the return value will be set. For example,
966  * if you pass 0x09 as the value of \e pins and the return value is 0x08 then
967  * pin 3 is logical high and pin 0 is logical low.
968  *
969  * It is the platform developer's responsibility to provide an implementation.
970  *
971  * The implementation can be provided as a global symbol, an inline function
972  * or a function-like macro, as described above.
973  *
974  * \note Code should not call this function directly. Use GPIO manipulation
975  * macros instead.
976  */
978  gpio_hal_pin_mask_t pins);
979 
980 /**
981  * \brief Read multiple pins
982  * \param pins An ORd pin mask of the pins to read
983  * \retval An ORd mask of the pins that are high
984  *
985  * If the position of the pin in \e pins is set and the pin is logical high
986  * then the position of the pin in the return value will be set. For example,
987  * if you pass 0x09 as the value of \e pins and the return value is 0x08 then
988  * pin 3 is logical high and pin 0 is logical low.
989  *
990  * It is the platform developer's responsibility to provide an implementation.
991  *
992  * The implementation can be provided as a global symbol, an inline function
993  * or a function-like macro, as described above.
994  *
995  * \note Code should not call this function directly. Use GPIO manipulation
996  * macros instead.
997  */
999 
1000 #if GPIO_HAL_PORT_PIN_NUMBERING
1001 #define gpio_hal_arch_read_pins(port, pin) \
1002  gpio_hal_arch_port_read_pins(port, pin)
1003 #else
1004 #define gpio_hal_arch_read_pins(port, pin) \
1005  gpio_hal_arch_no_port_read_pins(pin)
1006 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
1007 #endif /* gpio_hal_arch_read_pins */
1008 /*---------------------------------------------------------------------------*/
1009 #ifndef gpio_hal_arch_write_pins
1010 /**
1011  * \brief Write multiple pins
1012  * \param port The GPIO port
1013  * \param pins An ORd pin mask of the pins to write
1014  * \param value An ORd mask of the value to write
1015  *
1016  * The function will modify GPIO pins that have their position in the mask set.
1017  * pins, the function will write the value specified in the corresponding
1018  * position in \e value.
1019 
1020  * For example, you can set pin 3 and clear pin 0 by a single call to this
1021  * function. To achieve this, \e pins must be 0x09 and \e value 0x08.
1022  *
1023  * It is the platform developer's responsibility to provide an implementation.
1024  *
1025  * There is no guarantee that this function will result in an atomic operation.
1026  *
1027  * The implementation can be provided as a global symbol, an inline function
1028  * or a function-like macro, as described above.
1029  *
1030  * \note Code should not call this function directly. Use GPIO manipulation
1031  * macros instead.
1032  */
1034  gpio_hal_pin_mask_t pins,
1035  gpio_hal_pin_mask_t value);
1036 
1037 /**
1038  * \brief Write multiple pins
1039  * \param pins An ORd pin mask of the pins to write
1040  * \param value An ORd mask of the value to write
1041  *
1042  * The function will modify GPIO pins that have their position in the mask set.
1043  * pins, the function will write the value specified in the corresponding
1044  * position in \e value.
1045 
1046  * For example, you can set pin 3 and clear pin 0 by a single call to this
1047  * function. To achieve this, \e pins must be 0x09 and \e value 0x08.
1048  *
1049  * It is the platform developer's responsibility to provide an implementation.
1050  *
1051  * There is no guarantee that this function will result in an atomic operation.
1052  *
1053  * The implementation can be provided as a global symbol, an inline function
1054  * or a function-like macro, as described above.
1055  *
1056  * \note Code should not call this function directly. Use GPIO manipulation
1057  * macros instead.
1058  */
1060  gpio_hal_pin_mask_t value);
1061 
1062 #if GPIO_HAL_PORT_PIN_NUMBERING
1063 #define gpio_hal_arch_write_pins(port, pin, value) \
1064  gpio_hal_arch_port_write_pins(port, pin, value)
1065 #else
1066 #define gpio_hal_arch_write_pins(port, pin, value) \
1067  gpio_hal_arch_no_port_write_pins(pin, value)
1068 #endif /* GPIO_HAL_PORT_PIN_NUMBERING */
1069 #endif /* gpio_hal_arch_write_pins */
1070 /** @} */
1071 /*---------------------------------------------------------------------------*/
1072 #endif /* GPIO_HAL_H_ */
1073 /*---------------------------------------------------------------------------*/
1074 /**
1075  * @}
1076  * @}
1077  */
Datatype for GPIO event handlers.
Definition: gpio-hal.h:180
void gpio_hal_arch_init(void)
Perform architecture specific gpio initaliaztion.
Definition: gpio-hal-arch.c:46
void gpio_hal_arch_no_port_pin_cfg_set(gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg)
Configure a gpio pin.
Definition: gpio-hal-arch.c:48
void gpio_hal_arch_no_port_set_pin(gpio_hal_pin_t pin)
Set a GPIO pin to logical high.
void gpio_hal_arch_no_port_clear_pins(gpio_hal_pin_mask_t pins)
Clear multiple pins to logical low.
void gpio_hal_arch_port_toggle_pin(gpio_hal_port_t port, gpio_hal_pin_t pin)
Toggle a GPIO pin.
gpio_hal_pin_mask_t gpio_hal_arch_no_port_read_pins(gpio_hal_pin_mask_t pins)
Read multiple pins.
void gpio_hal_arch_port_clear_pins(gpio_hal_port_t port, gpio_hal_pin_mask_t pins)
Clear multiple pins to logical low.
void gpio_hal_arch_port_write_pins(gpio_hal_port_t port, gpio_hal_pin_mask_t pins, gpio_hal_pin_mask_t value)
Write multiple pins.
gpio_hal_pin_cfg_t gpio_hal_arch_port_pin_cfg_get(gpio_hal_port_t port, gpio_hal_pin_t pin)
Read the configuration of a GPIO pin.
void gpio_hal_arch_no_port_toggle_pins(gpio_hal_pin_mask_t pins)
Toggle multiple pins.
void gpio_hal_arch_port_set_pin(gpio_hal_port_t port, gpio_hal_pin_t pin)
Set a GPIO pin to logical high.
void gpio_hal_arch_no_port_interrupt_enable(gpio_hal_pin_t pin)
Enable interrupts for a gpio pin.
Definition: gpio-hal-arch.c:52
uint8_t gpio_hal_port_t
A data structure that represents ports.
Definition: gpio-hal.h:110
void gpio_hal_arch_port_interrupt_enable(gpio_hal_port_t port, gpio_hal_pin_t pin)
Enable interrupts for a gpio pin.
void gpio_hal_arch_no_port_toggle_pin(gpio_hal_pin_t pin)
Toggle a GPIO pin.
void gpio_hal_init()
Initialise the GPIO HAL.
Definition: gpio-hal.c:95
void gpio_hal_register_handler(gpio_hal_event_handler_t *handler)
Register a function to be called whenever a pin triggers an event.
Definition: gpio-hal.c:55
void gpio_hal_arch_no_port_write_pins(gpio_hal_pin_mask_t pins, gpio_hal_pin_mask_t value)
Write multiple pins.
void gpio_hal_arch_no_port_set_pins(gpio_hal_pin_mask_t pins)
Set multiple pins to logical high.
void gpio_hal_arch_no_port_pin_set_output(gpio_hal_pin_t pin)
Configure a pin as GPIO output.
void gpio_hal_arch_port_write_pin(gpio_hal_port_t port, gpio_hal_pin_t pin, uint8_t value)
Write a GPIO pin.
void gpio_hal_arch_port_pin_set_input(gpio_hal_port_t port, gpio_hal_pin_t pin)
Configure a pin as GPIO input.
void gpio_hal_arch_port_clear_pin(gpio_hal_port_t port, gpio_hal_pin_t pin)
Clear a GPIO pin (logical low)
uint8_t gpio_hal_pin_t
GPIO pin number representation.
Definition: gpio-hal.h:103
gpio_hal_pin_cfg_t gpio_hal_arch_no_port_pin_cfg_get(gpio_hal_pin_t pin)
Read the configuration of a GPIO pin.
Definition: gpio-hal-arch.c:97
void gpio_hal_arch_no_port_write_pin(gpio_hal_pin_t pin, uint8_t value)
Write a GPIO pin.
gpio_hal_pin_mask_t gpio_hal_arch_port_read_pins(gpio_hal_port_t port, gpio_hal_pin_mask_t pins)
Read multiple pins.
uint32_t gpio_hal_pin_mask_t
GPIO pin mask representation.
Definition: gpio-hal.h:142
void gpio_hal_arch_port_pin_set_output(gpio_hal_port_t port, gpio_hal_pin_t pin)
Configure a pin as GPIO output.
struct gpio_hal_event_handler_s gpio_hal_event_handler_t
Datatype for GPIO event handlers.
void gpio_hal_arch_port_toggle_pins(gpio_hal_port_t port, gpio_hal_pin_mask_t pins)
Toggle multiple pins.
void gpio_hal_arch_port_set_pins(gpio_hal_port_t port, gpio_hal_pin_mask_t pins)
Set multiple pins to logical high.
void gpio_hal_arch_port_pin_cfg_set(gpio_hal_port_t port, gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg)
Configure a gpio pin.
void gpio_hal_arch_no_port_clear_pin(gpio_hal_pin_t pin)
Clear a GPIO pin (logical low)
void gpio_hal_event_handler(gpio_hal_port_t port, gpio_hal_pin_mask_t pins)
The platform-independent GPIO event handler.
void gpio_hal_arch_port_interrupt_disable(gpio_hal_port_t port, gpio_hal_pin_t pin)
Disable interrupts for a gpio pin.
uint8_t gpio_hal_arch_no_port_read_pin(gpio_hal_pin_t pin)
Read a GPIO pin.
uint8_t gpio_hal_arch_port_read_pin(gpio_hal_port_t port, gpio_hal_pin_t pin)
Read a GPIO pin.
void gpio_hal_arch_no_port_pin_set_input(gpio_hal_pin_t pin)
Configure a pin as GPIO input.
Definition: gpio-hal-arch.c:98
uint32_t gpio_hal_pin_cfg_t
GPIO pin configuration.
Definition: gpio-hal.h:118
void gpio_hal_arch_no_port_interrupt_disable(gpio_hal_pin_t pin)
Disable interrupts for a gpio pin.
Definition: gpio-hal-arch.c:63