1 | /** |
---|
2 | * @file lpc-gpio.h |
---|
3 | * |
---|
4 | * @ingroup lpc176x |
---|
5 | * |
---|
6 | * @brief API of the GPIO driver for the lpc176x bsp in RTEMS. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2014 Taller Technologies. |
---|
11 | * |
---|
12 | * @author Boretto Martin (martin.boretto@tallertechnologies.com) |
---|
13 | * @author Diaz Marcos (marcos.diaz@tallertechnologies.com) |
---|
14 | * @author Lenarduzzi Federico (federico.lenarduzzi@tallertechnologies.com) |
---|
15 | * @author Daniel Chicco (daniel.chicco@tallertechnologies.com) |
---|
16 | * |
---|
17 | * The license and distribution terms for this file may be |
---|
18 | * found in the file LICENSE in this distribution or at |
---|
19 | * http://www.rtems.org/license/LICENSE. |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef LIBBSP_ARM_LPC176X_GPIO_H |
---|
23 | #define LIBBSP_ARM_LPC176X_GPIO_H |
---|
24 | |
---|
25 | #include <bsp/lpc176x.h> |
---|
26 | #include <bsp/gpio-defs.h> |
---|
27 | |
---|
28 | #ifdef __cplusplus |
---|
29 | extern "C" { |
---|
30 | #endif /* __cplusplus */ |
---|
31 | |
---|
32 | /** |
---|
33 | * @brief Configures the pin as input or output GPIO. |
---|
34 | * |
---|
35 | * @param pin The pin to configure |
---|
36 | * @param dir Input or output. |
---|
37 | */ |
---|
38 | rtems_status_code lpc176x_gpio_config( |
---|
39 | lpc176x_pin_number pin, |
---|
40 | lpc176x_gpio_direction dir |
---|
41 | ); |
---|
42 | |
---|
43 | /** |
---|
44 | * @brief Configures the pin as input, enables interrupt for an |
---|
45 | * edge/s and sets isrfunct as the function to call when that |
---|
46 | * interrupt occurs. |
---|
47 | * |
---|
48 | * @param pin The pin to configure. |
---|
49 | * @param edge Which edge or edges will activate the interrupt. |
---|
50 | * @param isrfunct The function that is called when the interrupt occurs. |
---|
51 | * @return RTEMS_SUCCESSFULL if the configurations was success. |
---|
52 | */ |
---|
53 | rtems_status_code lpc176x_gpio_config_input_with_interrupt( |
---|
54 | lpc176x_pin_number pin, |
---|
55 | lpc176x_gpio_interrupt edge, |
---|
56 | lpc176x_gpio_interrupt_function isrfunct |
---|
57 | ); |
---|
58 | |
---|
59 | /** |
---|
60 | * @brief Sets the output pin to 1. |
---|
61 | * |
---|
62 | * @param pin The pin to set |
---|
63 | */ |
---|
64 | rtems_status_code lpc176x_gpio_set_pin( lpc176x_pin_number pin ); |
---|
65 | |
---|
66 | /** |
---|
67 | * @brief Sets the output pin to 0. |
---|
68 | * |
---|
69 | * @param pin The pin to set |
---|
70 | */ |
---|
71 | rtems_status_code lpc176x_gpio_clear_pin( lpc176x_pin_number pin ); |
---|
72 | |
---|
73 | /** |
---|
74 | * @brief Sets the output pin to 0 or 1 according to value. |
---|
75 | * |
---|
76 | * @param pin The pin to set |
---|
77 | * @param value the value to set. |
---|
78 | */ |
---|
79 | rtems_status_code lpc176x_gpio_write_pin( |
---|
80 | lpc176x_pin_number pin, |
---|
81 | bool value |
---|
82 | ); |
---|
83 | |
---|
84 | /** |
---|
85 | * @brief Returns the value at the given input pin. |
---|
86 | * |
---|
87 | * @param pin The pin where to read the value. |
---|
88 | * @param pin_value TRUE if the pin value was getted successfuly. |
---|
89 | * @return RTEMS_SUCCESSFUL if the pin value was getted successfuly. |
---|
90 | */ |
---|
91 | rtems_status_code lpc176x_gpio_get_pin_value( |
---|
92 | lpc176x_pin_number pin, |
---|
93 | bool *pin_value |
---|
94 | ); |
---|
95 | |
---|
96 | #ifdef __cplusplus |
---|
97 | } |
---|
98 | #endif /* __cplusplus */ |
---|
99 | |
---|
100 | #endif /* LIBBSP_ARM_LPC176X_GPIO_H */ |
---|