|
@@ -2,7 +2,7 @@
|
|
|
//
|
|
|
// gpio.c - API for GPIO ports
|
|
|
//
|
|
|
-// Copyright (c) 2005-2014 Texas Instruments Incorporated. All rights reserved.
|
|
|
+// Copyright (c) 2005-2017 Texas Instruments Incorporated. All rights reserved.
|
|
|
// Software License Agreement
|
|
|
//
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
@@ -33,7 +33,7 @@
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
//
|
|
|
-// This is part of revision 2.1.0.12573 of the Tiva Peripheral Driver Library.
|
|
|
+// This is part of revision 2.1.4.178 of the Tiva Peripheral Driver Library.
|
|
|
//
|
|
|
//*****************************************************************************
|
|
|
|
|
@@ -116,6 +116,9 @@ static const uint32_t g_ppui32GPIOIntMapSnowflake[][2] =
|
|
|
{ GPIO_PORTN_BASE, INT_GPION_TM4C129 },
|
|
|
{ GPIO_PORTP_BASE, INT_GPIOP0_TM4C129 },
|
|
|
{ GPIO_PORTQ_BASE, INT_GPIOQ0_TM4C129 },
|
|
|
+ { GPIO_PORTR_BASE, INT_GPIOR_TM4C129 },
|
|
|
+ { GPIO_PORTS_BASE, INT_GPIOS_TM4C129 },
|
|
|
+ { GPIO_PORTT_BASE, INT_GPIOT_TM4C129 },
|
|
|
};
|
|
|
static const uint_fast32_t g_ui32GPIOIntMapSnowflakeRows =
|
|
|
(sizeof(g_ppui32GPIOIntMapSnowflake) /
|
|
@@ -406,11 +409,14 @@ GPIOIntTypeSet(uint32_t ui32Port, uint8_t ui8Pins,
|
|
|
// Check the arguments.
|
|
|
//
|
|
|
ASSERT(_GPIOBaseValid(ui32Port));
|
|
|
- ASSERT((ui32IntType == GPIO_FALLING_EDGE) ||
|
|
|
- (ui32IntType == GPIO_RISING_EDGE) ||
|
|
|
- (ui32IntType == GPIO_BOTH_EDGES) ||
|
|
|
- (ui32IntType == GPIO_LOW_LEVEL) ||
|
|
|
- (ui32IntType == GPIO_HIGH_LEVEL));
|
|
|
+ ASSERT(((ui32IntType & 0xF) == GPIO_FALLING_EDGE) ||
|
|
|
+ ((ui32IntType & 0xF) == GPIO_RISING_EDGE) ||
|
|
|
+ ((ui32IntType & 0xF) == GPIO_BOTH_EDGES) ||
|
|
|
+ ((ui32IntType & 0xF) == GPIO_LOW_LEVEL) ||
|
|
|
+ ((ui32IntType & 0xF) == GPIO_HIGH_LEVEL));
|
|
|
+ ASSERT(((ui32IntType & 0x000F0000) == 0) ||
|
|
|
+ (((ui32IntType & 0x000F0000) == GPIO_DISCRETE_INT) &&
|
|
|
+ ((ui32Port == GPIO_PORTP_BASE) || (ui32Port == GPIO_PORTQ_BASE))));
|
|
|
|
|
|
//
|
|
|
// Set the pin interrupt type.
|
|
@@ -981,6 +987,99 @@ GPIOIntUnregister(uint32_t ui32Port)
|
|
|
IntUnregister(ui32Int);
|
|
|
}
|
|
|
|
|
|
+//*****************************************************************************
|
|
|
+//
|
|
|
+//! Registers an interrupt handler for an individual pin of a GPIO port.
|
|
|
+//!
|
|
|
+//! \param ui32Port is the base address of the GPIO port.
|
|
|
+//! \param ui32Pin is the pin whose interrupt is to be registered.
|
|
|
+//! \param pfnIntHandler is a pointer to the GPIO port interrupt handling
|
|
|
+//! function.
|
|
|
+//!
|
|
|
+//! This function ensures that the interrupt handler specified by
|
|
|
+//! \e pfnIntHandler is called when an interrupt is detected from the selected
|
|
|
+//! pin of a GPIO port. This function also enables the corresponding GPIO pin
|
|
|
+//! interrupt in the interrupt controller.
|
|
|
+//!
|
|
|
+//! \sa IntRegister() for important information about registering interrupt
|
|
|
+//! handlers.
|
|
|
+//!
|
|
|
+//! \return None.
|
|
|
+//
|
|
|
+//*****************************************************************************
|
|
|
+void
|
|
|
+GPIOIntRegisterPin(uint32_t ui32Port, uint32_t ui32Pin,
|
|
|
+ void (*pfnIntHandler)(void))
|
|
|
+{
|
|
|
+ uint32_t ui32Int;
|
|
|
+
|
|
|
+ //
|
|
|
+ // Check the arguments.
|
|
|
+ //
|
|
|
+ ASSERT((ui32Port == GPIO_PORTP_BASE) || (ui32Port == GPIO_PORTQ_BASE));
|
|
|
+ ASSERT((ui32Pin > 0) && (ui32Pin < 8));
|
|
|
+ ASSERT(pfnIntHandler != 0);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Get the interrupt number associated with the specified GPIO.
|
|
|
+ //
|
|
|
+ ui32Int = _GPIOIntNumberGet(ui32Port);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Register the interrupt handler.
|
|
|
+ //
|
|
|
+ IntRegister((ui32Int + ui32Pin), pfnIntHandler);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Enable the GPIO pin interrupt.
|
|
|
+ //
|
|
|
+ IntEnable(ui32Int + ui32Pin);
|
|
|
+}
|
|
|
+
|
|
|
+//*****************************************************************************
|
|
|
+//
|
|
|
+//! Removes an interrupt handler for an individual pin of a GPIO port.
|
|
|
+//!
|
|
|
+//! \param ui32Port is the base address of the GPIO port.
|
|
|
+//! \param ui32Pin is the pin whose interrupt is to be unregistered.
|
|
|
+//!
|
|
|
+//! This function unregisters the interrupt handler for the specified pin of a
|
|
|
+//! GPIO port. This function also disables the corresponding GPIO pin
|
|
|
+//! interrupt in the interrupt controller.
|
|
|
+//!
|
|
|
+//! \sa IntRegister() for important information about registering interrupt
|
|
|
+//! handlers.
|
|
|
+//!
|
|
|
+//! \return None.
|
|
|
+//
|
|
|
+//*****************************************************************************
|
|
|
+void
|
|
|
+GPIOIntUnregisterPin(uint32_t ui32Port, uint32_t ui32Pin)
|
|
|
+{
|
|
|
+ uint32_t ui32Int;
|
|
|
+
|
|
|
+ //
|
|
|
+ // Check the arguments.
|
|
|
+ //
|
|
|
+ ASSERT((ui32Port == GPIO_PORTP_BASE) || (ui32Port == GPIO_PORTQ_BASE));
|
|
|
+ ASSERT((ui32Pin > 0) && (ui32Pin < 8));
|
|
|
+
|
|
|
+ //
|
|
|
+ // Get the interrupt number associated with the specified GPIO.
|
|
|
+ //
|
|
|
+ ui32Int = _GPIOIntNumberGet(ui32Port);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Disable the GPIO pin interrupt.
|
|
|
+ //
|
|
|
+ IntDisable(ui32Int + ui32Pin);
|
|
|
+
|
|
|
+ //
|
|
|
+ // UnRegister the interrupt handler.
|
|
|
+ //
|
|
|
+ IntUnregister(ui32Int + ui32Pin);
|
|
|
+}
|
|
|
+
|
|
|
//*****************************************************************************
|
|
|
//
|
|
|
//! Reads the values present of the specified pin(s).
|
|
@@ -1199,6 +1298,78 @@ GPIOPinTypeComparator(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
GPIO_PIN_TYPE_ANALOG);
|
|
|
}
|
|
|
|
|
|
+//*****************************************************************************
|
|
|
+//
|
|
|
+//! Configures pin(s) for use as an analog comparator output.
|
|
|
+//!
|
|
|
+//! \param ui32Port is the base address of the GPIO port.
|
|
|
+//! \param ui8Pins is the bit-packed representation of the pin(s).
|
|
|
+//!
|
|
|
+//! The analog comparator output pins must be properly configured for the analog
|
|
|
+//! comparator to function correctly. This function provides the proper
|
|
|
+//! configuration for those pin(s).
|
|
|
+//!
|
|
|
+//! The pin(s) are specified using a bit-packed byte, where each bit that is
|
|
|
+//! set identifies the pin to be accessed, and where bit 0 of the byte
|
|
|
+//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
|
|
+//!
|
|
|
+//! \return None.
|
|
|
+//
|
|
|
+//*****************************************************************************
|
|
|
+void GPIOPinTypeComparatorOutput(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
+{
|
|
|
+ //
|
|
|
+ // Check the arguments.
|
|
|
+ //
|
|
|
+ ASSERT(_GPIOBaseValid(ui32Port));
|
|
|
+
|
|
|
+ //
|
|
|
+ // Make the pin(s) be inputs.
|
|
|
+ //
|
|
|
+ GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Set the pad(s) for standard push-pull operation.
|
|
|
+ //
|
|
|
+ GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
|
|
|
+}
|
|
|
+
|
|
|
+//*****************************************************************************
|
|
|
+//
|
|
|
+//! Configures pin(s) for use as an clock to be output from the device.
|
|
|
+//!
|
|
|
+//! \param ui32Port is the base address of the GPIO port.
|
|
|
+//! \param ui8Pins is the bit-packed representation of the pin(s).
|
|
|
+//!
|
|
|
+//! The system control output pin must be properly configured for the DIVSCLK to
|
|
|
+//! function correctly. This function provides the proper configuration for
|
|
|
+//! those pin(s).
|
|
|
+//!
|
|
|
+//! The pin(s) are specified using a bit-packed byte, where each bit that is
|
|
|
+//! set identifies the pin to be accessed, and where bit 0 of the byte
|
|
|
+//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
|
|
+//!
|
|
|
+//! \return None.
|
|
|
+//
|
|
|
+//*****************************************************************************
|
|
|
+void GPIOPinTypeDIVSCLK(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
+{
|
|
|
+ //
|
|
|
+ // Check the arguments.
|
|
|
+ //
|
|
|
+ ASSERT(_GPIOBaseValid(ui32Port));
|
|
|
+
|
|
|
+ //
|
|
|
+ // Make the pin(s) be inputs.
|
|
|
+ //
|
|
|
+ GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Set the pad(s) for standard push-pull operation.
|
|
|
+ //
|
|
|
+ GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
|
|
|
+}
|
|
|
+
|
|
|
//*****************************************************************************
|
|
|
//
|
|
|
//! Configures pin(s) for use by the external peripheral interface.
|
|
@@ -1487,6 +1658,42 @@ GPIOPinTypeGPIOOutputOD(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_OUT);
|
|
|
}
|
|
|
|
|
|
+//*****************************************************************************
|
|
|
+//
|
|
|
+//! Configures pin(s) for use as an Hibernate RTC Clock.
|
|
|
+//!
|
|
|
+//! \param ui32Port is the base address of the GPIO port.
|
|
|
+//! \param ui8Pins is the bit-packed representation of the pin(s).
|
|
|
+//!
|
|
|
+//! The hibernate output pin must be properly configured for the RTCCLK to
|
|
|
+//! function correctly. This function provides the proper configuration for the
|
|
|
+//! RTC Clock to be output from the device.
|
|
|
+//!
|
|
|
+//! The pin(s) are specified using a bit-packed byte, where each bit that is
|
|
|
+//! set identifies the pin to be accessed, and where bit 0 of the byte
|
|
|
+//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
|
|
+//!
|
|
|
+//! \return None.
|
|
|
+//
|
|
|
+//*****************************************************************************
|
|
|
+void GPIOPinTypeHibernateRTCCLK(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
+{
|
|
|
+ //
|
|
|
+ // Check the arguments.
|
|
|
+ //
|
|
|
+ ASSERT(_GPIOBaseValid(ui32Port));
|
|
|
+
|
|
|
+ //
|
|
|
+ // Make the pin(s) be inputs.
|
|
|
+ //
|
|
|
+ GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Set the pad(s) for standard push-pull operation.
|
|
|
+ //
|
|
|
+ GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
|
|
|
+}
|
|
|
+
|
|
|
//*****************************************************************************
|
|
|
//
|
|
|
//! Configures pin for use as SDA by the I2C peripheral.
|
|
@@ -1640,24 +1847,24 @@ GPIOPinTypeLCD(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
|
|
|
//*****************************************************************************
|
|
|
//
|
|
|
-//! Configures pin(s) for use by the LPC module.
|
|
|
+//! Configures pin(s) for use by the 1-Wire module.
|
|
|
//!
|
|
|
//! \param ui32Port is the base address of the GPIO port.
|
|
|
//! \param ui8Pins is the bit-packed representation of the pin(s).
|
|
|
//!
|
|
|
-//! The LPC pins must be properly configured for the LPC module to function
|
|
|
-//! correctly. This function provides a typical configuration for those
|
|
|
-//! pin(s); other configurations may work as well depending upon the board
|
|
|
-//! setup (for example, using the on-chip pull-ups).
|
|
|
+//! The 1-Wire pin must be properly configured for the 1-Wire peripheral to
|
|
|
+//! function correctly. This function provides a typical configuration for
|
|
|
+//! those pin(s); other configurations may work as well depending upon the
|
|
|
+//! board setup (for example, using the on-chip pull-ups).
|
|
|
//!
|
|
|
//! The pin(s) are specified using a bit-packed byte, where each bit that is
|
|
|
//! set identifies the pin to be accessed, and where bit 0 of the byte
|
|
|
//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
|
|
//!
|
|
|
-//! \note This function cannot be used to turn any pin into an LPC pin; it only
|
|
|
-//! configures an LPC pin for proper operation. Note that a GPIOPinConfigure()
|
|
|
-//! function call is also required to properly configure a pin for the LPC
|
|
|
-//! function.
|
|
|
+//! \note This function cannot be used to turn any pin into a 1-Wire pin; it
|
|
|
+//! only configures a 1-Wire pin for proper operation. Note that a
|
|
|
+//! GPIOPinConfigure() function call is also required to properly configure a
|
|
|
+//! pin for the 1-Wire function.
|
|
|
//!
|
|
|
//! \note A subset of GPIO pins on Tiva devices, notably those used by the
|
|
|
//! JTAG/SWD interface and any pin capable of acting as an NMI input, are
|
|
@@ -1671,7 +1878,7 @@ GPIOPinTypeLCD(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
//
|
|
|
//*****************************************************************************
|
|
|
void
|
|
|
-GPIOPinTypeLPC(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
+GPIOPinTypeOneWire(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
{
|
|
|
//
|
|
|
// Check the arguments.
|
|
@@ -1686,107 +1893,6 @@ GPIOPinTypeLPC(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
//
|
|
|
// Set the pad(s) for standard push-pull operation.
|
|
|
//
|
|
|
- GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
|
|
|
-}
|
|
|
-
|
|
|
-//*****************************************************************************
|
|
|
-//
|
|
|
-//! Configures a pin for receive use by the PECI module.
|
|
|
-//!
|
|
|
-//! \param ui32Port is the base address of the GPIO port.
|
|
|
-//! \param ui8Pins is the bit-packed representation of the pin(s).
|
|
|
-//!
|
|
|
-//! The PECI receive pin must be properly configured for the PECI module to
|
|
|
-//! function correctly. This function provides a typical configuration for
|
|
|
-//! that pin.
|
|
|
-//!
|
|
|
-//! The pin is specified using a bit-packed byte, where each bit that is set
|
|
|
-//! identifies the pin to be accessed, and where bit 0 of the byte represents
|
|
|
-//! GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
|
|
-//!
|
|
|
-//! \note This function cannot be used to turn any pin into a PECI receive pin;
|
|
|
-//! it only configures a PECI receive pin for proper operation. Note that a
|
|
|
-//! GPIOPinConfigure() function call is also required to properly configure a
|
|
|
-//! pin for the PECI receive function.
|
|
|
-//!
|
|
|
-//! \note A subset of GPIO pins on Tiva devices, notably those used by the
|
|
|
-//! JTAG/SWD interface and any pin capable of acting as an NMI input, are
|
|
|
-//! locked against inadvertent reconfiguration. These pins must be unlocked
|
|
|
-//! using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR
|
|
|
-//! registers before this function can be called. Please see the ``gpio_jtag''
|
|
|
-//! example application for the mechanism required and consult your part
|
|
|
-//! datasheet for information on affected pins.
|
|
|
-//!
|
|
|
-//! \return None.
|
|
|
-//
|
|
|
-//*****************************************************************************
|
|
|
-void
|
|
|
-GPIOPinTypePECIRx(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
-{
|
|
|
- //
|
|
|
- // Check the arguments.
|
|
|
- //
|
|
|
- ASSERT(_GPIOBaseValid(ui32Port));
|
|
|
-
|
|
|
- //
|
|
|
- // Make the pin(s) be inputs.
|
|
|
- //
|
|
|
- GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_IN);
|
|
|
-
|
|
|
- //
|
|
|
- // Set the pad(s) for analog operation.
|
|
|
- //
|
|
|
- GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA,
|
|
|
- GPIO_PIN_TYPE_ANALOG);
|
|
|
-}
|
|
|
-
|
|
|
-//*****************************************************************************
|
|
|
-//
|
|
|
-//! Configures a pin for transmit use by the PECI module.
|
|
|
-//!
|
|
|
-//! \param ui32Port is the base address of the GPIO port.
|
|
|
-//! \param ui8Pins is the bit-packed representation of the pin(s).
|
|
|
-//!
|
|
|
-//! The PECI transmit pin must be properly configured for the PECI module to
|
|
|
-//! function correctly. This function provides a typical configuration for
|
|
|
-//! that pin.
|
|
|
-//!
|
|
|
-//! The pin is specified using a bit-packed byte, where each bit that is set
|
|
|
-//! identifies the pin to be accessed, and where bit 0 of the byte represents
|
|
|
-//! GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
|
|
-//!
|
|
|
-//! \note This function cannot be used to turn any pin into a PECI transmit
|
|
|
-//! pin; it only configures a PECI transmit pin for proper operation. Note
|
|
|
-//! that a GPIOPinConfigure() function call is also required to properly
|
|
|
-//! configure the pin for the PECI transmit function.
|
|
|
-//!
|
|
|
-//! \note A subset of GPIO pins on Tiva devices, notably those used by the
|
|
|
-//! JTAG/SWD interface and any pin capable of acting as an NMI input, are
|
|
|
-//! locked against inadvertent reconfiguration. These pins must be unlocked
|
|
|
-//! using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR
|
|
|
-//! registers before this function can be called. Please see the ``gpio_jtag''
|
|
|
-//! example application for the mechanism required and consult your part
|
|
|
-//! datasheet for information on affected pins.
|
|
|
-//!
|
|
|
-//! \return None.
|
|
|
-//
|
|
|
-//*****************************************************************************
|
|
|
-void
|
|
|
-GPIOPinTypePECITx(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
-{
|
|
|
- //
|
|
|
- // Check the arguments.
|
|
|
- //
|
|
|
- ASSERT(_GPIOBaseValid(ui32Port));
|
|
|
-
|
|
|
- //
|
|
|
- // Make the pin(s) be inputs.
|
|
|
- //
|
|
|
- GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
|
|
|
-
|
|
|
- //
|
|
|
- // Set the pad(s) for analog operation.
|
|
|
- //
|
|
|
GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
|
|
|
}
|
|
|
|
|
@@ -1995,6 +2101,56 @@ GPIOPinTypeTimer(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
|
|
|
}
|
|
|
|
|
|
+//*****************************************************************************
|
|
|
+//
|
|
|
+//! Configures pin(s) for use by the Trace peripheral.
|
|
|
+//!
|
|
|
+//! \param ui32Port is the base address of the GPIO port.
|
|
|
+//! \param ui8Pins is the bit-packed representation of the pin(s).
|
|
|
+//!
|
|
|
+//! The Trace pins must be properly configured for the Trace peripheral to
|
|
|
+//! function correctly. This function provides a typical configuration for
|
|
|
+//! those pin(s).
|
|
|
+//!
|
|
|
+//! The pin(s) are specified using a bit-packed byte, where each bit that is
|
|
|
+//! set identifies the pin to be accessed, and where bit 0 of the byte
|
|
|
+//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
|
|
+//!
|
|
|
+//! \note This function cannot be used to turn any pin into a trace pin; it
|
|
|
+//! only configures a trace pin for proper operation. Note that a
|
|
|
+//! GPIOPinConfigure() function call is also required to properly configure a
|
|
|
+//! pin for the Trace function.
|
|
|
+//!
|
|
|
+//! \note A subset of GPIO pins on Tiva devices, notably those used by the
|
|
|
+//! JTAG/SWD interface and any pin capable of acting as an NMI input, are
|
|
|
+//! locked against inadvertent reconfiguration. These pins must be unlocked
|
|
|
+//! using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR
|
|
|
+//! registers before this function can be called. Please see the ``gpio_jtag''
|
|
|
+//! example application for the mechanism required and consult your part
|
|
|
+//! datasheet for information on affected pins.
|
|
|
+//!
|
|
|
+//! \return None.
|
|
|
+//
|
|
|
+//*****************************************************************************
|
|
|
+void
|
|
|
+GPIOPinTypeTrace(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
+{
|
|
|
+ //
|
|
|
+ // Check the arguments.
|
|
|
+ //
|
|
|
+ ASSERT(_GPIOBaseValid(ui32Port));
|
|
|
+
|
|
|
+ //
|
|
|
+ // Make the pin(s) be peripheral controlled.
|
|
|
+ //
|
|
|
+ GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
|
|
|
+
|
|
|
+ //
|
|
|
+ // Set the pad(s) for standard push-pull operation.
|
|
|
+ //
|
|
|
+ GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
|
|
|
+}
|
|
|
+
|
|
|
//*****************************************************************************
|
|
|
//
|
|
|
//! Configures pin(s) for use by the UART peripheral.
|
|
@@ -2244,211 +2400,6 @@ GPIOPinTypeWakeLow(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
GPIO_PIN_TYPE_WAKE_LOW);
|
|
|
}
|
|
|
|
|
|
-//*****************************************************************************
|
|
|
-//
|
|
|
-//! Configures pin(s) for use as scan matrix keyboard rows (outputs).
|
|
|
-//!
|
|
|
-//! \param ui32Port is the base address of the GPIO port.
|
|
|
-//! \param ui8Pins is the bit-packed representation of the pin(s).
|
|
|
-//!
|
|
|
-//! The GPIO pins must be properly configured in order to function correctly as
|
|
|
-//! scan matrix keyboard outputs. This function provides the proper
|
|
|
-//! configuration for those pin(s).
|
|
|
-//!
|
|
|
-//! The pin(s) are specified using a bit-packed byte, where each bit that is
|
|
|
-//! set identifies the pin to be accessed, and where bit 0 of the byte
|
|
|
-//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
|
|
-//!
|
|
|
-//! \note This function cannot be used to turn any pin into a scan matrix
|
|
|
-//! keyboard row pin; it only configures a scan matrix keyboard row pin for
|
|
|
-//! proper operation. Note that a GPIOPinConfigure() function call is also
|
|
|
-//! required to properly configure a pin for the scan matrix keyboard
|
|
|
-//! function.
|
|
|
-//!
|
|
|
-//! \note A subset of GPIO pins on Tiva devices, notably those used by the
|
|
|
-//! JTAG/SWD interface and any pin capable of acting as an NMI input, are
|
|
|
-//! locked against inadvertent reconfiguration. These pins must be unlocked
|
|
|
-//! using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR
|
|
|
-//! registers before this function can be called. Please see the ``gpio_jtag''
|
|
|
-//! example application for the mechanism required and consult your part
|
|
|
-//! datasheet for information on affected pins.
|
|
|
-//!
|
|
|
-//! \return None.
|
|
|
-//
|
|
|
-//*****************************************************************************
|
|
|
-void
|
|
|
-GPIOPinTypeKBRow(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
-{
|
|
|
- //
|
|
|
- // Check the arguments.
|
|
|
- //
|
|
|
- ASSERT(_GPIOBaseValid(ui32Port));
|
|
|
-
|
|
|
- //
|
|
|
- // Make the pin(s) be peripheral controlled.
|
|
|
- //
|
|
|
- GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
|
|
|
-
|
|
|
- //
|
|
|
- // Set the pad(s) for push/pull operation.
|
|
|
- //
|
|
|
- GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
|
|
|
-}
|
|
|
-
|
|
|
-//*****************************************************************************
|
|
|
-//
|
|
|
-//! Configures pin(s) for use as scan matrix keyboard columns (inputs).
|
|
|
-//!
|
|
|
-//! \param ui32Port is the base address of the GPIO port.
|
|
|
-//! \param ui8Pins is the bit-packed representation of the pin(s).
|
|
|
-//!
|
|
|
-//! The GPIO pins must be properly configured in order to function correctly as
|
|
|
-//! scan matrix keyboard inputs. This function provides the proper
|
|
|
-//! configuration for those pin(s).
|
|
|
-//!
|
|
|
-//! The pin(s) are specified using a bit-packed byte, where each bit that is
|
|
|
-//! set identifies the pin to be accessed, and where bit 0 of the byte
|
|
|
-//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
|
|
-//!
|
|
|
-//! \note This function cannot be used to turn any pin into a scan matrix
|
|
|
-//! keyboard column pin; it only configures a scan matrix keyboard column pin
|
|
|
-//! for proper operation. Note that a GPIOPinConfigure() function call is also
|
|
|
-//! required to properly configure a pin for the scan matrix keyboard
|
|
|
-//! function.
|
|
|
-//!
|
|
|
-//! \note A subset of GPIO pins on Tiva devices, notably those used by the
|
|
|
-//! JTAG/SWD interface and any pin capable of acting as an NMI input, are
|
|
|
-//! locked against inadvertent reconfiguration. These pins must be unlocked
|
|
|
-//! using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR
|
|
|
-//! registers before this function can be called. Please see the ``gpio_jtag''
|
|
|
-//! example application for the mechanism required and consult your part
|
|
|
-//! datasheet for information on affected pins.
|
|
|
-//!
|
|
|
-//! \return None.
|
|
|
-//
|
|
|
-//*****************************************************************************
|
|
|
-void
|
|
|
-GPIOPinTypeKBColumn(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
-{
|
|
|
- //
|
|
|
- // Check the arguments.
|
|
|
- //
|
|
|
- ASSERT(_GPIOBaseValid(ui32Port));
|
|
|
-
|
|
|
- //
|
|
|
- // Make the pin(s) be peripheral controlled.
|
|
|
- //
|
|
|
- GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
|
|
|
-
|
|
|
- //
|
|
|
- // Set the pad(s) for standard push-pull operation.
|
|
|
- //
|
|
|
- GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA,
|
|
|
- GPIO_PIN_TYPE_STD_WPU);
|
|
|
-}
|
|
|
-
|
|
|
-//*****************************************************************************
|
|
|
-//
|
|
|
-//! Configures pin(s) for use as an LED sequencer output.
|
|
|
-//!
|
|
|
-//! \param ui32Port is the base address of the GPIO port.
|
|
|
-//! \param ui8Pins is the bit-packed representation of the pin(s).
|
|
|
-//!
|
|
|
-//! The GPIO pins must be properly configured in order to function correctly as
|
|
|
-//! LED sequencers. This function provides the proper configuration for those
|
|
|
-//! pin(s).
|
|
|
-//!
|
|
|
-//! The pin(s) are specified using a bit-packed byte, where each bit that is
|
|
|
-//! set identifies the pin to be accessed, and where bit 0 of the byte
|
|
|
-//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
|
|
-//!
|
|
|
-//! \note This function cannot be used to turn any pin into an LED sequencer
|
|
|
-//! output pin; it only configures an LED sequencer output pin for proper
|
|
|
-//! operation. Note that a GPIOPinConfigure() function call is also
|
|
|
-//! required to properly configure a pin for the LED sequencer function.
|
|
|
-//!
|
|
|
-//! \note A subset of GPIO pins on Tiva devices, notably those used by the
|
|
|
-//! JTAG/SWD interface and any pin capable of acting as an NMI input, are
|
|
|
-//! locked against inadvertent reconfiguration. These pins must be unlocked
|
|
|
-//! using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR
|
|
|
-//! registers before this function can be called. Please see the ``gpio_jtag''
|
|
|
-//! example application for the mechanism required and consult your part
|
|
|
-//! datasheet for information on affected pins.
|
|
|
-//!
|
|
|
-//! \return None.
|
|
|
-//
|
|
|
-//*****************************************************************************
|
|
|
-void
|
|
|
-GPIOPinTypeLEDSeq(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
-{
|
|
|
- //
|
|
|
- // Check the arguments.
|
|
|
- //
|
|
|
- ASSERT(_GPIOBaseValid(ui32Port));
|
|
|
-
|
|
|
- //
|
|
|
- // Make the pin(s) be peripheral controlled.
|
|
|
- //
|
|
|
- GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
|
|
|
-
|
|
|
- //
|
|
|
- // Set the pad(s) for push/pull operation and 8mA strength. The external
|
|
|
- // hardware should be set up such that we sink current when the LED is
|
|
|
- // turned on, hence the 8mA configuration choice.
|
|
|
- //
|
|
|
- GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
|
|
|
-}
|
|
|
-
|
|
|
-//*****************************************************************************
|
|
|
-//
|
|
|
-//! Configures pin(s) for use as Consumer Infrared inputs or outputs.
|
|
|
-//!
|
|
|
-//! \param ui32Port is the base address of the GPIO port.
|
|
|
-//! \param ui8Pins is the bit-packed representation of the pin(s).
|
|
|
-//!
|
|
|
-//! The GPIO pins must be properly configured in order to function correctly as
|
|
|
-//! Consumer Infrared pins. This function provides the proper configuration
|
|
|
-//! for those pin(s).
|
|
|
-//!
|
|
|
-//! The pin(s) are specified using a bit-packed byte, where each bit that is
|
|
|
-//! set identifies the pin to be accessed, and where bit 0 of the byte
|
|
|
-//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
|
|
|
-//!
|
|
|
-//! \note This function cannot be used to turn any pin into a CIR pin; it only
|
|
|
-//! configures a CIR pin for proper operation. Note that a GPIOPinConfigure()
|
|
|
-//! function call is also required to properly configure a pin for the
|
|
|
-//! Consumer Infrared function.
|
|
|
-//!
|
|
|
-//! \note A subset of GPIO pins on Tiva devices, notably those used by the
|
|
|
-//! JTAG/SWD interface and any pin capable of acting as an NMI input, are
|
|
|
-//! locked against inadvertent reconfiguration. These pins must be unlocked
|
|
|
-//! using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR
|
|
|
-//! registers before this function can be called. Please see the ``gpio_jtag''
|
|
|
-//! example application for the mechanism required and consult your part
|
|
|
-//! datasheet for information on affected pins.
|
|
|
-//!
|
|
|
-//! \return None.
|
|
|
-//
|
|
|
-//*****************************************************************************
|
|
|
-void
|
|
|
-GPIOPinTypeCIR(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
-{
|
|
|
- //
|
|
|
- // Check the arguments.
|
|
|
- //
|
|
|
- ASSERT(_GPIOBaseValid(ui32Port));
|
|
|
-
|
|
|
- //
|
|
|
- // Make the pin(s) be peripheral controlled.
|
|
|
- //
|
|
|
- GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
|
|
|
-
|
|
|
- //
|
|
|
- // Set the pad(s) for standard push-pull operation.
|
|
|
- //
|
|
|
- GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
|
|
|
-}
|
|
|
-
|
|
|
//*****************************************************************************
|
|
|
//
|
|
|
//! Retrieves the wake pins status.
|
|
@@ -2475,7 +2426,7 @@ GPIOPinTypeCIR(uint32_t ui32Port, uint8_t ui8Pins)
|
|
|
uint32_t
|
|
|
GPIOPinWakeStatus(uint32_t ui32Port)
|
|
|
{
|
|
|
- return(ui32Port + GPIO_O_WAKESTAT);
|
|
|
+ return(HWREG(ui32Port + GPIO_O_WAKESTAT));
|
|
|
}
|
|
|
|
|
|
//*****************************************************************************
|
|
@@ -2513,7 +2464,7 @@ GPIOPinConfigure(uint32_t ui32PinConfig)
|
|
|
//
|
|
|
// Check the argument.
|
|
|
//
|
|
|
- ASSERT(((ui32PinConfig >> 16) & 0xff) < 15);
|
|
|
+ ASSERT(((ui32PinConfig >> 16) & 0xff) < 18);
|
|
|
ASSERT(((ui32PinConfig >> 8) & 0xe3) == 0);
|
|
|
|
|
|
//
|