/***************************************************************************//** * \file cy_gpio.h * \version 1.110 * * Provides an API declaration of the GPIO driver * ******************************************************************************** * \copyright * Copyright (c) (2016-2022), Cypress Semiconductor Corporation (an Infineon company) or * an affiliate of Cypress Semiconductor Corporation. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ /** * \addtogroup group_gpio * \{ * The GPIO driver provides an API to configure and access device Input/Output pins. * * The functions and other declarations used in this driver are in cy_gpio.h. * You can include cy_pdl.h to get access to all functions * and declarations in the PDL. * * IO pins include all general purpose types such as GPIO, SIO, HSIO, AUXIO, and * their variants. * * Initialization can be performed either at the port level or by configuring the * individual pins. For efficient use of code space, port * configuration should be used in the field. Refer to the product device header files * for the list of supported ports and pins. * * A port is represented by GPIO_PRT_Type and a pin is represented by a number * 0 to 7. * * For PSoC 64 devices the the un-intended protected pins (due to constrain on PPU configuration) * are modified using PRA driver. But the GPIO diver does not modify the intended protected pins . * * - Single pin configuration is performed by using \ref Cy_GPIO_Pin_FastInit * (provide specific values) or \ref Cy_GPIO_Pin_Init (provide a filled * cy_stc_gpio_pin_config_t structure). * - An entire port can be configured using \ref Cy_GPIO_Port_Init. Provide a filled * cy_stc_gpio_prt_config_t structure. The values in the structure are * bitfields representing the desired value for each pin in the port. * - Pin configuration and management is based on the port address and pin number. * \ref Cy_GPIO_PortToAddr function can optionally be used to calculate the port * address from the port number at run-time. * - Each I/O is individually configurable to one of eight drive modes represented * by drivemode of cy_stc_gpio_pin_config_t structure. * * Once the pin/port initialization is complete, each pin can be accessed by * specifying the port (GPIO_PRT_Type) and the pin (0-7) in the provided API * functions. * * \section group_gpio_configuration Configuration Considerations * * 1. Pin multiplexing is controlled through the High-Speed IO Matrix (HSIOM) selection. * This allows the pin to connect to signal sources/sinks throughout the device, * as defined by the pin HSIOM selection options (en_hsiom_sel_t). * 2. All pins are initialized to High-Z drive mode with HSIOM connected to CPU (SW * control digital pin only) at Power-On-Reset(POR). * 3. Some API functions perform read-modify-write operations on shared port * registers. These functions are not thread safe and care must be taken when * called by the application. * 4. Digital input buffer provides a high-impedance buffer for the external * digital input. The input buffer is connected to the HSIOM for routing to * the CPU port registers and selected peripheral. Enabling the input * buffer provides possibility to read the pin state via the CPU. * If pin is connected to an analog signal, the input buffer should be * disabled to avoid crowbar currents. For more information refer to device * TRM and the device datasheet. * * Multiple pins on a port can be updated using direct port register writes with an * appropriate port mask. An example is shown below, highlighting the different ways of * configuring Port 1 pins using: * * - Initialize a Pin using cy_stc_gpio_pin_config_t structure * \snippet gpio/snippet/main.c snippet_Cy_GPIO_Pin_Init * * - Initialize entire port using cy_stc_gpio_prt_config_t structure * \snippet gpio/snippet/main.c snippet_Cy_GPIO_Port_Init * * - Port output data register * - Port output data set register * - Port output data clear register * * \snippet gpio/snippet/main.c Cy_GPIO_Snippet * * \section group_gpio_more_information More Information * * Refer to the technical reference manual (TRM) and the device datasheet. * * \section group_gpio_changelog Changelog *
| Version | Changes | Reason for Change |
|---|---|---|
| 1.110 | *Added support for SMIF GPIO PORT1 and PORT2 and reverted to GPIO inline functions. | *Code enhancement and support for new GPIO port for SMIF. | *
| 1.100 | *Added support for TRAVEO™ II Body Entry devices. * Updated pre-processor checks to check for GPIO auto-leveling capability rather than rely on IOSS version. |
* Code enhancement and support for new devices. | *
| 1.90 | *Updated APIs \ref Cy_GPIO_Port_Init, \ref Cy_GPIO_Port_Deinit, \ref Cy_GPIO_GetDrivemode. | *Fixed coverity defects. | *
| 1.80 | *Updated \ref Cy_GPIO_SetDrivemode and \ref Cy_GPIO_GetDrivemode APIs. | *Updated drive mode configuration for CAT1D devices. | *
| Fixed MISRA 2012 violations. | *MISRA 2012 compliance. | *|
| 1.70 | *Updated driver to support the CAT1D family of devices. | *Added new family of devices. | *
| 1.60 | *Added \ref Cy_GPIO_SetVtripAuto and \ref Cy_GPIO_GetVtripAuto APIs for * configuring GPIO input buffer voltage for automotive compatible or not, * for CAT1C devices. | *New APIs support for CAT1C devices. | *
| Fixed unused variables error. | *Minor error fixes. | *|
| 1.50.1 | *Updated doxygen for External clock source to HF0. | *Documentation enhancement. | *
| 1.50 | *Modified \ref Cy_GPIO_Pin_Init, \ref Cy_GPIO_Pin_FastInit, and * \ref Cy_GPIO_SetDrivemode APIs to catch wrong drive modes. | *Defect fix. | *
| 1.40 | *Changes in Support of the new family of devices | *Added new family of devices | *
| Changes in support of Secure pins used for External clocks on Secure devices | *Added support for accessing External clocks protected pins | *|
| 1.30 | *Fixed/documented MISRA 2012 violations. | *MISRA 2012 compliance. | *
| 1.20.1 | *Minor documentation updates. | *Documentation enhancement. | *
| 1.20 | *Flattened the organization of the driver source code into the single source directory and the single include directory. | *Driver library directory-structure simplification. | *
| Added the functions for configuring the AMux bus splitter switch cells: * - \ref Cy_GPIO_SetAmuxSplit * - \ref Cy_GPIO_GetAmuxSplit * | *Added a new functionality related to AMux bus. | *|
| Added register access layer. Use register access macros instead * of direct register access using dereferenced pointers. | *Makes register access device-independent, so that the PDL does * not need to be recompiled for each supported part number. | *|
| 1.10.1 | *Updated description for the functions: \ref Cy_GPIO_GetInterruptStatus, * \ref Cy_GPIO_GetInterruptMask, \ref Cy_GPIO_GetInterruptStatusMasked. * * Minor documentation edits. * | *Documentation update and clarification | *
| 1.10 | *Added input parameter validation to the API functions | ** |
| 1.0 | *Initial version | ** |