Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ADMX2001
gpio.h
00001 /***************************************************************************//** 00002 * @file gpio.h 00003 * @author DBogdan (dragos.bogdan@analog.com) 00004 ******************************************************************************** 00005 * Copyright 2019(c) Analog Devices, Inc. 00006 * 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions are met: 00011 * - Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * - Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in 00015 * the documentation and/or other materials provided with the 00016 * distribution. 00017 * - Neither the name of Analog Devices, Inc. nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * - The use of this software may or may not infringe the patent rights 00021 * of one or more patent holders. This license does not release you 00022 * from the requirement that you obtain separate licenses from these 00023 * patent holders to use this software. 00024 * - Use of the software either in source or binary form, must be run 00025 * on or directly connected to an Analog Devices Inc. component. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR 00028 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, 00029 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00030 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, 00031 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00032 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR 00033 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00034 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00035 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00036 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00037 *******************************************************************************/ 00038 00039 #ifndef GPIO_H_ 00040 #define GPIO_H_ 00041 00042 /******************************************************************************/ 00043 /***************************** Include Files **********************************/ 00044 /******************************************************************************/ 00045 00046 #include <stdint.h> 00047 00048 /******************************************************************************/ 00049 /********************** Macros and Constants Definitions **********************/ 00050 /******************************************************************************/ 00051 00052 #define GPIO_OUT 0x01 00053 #define GPIO_IN 0x00 00054 00055 #define GPIO_HIGH 0x01 00056 #define GPIO_LOW 0x00 00057 00058 /******************************************************************************/ 00059 /*************************** Types Declarations *******************************/ 00060 /******************************************************************************/ 00061 00062 typedef struct gpio_init_param { 00063 uint8_t number; 00064 void *extra; 00065 } gpio_init_param; 00066 00067 typedef struct gpio_desc { 00068 uint8_t number; 00069 void *extra; 00070 } gpio_desc; 00071 00072 /******************************************************************************/ 00073 /************************ Functions Declarations ******************************/ 00074 /******************************************************************************/ 00075 00076 /* Obtain the GPIO decriptor. */ 00077 int32_t gpio_get(struct gpio_desc **desc, 00078 const gpio_init_param *param); 00079 00080 /* Free the resources allocated by gpio_get() */ 00081 int32_t gpio_remove(struct gpio_desc *desc); 00082 00083 /* Enable the input direction of the specified GPIO. */ 00084 int32_t gpio_direction_input(struct gpio_desc *desc); 00085 00086 /* Enable the output direction of the specified GPIO. */ 00087 int32_t gpio_direction_output(struct gpio_desc *desc, 00088 uint8_t value); 00089 00090 /* Get the direction of the specified GPIO. */ 00091 int32_t gpio_get_direction(struct gpio_desc *desc, 00092 uint8_t *direction); 00093 00094 /* Set the value of the specified GPIO. */ 00095 int32_t gpio_set_value(struct gpio_desc *desc, 00096 uint8_t value); 00097 00098 /* Get the value of the specified GPIO. */ 00099 int32_t gpio_get_value(struct gpio_desc *desc, 00100 uint8_t *value); 00101 00102 #endif // GPIO_H_
Generated on Tue Jul 12 2022 17:25:36 by
1.7.2