CC23x0R5DriverLibrary
[gpio.h] General Purpose I/O
Collaboration diagram for [gpio.h] General Purpose I/O:

Macros

#define GPIO_DIO_0_MASK   0x00000001
 
#define GPIO_DIO_1_MASK   0x00000002
 
#define GPIO_DIO_2_MASK   0x00000004
 
#define GPIO_DIO_3_MASK   0x00000008
 
#define GPIO_DIO_4_MASK   0x00000010
 
#define GPIO_DIO_5_MASK   0x00000020
 
#define GPIO_DIO_6_MASK   0x00000040
 
#define GPIO_DIO_7_MASK   0x00000080
 
#define GPIO_DIO_8_MASK   0x00000100
 
#define GPIO_DIO_9_MASK   0x00000200
 
#define GPIO_DIO_10_MASK   0x00000400
 
#define GPIO_DIO_11_MASK   0x00000800
 
#define GPIO_DIO_12_MASK   0x00001000
 
#define GPIO_DIO_13_MASK   0x00002000
 
#define GPIO_DIO_14_MASK   0x00004000
 
#define GPIO_DIO_15_MASK   0x00008000
 
#define GPIO_DIO_16_MASK   0x00010000
 
#define GPIO_DIO_17_MASK   0x00020000
 
#define GPIO_DIO_18_MASK   0x00040000
 
#define GPIO_DIO_19_MASK   0x00080000
 
#define GPIO_DIO_20_MASK   0x00100000
 
#define GPIO_DIO_21_MASK   0x00200000
 
#define GPIO_DIO_22_MASK   0x00400000
 
#define GPIO_DIO_23_MASK   0x00800000
 
#define GPIO_DIO_24_MASK   0x01000000
 
#define GPIO_DIO_25_MASK   0x02000000
 
#define GPIO_DIO_ALL_MASK   0xFFFFFFFF
 
#define GPIO_OUTPUT_DISABLE   0x00000000
 
#define GPIO_OUTPUT_ENABLE   0x00000001
 

Functions

__STATIC_INLINE uint32_t GPIOReadDio (uint32_t dioNumber)
 Reads a specific DIO. More...
 
__STATIC_INLINE uint32_t GPIOReadMultiDio (uint32_t dioMask)
 Reads the input value for the specified DIOs. More...
 
__STATIC_INLINE void GPIOWriteDio (uint32_t dioNumber, uint32_t value)
 Writes a value to a specific DIO. More...
 
__STATIC_INLINE void GPIOWriteMultiDio (uint32_t dioMask, uint32_t bitVectoredValue)
 Writes masked data to the specified DIOs. More...
 
__STATIC_INLINE void GPIOSetDio (uint32_t dioNumber)
 Sets a specific DIO to 1 (high). More...
 
__STATIC_INLINE void GPIOSetMultiDio (uint32_t dioMask)
 Sets the specified DIOs to 1 (high). More...
 
__STATIC_INLINE void GPIOClearDio (uint32_t dioNumber)
 Clears a specific DIO to 0 (low). More...
 
__STATIC_INLINE void GPIOClearMultiDio (uint32_t dioMask)
 Clears the specified DIOs to 0 (low). More...
 
__STATIC_INLINE void GPIOToggleDio (uint32_t dioNumber)
 Toggles a specific DIO. More...
 
__STATIC_INLINE void GPIOToggleMultiDio (uint32_t dioMask)
 Toggles the specified DIOs. More...
 
__STATIC_INLINE uint32_t GPIOGetOutputEnableDio (uint32_t dioNumber)
 Gets the output enable status of a specific DIO. More...
 
__STATIC_INLINE uint32_t GPIOGetOutputEnableMultiDio (uint32_t dioMask)
 Gets the output enable setting of the specified DIOs. More...
 
__STATIC_INLINE void GPIOSetOutputEnableDio (uint32_t dioNumber, uint32_t outputEnableValue)
 Sets output enable of a specific DIO. More...
 
__STATIC_INLINE void GPIOSetOutputEnableMultiDio (uint32_t dioMask, uint32_t bitVectoredOutputEnable)
 Configures the output enable setting for all specified DIOs. More...
 
__STATIC_INLINE uint32_t GPIOGetEventDio (uint32_t dioNumber)
 Gets the event status of a specific DIO. More...
 
__STATIC_INLINE uint32_t GPIOGetEventMultiDio (uint32_t dioMask)
 Gets the event status of the specified DIOs. More...
 
__STATIC_INLINE void GPIOClearEventDio (uint32_t dioNumber)
 Clears the IO event status of a specific DIO. More...
 
__STATIC_INLINE void GPIOClearEventMultiDio (uint32_t dioMask)
 Clears the IO event status on the specified DIOs. More...
 

Detailed Description

Introduction

The GPIO module allows software to control the pins of the device directly.

The System CPU can access the GPIO module to read the value of any DIO of the device and if the IOC module has been configured such that one or more DIOs are GPIO controlled (software controlled) the System CPU can write these DIOs through the GPIO module.

The IOC module can also be configured to generate events on edge detection and these events can be read and cleared in the GPIO module by the System CPU.

API

The API functions can be grouped like this:

Set and get direction of DIO (output enable):

Write DIO (requires IOC to be configured for GPIO usage):

Set, clear, or toggle DIO (requires IOC to be configured for GPIO usage):

Read DIO (even if IOC is NOT configured for GPIO usage; however, the DIO must be configured for input enable in IOC):

Read or clear events (even if IOC is NOT configured for GPIO usage; however, the DIO must be configured for input enable in IOC):

Macro Definition Documentation

§ GPIO_DIO_0_MASK

#define GPIO_DIO_0_MASK   0x00000001

§ GPIO_DIO_1_MASK

#define GPIO_DIO_1_MASK   0x00000002

§ GPIO_DIO_2_MASK

#define GPIO_DIO_2_MASK   0x00000004

§ GPIO_DIO_3_MASK

#define GPIO_DIO_3_MASK   0x00000008

§ GPIO_DIO_4_MASK

#define GPIO_DIO_4_MASK   0x00000010

§ GPIO_DIO_5_MASK

#define GPIO_DIO_5_MASK   0x00000020

§ GPIO_DIO_6_MASK

#define GPIO_DIO_6_MASK   0x00000040

§ GPIO_DIO_7_MASK

#define GPIO_DIO_7_MASK   0x00000080

§ GPIO_DIO_8_MASK

#define GPIO_DIO_8_MASK   0x00000100

§ GPIO_DIO_9_MASK

#define GPIO_DIO_9_MASK   0x00000200

§ GPIO_DIO_10_MASK

#define GPIO_DIO_10_MASK   0x00000400

§ GPIO_DIO_11_MASK

#define GPIO_DIO_11_MASK   0x00000800

§ GPIO_DIO_12_MASK

#define GPIO_DIO_12_MASK   0x00001000

§ GPIO_DIO_13_MASK

#define GPIO_DIO_13_MASK   0x00002000

§ GPIO_DIO_14_MASK

#define GPIO_DIO_14_MASK   0x00004000

§ GPIO_DIO_15_MASK

#define GPIO_DIO_15_MASK   0x00008000

§ GPIO_DIO_16_MASK

#define GPIO_DIO_16_MASK   0x00010000

§ GPIO_DIO_17_MASK

#define GPIO_DIO_17_MASK   0x00020000

§ GPIO_DIO_18_MASK

#define GPIO_DIO_18_MASK   0x00040000

§ GPIO_DIO_19_MASK

#define GPIO_DIO_19_MASK   0x00080000

§ GPIO_DIO_20_MASK

#define GPIO_DIO_20_MASK   0x00100000

§ GPIO_DIO_21_MASK

#define GPIO_DIO_21_MASK   0x00200000

§ GPIO_DIO_22_MASK

#define GPIO_DIO_22_MASK   0x00400000

§ GPIO_DIO_23_MASK

#define GPIO_DIO_23_MASK   0x00800000

§ GPIO_DIO_24_MASK

#define GPIO_DIO_24_MASK   0x01000000

§ GPIO_DIO_25_MASK

#define GPIO_DIO_25_MASK   0x02000000

§ GPIO_DIO_ALL_MASK

§ GPIO_OUTPUT_DISABLE

#define GPIO_OUTPUT_DISABLE   0x00000000

Referenced by GPIOSetOutputEnableDio().

§ GPIO_OUTPUT_ENABLE

#define GPIO_OUTPUT_ENABLE   0x00000001

Referenced by GPIOSetOutputEnableDio().

Function Documentation

§ GPIOReadDio()

__STATIC_INLINE uint32_t GPIOReadDio ( uint32_t  dioNumber)

Reads a specific DIO.

Parameters
dioNumberspecifies the DIO to read (0-31).
Returns
Returns 0 or 1 reflecting the input value of the specified DIO.
See also
GPIOReadMultiDio(), GPIOWriteDio(), GPIOWriteMultiDio()

References ASSERT, GPIO_BASE, GPIO_O_DIN31_0, and HWREG.

§ GPIOReadMultiDio()

__STATIC_INLINE uint32_t GPIOReadMultiDio ( uint32_t  dioMask)

Reads the input value for the specified DIOs.

This function returns the input value for multiple DIOs. The value returned is not shifted and hence matches the corresponding dioMask bits.

Parameters
dioMaskis the bit-mask representation of the DIOs to read. The parameter must be a bitwise OR'ed combination of the following:
Returns
Returns a bit vector reflecting the input value of the corresponding DIOs.
  • 0 : Corresponding DIO is low.
  • 1 : Corresponding DIO is high.
See also
GPIOReadDio(), GPIOWriteDio(), GPIOWriteMultiDio()

References ASSERT, GPIO_BASE, GPIO_DIO_ALL_MASK, GPIO_O_DIN31_0, and HWREG.

§ GPIOWriteDio()

__STATIC_INLINE void GPIOWriteDio ( uint32_t  dioNumber,
uint32_t  value 
)

Writes a value to a specific DIO.

Parameters
dioNumberspecifies the DIO to update (0-31).
valuespecifies the value to write
  • 0 : Logic zero (low)
  • 1 : Logic one (high)
Returns
None
See also
GPIOWriteMultiDio(), GPIOReadDio(), GPIOReadMultiDio()

References ASSERT, GPIO_BASE, GPIO_O_DOUT3_0, and HWREGB.

§ GPIOWriteMultiDio()

__STATIC_INLINE void GPIOWriteMultiDio ( uint32_t  dioMask,
uint32_t  bitVectoredValue 
)

Writes masked data to the specified DIOs.

Enables for writing multiple bits simultaneously. The value to write must be shifted so it matches the corresponding dioMask bits.

Note
Note that this is a read-modify-write operation and hence not atomic.
Parameters
dioMaskis the bit-mask representation of the DIOs to write. The parameter must be a bitwise OR'ed combination of the following:
bitVectoredValueholds the value to be written to the corresponding DIO-bits.
Returns
None
See also
GPIOWriteDio(), GPIOReadDio(), GPIOReadMultiDio()

References ASSERT, GPIO_BASE, GPIO_DIO_ALL_MASK, GPIO_O_DOUT31_0, and HWREG.

§ GPIOSetDio()

__STATIC_INLINE void GPIOSetDio ( uint32_t  dioNumber)

Sets a specific DIO to 1 (high).

Parameters
dioNumberspecifies the DIO to set (0-31).
Returns
None
See also
GPIOSetMultiDio(), GPIOClearDio(), GPIOClearMultiDio()

References ASSERT, GPIO_BASE, GPIO_O_DOUTSET31_0, and HWREG.

§ GPIOSetMultiDio()

__STATIC_INLINE void GPIOSetMultiDio ( uint32_t  dioMask)

Sets the specified DIOs to 1 (high).

Parameters
dioMaskis the bit-mask representation of the DIOs to set. The parameter must be a bitwise OR'ed combination of the following:
Returns
None
See also
GPIOSetDio(), GPIOClearDio(), GPIOClearMultiDio()

References ASSERT, GPIO_BASE, GPIO_DIO_ALL_MASK, GPIO_O_DOUTSET31_0, and HWREG.

§ GPIOClearDio()

__STATIC_INLINE void GPIOClearDio ( uint32_t  dioNumber)

Clears a specific DIO to 0 (low).

Parameters
dioNumberspecifies the DIO to clear (0-31).
Returns
None
See also
GPIOClearMultiDio(), GPIOSetDio(), GPIOSetMultiDio()

References ASSERT, GPIO_BASE, GPIO_O_DOUTCLR31_0, and HWREG.

§ GPIOClearMultiDio()

__STATIC_INLINE void GPIOClearMultiDio ( uint32_t  dioMask)

Clears the specified DIOs to 0 (low).

Parameters
dioMaskis the bit-mask representation of the DIOs to clear. The parameter must be a bitwise OR'ed combination of the following:
Returns
None
See also
GPIOClearDio(), GPIOSetDio(), GPIOSetMultiDio()

References ASSERT, GPIO_BASE, GPIO_DIO_ALL_MASK, GPIO_O_DOUTCLR31_0, and HWREG.

§ GPIOToggleDio()

__STATIC_INLINE void GPIOToggleDio ( uint32_t  dioNumber)

Toggles a specific DIO.

Parameters
dioNumberspecifies the DIO to toggle (0-31).
Returns
None
See also
GPIOToggleMultiDio()

References ASSERT, GPIO_BASE, GPIO_O_DOUTTGL31_0, and HWREG.

§ GPIOToggleMultiDio()

__STATIC_INLINE void GPIOToggleMultiDio ( uint32_t  dioMask)

Toggles the specified DIOs.

Parameters
dioMaskis the bit-mask representation of the DIOs to toggle. The parameter must be a bitwise OR'ed combination of the following:
Returns
None
See also
GPIOToggleDio()

References ASSERT, GPIO_BASE, GPIO_DIO_ALL_MASK, GPIO_O_DOUTTGL31_0, and HWREG.

§ GPIOGetOutputEnableDio()

__STATIC_INLINE uint32_t GPIOGetOutputEnableDio ( uint32_t  dioNumber)

Gets the output enable status of a specific DIO.

This function returns the output enable status for the specified DIO. The DIO can be configured as either input or output under software control.

Parameters
dioNumberspecifies the DIO to get the output enable setting from (0-31).
Returns
Returns one of the enumerated data types (0 or 1):
See also
GPIOGetOutputEnableMultiDio(), GPIOSetOutputEnableDio(), GPIOSetOutputEnableMultiDio()

References ASSERT, GPIO_BASE, GPIO_O_DOE31_0, and HWREG.

§ GPIOGetOutputEnableMultiDio()

__STATIC_INLINE uint32_t GPIOGetOutputEnableMultiDio ( uint32_t  dioMask)

Gets the output enable setting of the specified DIOs.

This function returns the output enable setting for multiple DIOs. The value returned is not shifted and hence matches the corresponding dioMask bits.

Parameters
dioMaskis the bit-mask representation of the DIOs to return the output enable settings from. The parameter must be a bitwise OR'ed combination of the following:
Returns
Returns the output enable setting for multiple DIOs as a bit vector corresponding to the dioMask bits.
  • 0 : Corresponding DIO is configured with output disabled.
  • 1 : Corresponding DIO is configured with output enabled.
See also
GPIOGetOutputEnableDio(), GPIOSetOutputEnableDio(), GPIOSetOutputEnableMultiDio()

References ASSERT, GPIO_BASE, GPIO_DIO_ALL_MASK, GPIO_O_DOE31_0, and HWREG.

§ GPIOSetOutputEnableDio()

__STATIC_INLINE void GPIOSetOutputEnableDio ( uint32_t  dioNumber,
uint32_t  outputEnableValue 
)

Sets output enable of a specific DIO.

This function sets the GPIO output enable bit for the specified DIO. The DIO can be configured as either input or output under software control.

Parameters
dioNumberspecifies the DIO to configure (0-31).
outputEnableValuespecifies the output enable setting of the specified DIO:
Returns
None
See also
GPIOSetOutputEnableMultiDio(), GPIOGetOutputEnableDio(), GPIOGetOutputEnableMultiDio()

References ASSERT, GPIO_BASE, GPIO_O_DOE31_0, GPIO_OUTPUT_DISABLE, GPIO_OUTPUT_ENABLE, and HWREG.

§ GPIOSetOutputEnableMultiDio()

__STATIC_INLINE void GPIOSetOutputEnableMultiDio ( uint32_t  dioMask,
uint32_t  bitVectoredOutputEnable 
)

Configures the output enable setting for all specified DIOs.

This function configures the output enable setting for the specified DIOs. The output enable setting must be shifted so it matches the corresponding dioMask bits. The DIOs can be configured as either an input or output under software control.

Note
Note that this is a read-modify-write operation and hence not atomic.
Parameters
dioMaskis the bit-mask representation of the DIOs on which to configure the output enable setting. The parameter must be a bitwise OR'ed combination of the following:
bitVectoredOutputEnableholds the output enable setting the corresponding DIO-bits:
  • 0 : Corresponding DIO is configured with output disabled.
  • 1 : Corresponding DIO is configured with output enabled.
Returns
None
See also
GPIOSetOutputEnableDio(), GPIOGetOutputEnableDio(), GPIOGetOutputEnableMultiDio()

References ASSERT, GPIO_BASE, GPIO_DIO_ALL_MASK, GPIO_O_DOE31_0, and HWREG.

§ GPIOGetEventDio()

__STATIC_INLINE uint32_t GPIOGetEventDio ( uint32_t  dioNumber)

Gets the event status of a specific DIO.

Parameters
dioNumberspecifies the DIO to get the event status from (0-31).
Returns
Returns the current event status on the specified DIO.
  • 0 : Non-triggered event.
  • 1 : Triggered event.
See also
GPIOGetEventMultiDio(), GPIOClearEventDio(), GPIOClearEventMultiDio()

References ASSERT, GPIO_BASE, GPIO_O_RIS, and HWREG.

§ GPIOGetEventMultiDio()

__STATIC_INLINE uint32_t GPIOGetEventMultiDio ( uint32_t  dioMask)

Gets the event status of the specified DIOs.

This function returns the event status for multiple DIOs. The value returned is not shifted and hence matches the corresponding dioMask bits.

Parameters
dioMaskis the bit-mask representation of the DIOs to get the event status from (0-31). The parameter must be a bitwise OR'ed combination of the following:
Returns
Returns a bit vector with the current event status corresponding to the specified DIOs.
  • 0 : Corresponding DIO has no triggered event.
  • 1 : Corresponding DIO has a triggered event.
See also
GPIOGetEventDio(), GPIOClearEventDio(), GPIOClearEventMultiDio()

References ASSERT, GPIO_BASE, GPIO_DIO_ALL_MASK, GPIO_O_RIS, and HWREG.

§ GPIOClearEventDio()

__STATIC_INLINE void GPIOClearEventDio ( uint32_t  dioNumber)

Clears the IO event status of a specific DIO.

Parameters
dioNumberspecifies the DIO on which to clear the event status (0-31).
Returns
None
See also
GPIOClearEventMultiDio(), GPIOGetEventDio(), GPIOGetEventMultiDio()

References ASSERT, GPIO_BASE, GPIO_O_ICLR, and HWREG.

§ GPIOClearEventMultiDio()

__STATIC_INLINE void GPIOClearEventMultiDio ( uint32_t  dioMask)

Clears the IO event status on the specified DIOs.

Parameters
dioMaskis the bit-mask representation of the DIOs on which to clear the events status. The parameter must be a bitwise OR'ed combination of the following:
Returns
None
See also
GPIOClearEventDio(), GPIOGetEventDio(), GPIOGetEventMultiDio()

References ASSERT, GPIO_BASE, GPIO_DIO_ALL_MASK, GPIO_O_ICLR, and HWREG.