Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:03

0001 /**
0002  * @file
0003  *
0004  * @ingroup RTEMSBSPsARMLPC176X
0005  *
0006  * @brief API of the GPIO driver for the lpc176x bsp in RTEMS.
0007  */
0008 
0009 /*
0010  * Copyright (c) 2014 Taller Technologies.
0011  *
0012  * @author  Boretto Martin    (martin.boretto@tallertechnologies.com)
0013  * @author  Diaz Marcos (marcos.diaz@tallertechnologies.com)
0014  * @author  Lenarduzzi Federico  (federico.lenarduzzi@tallertechnologies.com)
0015  * @author  Daniel Chicco  (daniel.chicco@tallertechnologies.com)
0016  *
0017  * The license and distribution terms for this file may be
0018  * found in the file LICENSE in this distribution or at
0019  * http://www.rtems.org/license/LICENSE.
0020  */
0021 
0022 #ifndef LIBBSP_ARM_LPC176X_GPIO_H
0023 #define LIBBSP_ARM_LPC176X_GPIO_H
0024 
0025 #include <bsp/lpc176x.h>
0026 #include <bsp/gpio-defs.h>
0027 
0028 #ifdef __cplusplus
0029 extern "C" {
0030 #endif /* __cplusplus */
0031 
0032 /**
0033  * @brief Configures the pin as input or output GPIO.
0034  *
0035  * @param pin The pin to configure
0036  * @param dir Input or output.
0037  */
0038 rtems_status_code lpc176x_gpio_config(
0039   lpc176x_pin_number     pin,
0040   lpc176x_gpio_direction dir
0041 );
0042 
0043 /**
0044  * @brief Configures the pin as input, enables interrupt for an
0045  * edge/s and sets isrfunct as the function to call when that
0046  * interrupt occurs.
0047  *
0048  * @param pin The pin to configure.
0049  * @param edge Which edge or edges will activate the interrupt.
0050  * @param isrfunct The function that is called when the interrupt occurs.
0051  * @return RTEMS_SUCCESSFULL if the configurations was success.
0052  */
0053 rtems_status_code lpc176x_gpio_config_input_with_interrupt(
0054   lpc176x_pin_number              pin,
0055   lpc176x_gpio_interrupt          edge,
0056   lpc176x_gpio_interrupt_function isrfunct
0057 );
0058 
0059 /**
0060  * @brief Sets the output pin to 1.
0061  *
0062  * @param pin The pin to set
0063  */
0064 rtems_status_code lpc176x_gpio_set_pin( lpc176x_pin_number pin );
0065 
0066 /**
0067  * @brief Sets the output pin to 0.
0068  *
0069  * @param pin The pin to set
0070  */
0071 rtems_status_code lpc176x_gpio_clear_pin( lpc176x_pin_number pin );
0072 
0073 /**
0074  * @brief Sets the output pin to 0 or 1 according to value.
0075  *
0076  * @param pin The pin to set
0077  * @param value the value to set.
0078  */
0079 rtems_status_code lpc176x_gpio_write_pin(
0080   lpc176x_pin_number pin,
0081   bool               value
0082 );
0083 
0084 /**
0085  * @brief Returns the value at the given input pin.
0086  *
0087  * @param pin The pin where to read the value.
0088  * @param pin_value TRUE if the pin value was getted successfuly.
0089  * @return RTEMS_SUCCESSFUL if the pin value was getted successfuly.
0090  */
0091 rtems_status_code lpc176x_gpio_get_pin_value(
0092   lpc176x_pin_number pin,
0093   bool              *pin_value
0094 );
0095 
0096 #ifdef __cplusplus
0097 }
0098 #endif /* __cplusplus */
0099 
0100 #endif /* LIBBSP_ARM_LPC176X_GPIO_H */