xGPIO API Reference. More...
|
Defines | |
| #define | xGPIOSPinToPeripheralId(eShortPin) |
| Get the GPIO port from a Pin. | |
| #define | xGPIOSPinToPort(eShortPin) |
| Get the GPIO port from a short Pin. | |
| #define | xGPIOSPinToPortPin(eShortPin) |
| Get the GPIO port and Pin number from a short Pin. | |
| #define | xGPIOSPinToPin(eShortPin) |
| Get the GPIO pin number from a short Pin. | |
| #define | xGPIOSPinDirModeSet(eShortPin, ulPinIO) |
| Set the direction and mode of the specified pin(s). | |
| #define | xGPIOSPinIntEnable(eShortPin, ulIntType) |
| Set the interrupt type and Enable interrupt for the specified pin(s). | |
| #define | xGPIOSPinIntDisable(eShortPin) |
| Disables interrupts for the specified pin. | |
| #define | xGPIOSPinIntClear(eShortPin) |
| Clear the interrupt for the specified pin. | |
| #define | xGPIOSPinRead(eShortPin) |
| Reads the values present of the specified pin. | |
| #define | xGPIOSPinWrite(eShortPin, ucVal) |
| Write a value to the specified pin. | |
| #define | xGPIOSPinTypeGPIOInput(eShortPin) |
| Turn a pin to a GPIO Input pin. | |
| #define | xGPIOSPinTypeGPIOOutput(eShortPin) |
| Turn a pin to a GPIO Output(push-pull) pin. | |
| #define | xGPIOSPinTypeGPIOOutputOD(eShortPin) |
| Turn a pin to a GPIO Output(open drain) pin. | |
| #define | xGPIOSPinTypeGPIOOutputQB(eShortPin) |
| Turn a pin to a GPIO Output(oQuasi-bidirectional) pin. | |
| #define | xSPinTypeADC(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO ADC input pin. | |
| #define | xSPinTypeCAN(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO CAN input or output pin. | |
| #define | xSPinTypeI2C(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO I2C input or output pin. | |
| #define | xSPinTypeI2S(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO I2S input or output pin. | |
| #define | xSPinTypePWM(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO PWM input or output pin. | |
| #define | xSPinTypeSPI(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO SPI input or output pin. | |
| #define | xSPinTypeTimer(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO Timer input or output pin. | |
| #define | xSPinTypeUART(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO UART input or output pin. | |
| #define | xSPinTypeACMP(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO ACMP input or output pin. | |
| #define | xSPinTypeCLKO(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO CLKO output pin. | |
| #define | xSPinTypeEXTINT(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO external interrupt pin. | |
| #define | xSPinTypeEBI(ePeripheralPin, eShortPin) |
| Turn a pin to a GPIO EBI pin. | |
Functions | |
| void | xGPIODirModeSet (unsigned long ulPort, unsigned long ulPins, unsigned long ulPinIO) |
| Set the direction and mode of the specified pin(s). | |
| unsigned long | xGPIODirModeGet (unsigned long ulPort, unsigned long ulPin) |
| Get the direction and mode of a pin. | |
| void | xGPIOPinIntCallbackInit (unsigned long ulPort, unsigned long ulPin, xtEventCallback pfnCallback) |
| Init the GPIO Port X Interrupt Callback function. | |
| void | xGPIOPinIntEnable (unsigned long ulPort, unsigned long ulPins, unsigned long ulIntType) |
| Set the interrupt type and Enable interrupt for the specified pin(s). | |
| void | xGPIOPinIntDisable (unsigned long ulPort, unsigned long ulPins) |
| Disables interrupts for the specified pin(s). | |
| void | xGPIOPinIntStatus (unsigned long ulPort) |
| Get interrupt status for the specified GPIO port. | |
| void | xGPIOPinIntClear (unsigned long ulPort, unsigned long ulPins) |
| Clear the interrupt for the specified pin(s). | |
| long | xGPIOPinRead (unsigned long ulPort, unsigned long ulPins) |
| Reads the values present of the specified pin(s). | |
| void | xGPIOPinWrite (unsigned long ulPort, unsigned long ulPins, unsigned char ucVal) |
| Write a value to the specified pin(s). | |
| void | xGPIOPinConfigure (unsigned long ulPinConfig) |
| Configure the alternate function of a GPIO pin. | |
xGPIO API Reference.
//! +--------------------------+----------------+------------------------+ //! |xGPIO API | CoX | NUC1xx | //! |--------------------------|----------------|------------------------| //! |xGPIODirModeSet | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinToPeripheralId | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinToPort | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinToPin | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinDirModeSet | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIODirModeGet | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOPinIntCallbackInit | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOPinIntEnable | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinIntEnable | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOPinIntDisable | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinIntDisable | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOPinIntStatus | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOPinIntClear | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinIntClear | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOPinRead | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinRead | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOPinWrite | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinWrite | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOPinConfigure | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinTypeGPIOInput | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinTypeGPIOOutput | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinTypeGPIOOutputOD | Non-Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xGPIOSPinTypeGPIOOutputQB | Non-Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypeADC | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypeCAN | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypeI2C | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypeI2S | Non-Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypePWM | Non-Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypeSPI | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypeTimer | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypeUART | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypeACMP | Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypeCLKO | Non-Mandatory | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypeEXTINT | N | Y | //! |--------------------------|----------------|------------------------| //! |xSPinTypeEBI | Non-Mandatory | Y | //! +--------------------------+----------------+------------------------+ //!
| #define xGPIOSPinToPeripheralId | ( | eShortPin | ) |
Get the GPIO port from a Pin.
| eShortPin | is the base address of the GPIO port |
| #define xGPIOSPinToPort | ( | eShortPin | ) |
| #define xGPIOSPinToPortPin | ( | eShortPin | ) |
| #define xGPIOSPinToPin | ( | eShortPin | ) |
| #define xGPIOSPinDirModeSet | ( | eShortPin, | |
| ulPinIO | |||
| ) |
Set the direction and mode of the specified pin(s).
| eShortPin | Specified port and pin. Details please refer to xGPIO Short Pin ID. |
| ulPinIO | is the pin direction and/or mode. Details please refer to xGPIO Dir Mode. |
This function will set the specified pin(s) on the selected GPIO port as either an input or output under software control, or it will set the pin to be under hardware control.
The parameter ulPinIO is an enumerated data type that can be one of the following values:
Details please refer to 2.CoX Port Details.
where xGPIO_DIR_MODE_IN specifies that the pin will be programmed as a software controlled input, xGPIO_DIR_MODE_OUT specifies that the pin will be programmed as a software controlled output, and xGPIO_DIR_MODE_HW specifies that the pin will be placed under hardware control.
The pin is specified by eShortPin, which can only be one pin. Details please refer to 2.CoX Port Details.
| #define xGPIOSPinIntEnable | ( | eShortPin, | |
| ulIntType | |||
| ) |
Set the interrupt type and Enable interrupt for the specified pin(s).
| eShortPin | Specified port and pin. Details please refer to xGPIO Short Pin ID. |
| ulIntType | specifies the type of interrupt trigger mechanism. Details please refer to xGPIO Int Type. |
This function sets up the various interrupt trigger mechanisms for the specified pin(s) on the selected GPIO port.
The parameter ulIntType is an enumerated data type that can be one of the following values:
Details please refer to 2.CoX Port Details.
Where the different values describe the interrupt detection mechanism (edge or level) and the particular triggering event (falling, rising, or both edges for edge detect, low or high for level detect).
The pin is specified by eShortPin, which can only be one pin. Details please refer to 2.CoX Port Details.
| #define xGPIOSPinIntDisable | ( | eShortPin | ) |
Disables interrupts for the specified pin.
| eShortPin | Specified port and pin. Details please refer to xGPIO Short Pin ID. |
Mask the interrupt for the specified pin(s).
The pin is specified by eShortPin, which can only be one pin. Details please refer to 2.CoX Port Details.
| #define xGPIOSPinIntClear | ( | eShortPin | ) |
Clear the interrupt for the specified pin.
| eShortPin | Specified port and pin. Details please refer to xGPIO Short Pin ID. |
Clear the interrupt for the specified pin.
The pin is specified by eShortPin, which can only be one pin. Details please refer to 2.CoX Port Details.
| #define xGPIOSPinRead | ( | eShortPin | ) |
Reads the values present of the specified pin.
| eShortPin | Specified port and pin. Details please refer to xGPIO Short Pin ID. |
The values at the specified pin are read, as specified by eShortPin. Values are returned for both input and output pin(s), and the value for pin(s) that are not specified by eShortPin are set to 0.
The pin is specified by eShortPin, which can only be one pin. Details please refer to 2.CoX Port Details.
| #define xGPIOSPinWrite | ( | eShortPin, | |
| ucVal | |||
| ) |
Write a value to the specified pin.
| eShortPin | Specified port and pin. Details please refer to xGPIO Short Pin ID. |
| ucVal | is the value to write to the pin(s), 0 or 1. |
Write the corresponding bit values to the output pin specified by eShortPin. Writing to a pin configured as an input pin has no effect.
The pin is specified by eShortPin, which can only be one pin. Details please refer to 2.CoX Port Details.
| #define xGPIOSPinTypeGPIOInput | ( | eShortPin | ) |
Turn a pin to a GPIO Input pin.
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as an GPIO Input pin device and turns the pin into a GPIO input pin.
| #define xGPIOSPinTypeGPIOOutput | ( | eShortPin | ) |
Turn a pin to a GPIO Output(push-pull) pin.
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as an GPIO Output pin device and turns the pin into a GPIO Output pin.
| #define xGPIOSPinTypeGPIOOutputOD | ( | eShortPin | ) |
Turn a pin to a GPIO Output(open drain) pin.
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as an GPIO Output pin device and turns the pin into a GPIO Output(open drain) pin.
| #define xGPIOSPinTypeGPIOOutputQB | ( | eShortPin | ) |
Turn a pin to a GPIO Output(oQuasi-bidirectional) pin.
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as an GPIO Output pin device and turns the pin into a GPIO Output(Quasi-bidirectional) pin.
| #define xSPinTypeADC | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO ADC input pin.
| ePeripheralPin | is the GPIO Peripheral name such as ADC0. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as an ADC function device and turns the pin into a GPIO ADC input pin.
Table shows what the ePeripheralPin and eShortPin should be, only the argument which are in the same line can be combined. For eaxmple(TI):
xSPinTypeADC(ADC0, PE7) or xSPinTypeADC(ADC1, PE6) is correct;
But xSPinTypeADC(ADC0, PE6) or xSPinTypeADC(ADC0, PE5) is error.
//! +--------------------+------------------------+------------------------+ //! | manufacturer |ePeripheralPin |eShortPin | //! |--------------------|------------------------|------------------------| //! | CoX |This parameter is a |This parameter is a | //! | |mandatory.The mandatory |mandatory. the mandatory| //! | |is the format of |is the format of | //! | |Variable naming.So it |Variable naming.So it | //! | |should be: ADCn |should be: PXn | //! | |n indicate the pin |XX indicate the GPIO | //! | |number such as |PORT,Such as | //! | |0 1 2 3 .... |A B C D E ... | //! | | |n indicate the pin | //! | | |number such as | //! | | |0 1 2 3 .... | //! |--------------------|------------------------|------------------------| //! | NUC1xx | ADC0 | PA0 | //! | | ADC1 | PA1 | //! | | ADC2 | PA2 | //! | | ADC3 | PA3 | //! | | ADC4 | PA4 | //! | | ADC5 | PA5 | //! | | ADC6 | PA6 | //! | | ADC7 | PA7 | //! |--------------------|------------------------|------------------------| //!
| #define xSPinTypeCAN | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO CAN input or output pin.
| ePeripheralPin | is the GPIO Peripheral name such as CAN0RX. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as a CAN function and turns the pin into a GPIO CAN input or output pin.
Table shows what the ePeripheralPin and eShortPin should be,only the argument which are in the same line can be combined.For eaxmple(TI):
xSPinTypeCAN(CAN0RX, PA4) or xSPinTypeCAN(CAN0RX, PB4) is correct;
But xSPinTypeCAN(CAN0RX, PA5) or xSPinTypeCAN(CAN0RX, PF0) is error.
//! +--------------------+------------------------+------------------------+ //! | manufacturer |ePeripheralPin |eShortPin | //! |--------------------|------------------------|------------------------| //! | CoX |This parameter is a |This parameter is a | //! | |mandatory.The mandatory |mandatory. the mandatory| //! | |is the format of |is the format of | //! | |Variable naming.So it |Variable naming.So it | //! | |should be: CANnRX |should be: PXn | //! | |or CANnTX |XX indicate the GPIO | //! | |n indicate the pin |PORT,Such as | //! | |number such as |A B C D E ... | //! | |0 1 2 3 .... |n indicate the pin | //! | | |number such as | //! | | |0 1 2 3 .... | //! |--------------------|------------------------|------------------------| //! | NUC1xx | CAN0RX | PD6 | //! | | CAN0TX | PD7 | //! |--------------------|------------------------|------------------------| //!
| #define xSPinTypeI2C | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO I2C input or output pin.
| ePeripheralPin | is the GPIO Peripheral name such as I2C0SDA. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as an I2C function device and turns the pin into a GPIO I2C input or output pin.
Table shows what the ePeripheralPin and eShortPin should be,only the argument which are in the same line can be combined.For eaxmple(TI):
xSPinTypeI2C(CAN0RX, PA4) or xSPinTypeI2C(CAN0RX, PB4) is correct;
But xSPinTypeI2C(CAN0RX, PA5) or xSPinTypeI2C(CAN0RX, PF0) is error.
//! +--------------------+------------------------+------------------------+ //! | manufacturer |ePeripheralPin |eShortPin | //! |--------------------|------------------------|------------------------| //! | CoX |This parameter is a |This parameter is a | //! | |mandatory.The mandatory |mandatory. the mandatory| //! | |is the format of |is the format of | //! | |Variable naming.So it |Variable naming.So it | //! | |should be: I2CnSCK |should be: PXn | //! | |or I2CnSDA |XX indicate the GPIO | //! | |n indicate the pin |PORT,Such as | //! | |number such as |A B C D E ... | //! | |0 1 2 3 .... |n indicate the pin | //! | | |number such as | //! | | |0 1 2 3 .... | //! |--------------------|------------------------|------------------------| //! | NUC1xx | I2C0SCK | PA9 | //! | | I2C0SDA | PA8 | //! | | I2C1SCK | PA11 | //! | | I2C1SDA | PA10 | //! |--------------------|------------------------|------------------------| //!
| #define xSPinTypeI2S | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO I2S input or output pin.
| ePeripheralPin | is the GPIO Peripheral name such as I2C0SDA. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as an I2S function device and turns the pin into a GPIO I2S input or output pin.
Table shows what the ePeripheralPin and eShortPin should be,only the argument which are in the same line can be combined.For eaxmple(TI):
xSPinTypeI2S(I2S0RXSD, PA2) or xSPinTypeI2S(I2S0RXSD, PD4) is correct;
But xSPinTypeI2S(I2S0RXSD, PD1) or xSPinTypeI2S(I2S0RXWS, PA2) is error.
//! +--------------------+------------------------+------------------------+ //! | manufacturer |ePeripheralPin |eShortPin | //! |--------------------|------------------------|------------------------| //! | CoX |This parameter is a |This parameter is a | //! | |mandatory.The mandatory |mandatory. the mandatory| //! | |is the format of |is the format of | //! | |Variable naming.So it |Variable naming.So it | //! | |should be: I2SnRXSCK, |should be: PXn | //! | |I2SnRXMCLK,I2S0RXSD, |XX indicate the GPIO | //! | |I2S0RXWS,I2S0TXSCK, |PORT,Such as | //! | |I2S0TXMCLK,I2S0TXSD, |A B C D E ... | //! | |or I2S0TXWS. |n indicate the pin | //! | |n indicate the pin |number such as | //! | |number such as |0 1 2 3 .... | //! | |0 1 2 3 .... | | //! |--------------------|------------------------|------------------------| //! | NUC1xx | I2S0RXMCLK | PA15 | //! | | I2S0RXSCK | PC1 | //! | | I2S0RXSD | PC2 | //! | | I2S0RXWS | PC0 | //! | | I2S0TXMCLK | PA15 | //! | | I2S0TXSCK | PC1 | //! | | I2S0TXSD | PC3 | //! | | I2S0TXWS | PC0 | //! |--------------------|------------------------|------------------------| //!
| #define xSPinTypePWM | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO PWM input or output pin.
| ePeripheralPin | is the GPIO Peripheral name such as I2C0SDA. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as a PWM function and turns the pin into a GPIO PWM input or output pin.
Table shows what the ePeripheralPin and eShortPin should be,only the argument which are in the same line can be combined.For eaxmple(TI):
xSPinTypePWM(PWM0, PD0) or xSPinTypePWM(PWM0, PJ0) is correct;
But xSPinTypePWM(PWM0, PD1) or xSPinTypePWM(PWM0, PD2) is error.
//! +--------------------+------------------------+------------------------+ //! | manufacturer |ePeripheralPin |eShortPin | //! |--------------------|------------------------|------------------------| //! | CoX |This parameter is a |This parameter is a | //! | |mandatory.The mandatory |mandatory. the mandatory| //! | |is the format of |is the format of | //! | |Variable naming.So it |Variable naming.So it | //! | |should be: PWMn, |should be: PXn | //! | |n indicate the pin |XX indicate the GPIO | //! | |number such as |PORT,Such as | //! | |0 1 2 3 .... |A B C D E ... | //! | | |n indicate the pin | //! | | |number such as | //! | | |0 1 2 3 .... | //! |--------------------|------------------------|------------------------| //! | NUC1xx | PWM0 | PA12 | //! | | PWM1 | PA13 | //! | | PWM2 | PA14 | //! | | PWM3 | PA15 | //! | | PWM4 | PB11 | //! | | PWM5 | PE5 | //! | | PWM6 | PE0 | //! | | PWM7 | PE1 | //! |--------------------|------------------------|------------------------| //!
| #define xSPinTypeSPI | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO SPI input or output pin.
| ePeripheralPin | is the GPIO Peripheral name such as I2C0SDA. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as a SPI function and turns the pin into a GPIO SPI input or output pin.
Table shows what the ePeripheralPin and eShortPin should be,only the argument which are in the same line can be combined.For eaxmple(TI):
xSPinTypeSPI(SPI0CLK, PA2) or xSPinTypeSPI(SPI0MOSI, PA5) is correct;
But xSPinTypeSPI(SPI0CLK, PA5) or xSPinTypeSPI(SPI0CLK, PA4) is error.
//! +--------------------+------------------------+------------------------+ //! | manufacturer |ePeripheralPin |eShortPin | //! |--------------------|------------------------|------------------------| //! | CoX |This parameter is a |This parameter is a | //! | |mandatory.The mandatory |mandatory. the mandatory| //! | |is the format of |is the format of | //! | |Variable naming.So it |Variable naming.So it | //! | |should be: SPInCLK, |should be: PXn | //! | |SPInMISO, SPInMOSI, |XX indicate the GPIO | //! | |or SPInCS, |PORT,Such as | //! | |n indicate the pin |A B C D E ... | //! | |number such as |n indicate the pin | //! | |0 1 2 3 .... |number such as | //! | | |0 1 2 3 .... | //! |--------------------|------------------------|------------------------| //! | NUC1xx | SPI0CLK | PC1 | //! | | SPI0MOSI | PC5,PC3 | //! | | SPI0MISO | PC4,PC2 | //! | | SPI0CS | PC0,PB10 | //! | | SPI1CLK | PC9 | //! | | SPI1MOSI | PC13,PC11 | //! | | SPI1MISO | PC12,PC10 | //! | | SPI1CS | PB9,PC8 | //! | | SPI2CLK | PD1 | //! | | SPI2MOSI | PD3,PD5 | //! | | SPI2MISO | PD2,PD4 | //! | | SPI2CS | PA7,PD0 | //! | | SPI3CLK | PD9 | //! | | SPI3MOSI | PD11,PD13 | //! | | SPI3MISO | PD10,PD12 | //! | | SPI3CS | PB14,PD8 | //! |--------------------|------------------------|------------------------| //!
| #define xSPinTypeTimer | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO Timer input or output pin.
| ePeripheralPin | is the GPIO Peripheral name such as I2C0SDA. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as a Timer function and turns the pin into a GPIO Timer input or output pin.
Table shows what the ePeripheralPin and eShortPin should be,only the argument which are in the same line can be combined.For eaxmple(TI):
xSPinTypeTimer(TIMCCP0, PD3) or xSPinTypeTimer(TIMCCP0, PJ7) is correct;
But xSPinTypeTimer(TIMCCP0, PC5) or xSPinTypeTimer(TIMCCP0, PB6) is error.
//! +--------------------+------------------------+------------------------+ //! | manufacturer |ePeripheralPin |eShortPin | //! |--------------------|------------------------|------------------------| //! | CoX |This parameter is a |This parameter is a | //! | |mandatory.The mandatory |mandatory. the mandatory| //! | |is the format of |is the format of | //! | |Variable naming.So it |Variable naming.So it | //! | |should be: TIMCCPn, |should be: PXn | //! | |n indicate the pin |XX indicate the GPIO | //! | |number such as |PORT,Such as | //! | |0 1 2 3 .... |A B C D E ... | //! | | |n indicate the pin | //! | | |number such as | //! | | |0 1 2 3 .... | //! |--------------------|------------------------|------------------------| //! | NUC1xx | TIMCCP0 | PB8 | //! | | TIMCCP1 | PB9 | //! | | TIMCCP2 | PB10 | //! | | TIMCCP3 | PB11 | //! |--------------------|------------------------|------------------------| //!
| #define xSPinTypeUART | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO UART input or output pin.
| ePeripheralPin | is the GPIO Peripheral name such as I2C0SDA. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as a UART function and turns the pin into a GPIO UART input or output pin.
Table shows what the ePeripheralPin and eShortPin should be,only the argument which are in the same line can be combined.For eaxmple(TI):
xSPinTypeUART(UART0RX, PA0) or xSPinTypeUART(UART0TX, PA1) is correct;
But xSPinTypeUART(UART0RX, PA1) or xSPinTypeUART(UART0RX, PE6) is error.
//! +--------------------+------------------------+------------------------+ //! | manufacturer |ePeripheralPin |eShortPin | //! |--------------------|------------------------|------------------------| //! | CoX |This parameter is a |This parameter is a | //! | |mandatory.The mandatory |mandatory. the mandatory| //! | |is the format of |is the format of | //! | |Variable naming.So it |Variable naming.So it | //! | |should be: UARTnRX, |should be: PXn | //! | |UARTnTX, UARTnCTS, |XX indicate the GPIO | //! | |......, |PORT,Such as | //! | |n indicate the pin |A B C D E ... | //! | |number such as |n indicate the pin | //! | |0 1 2 3 .... |number such as | //! | | |0 1 2 3 .... | //! |--------------------|------------------------|------------------------| //! | NUC1xx | UART0RX | PB0 | //! | | UART0TX | PB1 | //! | | UART0RTS | PB2 | //! | | UART0CTS | PB3 | //! | | UART1CTS | PB7 | //! | | UART1RTS | PB6 | //! | | UART1RX | PB4 | //! | | UART1TX | PB5 | //! | | UART2RX | PD14 | //! | | UART2TX | PD15 | //! |--------------------|------------------------|------------------------| //!
| #define xSPinTypeACMP | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO ACMP input or output pin.
| ePeripheralPin | is the GPIO Peripheral name such as I2C0SDA. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as an ACMP function and turns the pin into a GPIO ACMP input or output pin.
//! +--------------------+------------------------+------------------------+ //! | manufacturer |ePeripheralPin |eShortPin | //! |--------------------|------------------------|------------------------| //! | CoX |This parameter is a |This parameter is a | //! | |mandatory.The mandatory |mandatory. the mandatory| //! | |is the format of |is the format of | //! | |Variable naming.So it |Variable naming.So it | //! | |should be: CMPnN, |should be: PXn | //! | |CMPnO or CMPnP |XX indicate the GPIO | //! | |n indicate the pin |PORT,Such as | //! | |number such as |A B C D E ... | //! | |0 1 2 3 .... |n indicate the pin | //! | | |number such as | //! | | |0 1 2 3 .... | //! |--------------------|------------------------|------------------------| //! | NUC1xx | CMP0P | PC6 | //! | | CMP0N | PC7 | //! | | CMP0O | PB12 | //! | | CMP1P | PC14 | //! | | CMP1N | PC15 | //! | | CMP1O | PB13 | //! |--------------------|------------------------|------------------------| //!
| #define xSPinTypeCLKO | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO CLKO output pin.
| ePeripheralPin | is the GPIO Peripheral name such as I2C0SDA. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as a CLKO function and turns the pin into a GPIO CLKO output pin.
| #define xSPinTypeEXTINT | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO external interrupt pin.
| ePeripheralPin | is the GPIO Peripheral name such as I2C0SDA. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as an GPIO interrupt function and turns the pin into a GPIO external interrupt pin.
| #define xSPinTypeEBI | ( | ePeripheralPin, | |
| eShortPin | |||
| ) |
Turn a pin to a GPIO EBI pin.
| ePeripheralPin | is the GPIO Peripheral name such as I2C0SDA. Details please refer to xGPIO Pin Config. |
| eShortPin | is the GPIO short pin name such as PA0. Details please refer to xGPIO Short Pin ID. |
This function configures a pin for use as an GPIO EBI function and turns the pin into a GPIO EBI pin.
| void xGPIODirModeSet | ( | unsigned long | ulPort, |
| unsigned long | ulPins, | ||
| unsigned long | ulPinIO | ||
| ) |
Set the direction and mode of the specified pin(s).
| ulPort | is the base address of the GPIO port Details please refer to xLowLayer Peripheral Memmap. |
| ulPins | is the bit-packed representation of the pin(s). Details please refer to xGPIO General Pin ID. |
| ulPinIO | is the pin direction and/or mode. Details please refer to xGPIO Dir Mode. |
This function will set the specified pin(s) on the selected GPIO port as either an input or output under software control, or it will set the pin to be under hardware control.
The parameter ulPinIO is an enumerated data type that can be one of the following values:
Details please refer to 2.CoX Port Details.
Where xGPIO_DIR_MODE_IN specifies that the pin will be programmed as a software controlled input, xGPIO_DIR_MODE_OUT specifies that the pin will be programmed as a software controlled output, and xGPIO_DIR_MODE_HW specifies that the pin will be placed under hardware control.
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.
Details please refer to 2.CoX Port Details.
| unsigned long xGPIODirModeGet | ( | unsigned long | ulPort, |
| unsigned long | ulPin | ||
| ) |
Get the direction and mode of a pin.
| ulPort | is the base address of the GPIO port Details please refer to xLowLayer Peripheral Memmap. |
| ulPin | is the bit-packed representation of the pin. Details please refer to xGPIO General Pin ID. |
This function gets the direction and control mode for a specified pin on the selected GPIO port. The pin can be configured as either an input or output under software control, or it can be under hardware control. The type of control and direction are returned as an enumerated data type.
The pin 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.
Details please refer to 2.CoX Port Details.
| void xGPIOPinIntCallbackInit | ( | unsigned long | ulPort, |
| unsigned long | ulPin, | ||
| xtEventCallback | pfnCallback | ||
| ) |
Init the GPIO Port X Interrupt Callback function.
| ulPort | is the base address of the GPIO port. Details please refer to xLowLayer Peripheral Memmap. |
| ulPin | is the bit-packed representation of the pin. Details please refer to xGPIO General Pin ID. |
| pfnCallback | is the callback function. Details please refer to xLowLayer Types. |
When there is any pins interrupt occrus, Interrupt Handler will call the callback function.
param of pfnCallback
| void xGPIOPinIntEnable | ( | unsigned long | ulPort, |
| unsigned long | ulPins, | ||
| unsigned long | ulIntType | ||
| ) |
Set the interrupt type and Enable interrupt for the specified pin(s).
| ulPort | is the base address of the GPIO port Details please refer to xLowLayer Peripheral Memmap. |
| ulPins | is the bit-packed representation of the pin(s). Details please refer to xGPIO General Pin ID. |
| ulIntType | specifies the type of interrupt trigger mechanism. Details please refer to xGPIO Int Type. |
This function sets up the various interrupt trigger mechanisms for the specified pin(s) on the selected GPIO port.
The parameter ulIntType is an enumerated data type that can be one of the following values:
Details please refer to 2.CoX Port Details.
Where the different values describe the interrupt detection mechanism (edge or level) and the particular triggering event (falling, rising, or both edges for edge detect, low or high for level detect).
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.
Details please refer to 2.CoX Port Details.
| void xGPIOPinIntDisable | ( | unsigned long | ulPort, |
| unsigned long | ulPins | ||
| ) |
Disables interrupts for the specified pin(s).
| ulPort | is the base address of the GPIO port Details please refer to xLowLayer Peripheral Memmap. |
| ulPins | is the bit-packed representation of the pin(s). Details please refer to xGPIO General Pin ID. |
Mask the interrupt for the specified 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.
Details please refer to 2.CoX Port Details.
| void xGPIOPinIntStatus | ( | unsigned long | ulPort | ) |
Get interrupt status for the specified GPIO port.
| ulPort | is the base address of the GPIO port. Details please refer to xLowLayer Peripheral Memmap. |
| void xGPIOPinIntClear | ( | unsigned long | ulPort, |
| unsigned long | ulPins | ||
| ) |
Clear the interrupt for the specified pin(s).
| ulPort | is the base address of the GPIO port Details please refer to xLowLayer Peripheral Memmap. |
| ulPins | is the bit-packed representation of the pin(s). Details please refer to xGPIO General Pin ID. |
Clear the interrupt for the specified 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.
Details please refer to 2.CoX Port Details.
| long xGPIOPinRead | ( | unsigned long | ulPort, |
| unsigned long | ulPins | ||
| ) |
Reads the values present of the specified pin(s).
| ulPort | is the base address of the GPIO port Details please refer to xLowLayer Peripheral Memmap. |
| ulPins | is the bit-packed representation of the pin(s). Details please refer to xGPIO General Pin ID. |
The values at the specified pin(s) are read, as specified by ucPins. Values are returned for both input and output pin(s), and the value for pin(s) that are not specified by ucPins are set to 0.
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.
Details please refer to 2.CoX Port Details.
| void xGPIOPinWrite | ( | unsigned long | ulPort, |
| unsigned long | ulPins, | ||
| unsigned char | ucVal | ||
| ) |
Write a value to the specified pin(s).
| ulPort | is the base address of the GPIO port Details please refer to xLowLayer Peripheral Memmap. |
| ulPins | is the bit-packed representation of the pin(s). Details please refer to xGPIO General Pin ID. |
| ucVal | is the value to write to the pin(s), 0 or 1. |
Write the corresponding bit values to the output pin(s) specified by ucPins. Writing to a pin configured as an input pin has no effect.
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.
Details please refer to 2.CoX Port Details.
| void xGPIOPinConfigure | ( | unsigned long | ulPinConfig | ) |
Configure the alternate function of a GPIO pin.
| ulPinConfig | is the pin configuration value, specified as only one of the GPIO_P??_??? values. |
This function configures the pin mux that selects the peripheral function associated with a particular GPIO pin. Only one peripheral function at a time can be associated with a GPIO pin, and each peripheral function should only be associated with a single GPIO pin at a time (despite the fact that many of them can be associated with more than one GPIO pin).