GPIODirModeSet
函数名GPIODirModeSet原函数void GPIODirModeSet(unsigned int baseAdd,unsigned int pinNumber, unsigned int pinDir)功能configures the direction of a pin as input or output.参数baseAdd:The memory address of the GPIO instance being used.pinNumber:The serial number of the GPIO pin.pinDir:The direction to be set for the pin.This can take the values: GPIO_DIR_INPUT, for configuring the pin as input.GPIO_DIR_OUTPUT, for configuring the pin as output.返回值None备注Here we write to the DIRn register. Writing a logic 1 configures the pin as input and writing logic 0 as output. By default, all the pins are set as input pins.GPIODirModeGet
函数名GPIODirModeGet原函数unsigned int GPIODirModeGet(unsigned int baseAdd, unsigned int pinNumber)功能gets the direction of a pin which has been configured asan input or an output pin.参数baseAdd:The memory address of the GPIO instance being used.pinNumber:The serial number of the GPIO pin.返回值pinDir:The direction to be set for the pin.This can take the values: GPIO_DIR_INPUT, for configuring the pin as input.GPIO_DIR_OUTPUT, for configuring the pin as output.备注GPIOPinWrite
函数名GPIOPinWrite原函数GPIOPinWrite(unsigned int baseAdd, unsigned int pinNumber, unsigned int bitValue)功能writes a logic 1 or a logic 0 to the specified pin.参数baseAdd:The memory address of the GPIO instance being used.pinNumber:The serial number of the GPIO pin.bitValue This signifies whether to write a logic 0 or logic 1 to the specified pin.This variable can take any of the following two value: GPIO_PIN_LOW, which indicates to clear(logic 0) the bit. GPIO_PIN_HIGH, which indicates to set(logic 1) the bit.返回值none备注GPIOPinRead
函数名GPIOPinRead原函数int GPIOPinRead(unsigned int baseAdd, unsigned int pinNumber)功能reads the value(logic level) of an input or an output pin.参数baseAdd:The memory address of the GPIO instance being used.pinNumber:The serial number of the GPIO pin.返回值This signifies whether to write a logic 0 or logic 1 to the specified pin.This variable can take any of the following two value: GPIO_PIN_LOW, which indicates to clear(logic 0) the bit. GPIO_PIN_HIGH, which indicates to set(logic 1) the bit.备注Configuring the trigger level type for generating interrupts is not enough for the GPIO module to generate interrupts. The user should also enable the interrupt generation capability for the bank to which the pin belongs to. Use the function GPIOBankIntEnable() to do the same.GPIOIntTypeSet
函数名GPIOIntTypeSet原函数void GPIOIntTypeSet(unsigned int baseAdd, unsigned int pinNumber, unsigned int intType)功能configures the trigger level type for which an interrupt is required to occur.参数baseAdd:The memory address of the GPIO instance being used.pinNumber:The serial number of the GPIO pin.intType:This specifies the trigger level type. This can take one of the following four values: GPIO_INT_TYPE_NOEDGE, to not generate any interrupts.GPIO_INT_TYPE_FALLEDGE, to generate an interrupt on the falling edge of a signal on that pin. GPIO_INT_TYPE_RISEDGE, to generate an interrupt on the rising edge of a signal on that pin. GPIO_INT_TYPE_BOTHEDGE, to generate interrupts on both rising and falling edges of a signal on that pin.返回值none备注Configuring the trigger level type for generating interrupts is not enough for the GPIO module to generate interrupts. The user should also enable the interrupt generation capability for the bank to which the pin belongs to. Use the function GPIOBankIntEnable() to do the same.GPIOIntTypeGet
函数名GPIOIntTypeGet原函数unsigned int GPIOIntTypeGet(unsigned int baseAdd, unsigned int pinNumber)功能reads the trigger level type being set for interrupts to be generated.参数baseAdd:The memory address of the GPIO instance being used.pinNumber:The serial number of the GPIO pin.返回值This returns a value which indicates the type of trigger level type being set. One of the following values is returned:GPIO_INT_TYPE_NOEDGE, to not generate any interrupts.GPIO_INT_TYPE_FALLEDGE, to generate an interrupt on the falling edge of a signal on that pin. GPIO_INT_TYPE_RISEDGE, to generate an interrupt on the rising edge of a signal on that pin. GPIO_INT_TYPE_BOTHEDGE, to generate interrupts on both rising and falling edges of a signal on that pin.备注GPIOPinIntStatus
函数名GPIOPinIntStatus原函数unsigned int GPIOPinIntStatus(unsigned int baseAdd, unsigned int pinNumber)功能determines the status of interrupt on a specified pin.参数baseAdd:The memory address of the GPIO instance being used.pinNumber:The serial number of the GPIO pin.返回值This returns a value which expresses the status of an interrupt raised over the specified pin. GPIO_INT_NOPEND, if no interrupts are left to be serviced. GPIO_INT_PEND, if the interrupt raised over that pin is yet to be cleared and serviced.备注GPIOPinIntClear
函数名GPIOPinIntClear原函数void GPIOPinIntClear(unsigned int baseAdd, unsigned int pinNumber)功能clears the interrupt status of the pin being accessed.参数baseAdd:The memory address of the GPIO instance being used.pinNumber:The serial number of the GPIO pin.返回值none备注GPIOBankIntEnable
函数名GPIOBankIntEnable原函数void GPIOBankIntEnable(unsigned int baseAdd, unsigned int bankNumber)功能enables the interrupt generation capability for the bank of GPIO pins specified.参数baseAdd:The memory address of the GPIO instance being used.bankNumber:This is the bank for whose pins interrupt generation capability needs to be enabled.返回值none备注GPIOBankIntDisable
函数名GPIOBankIntDisable原函数void GPIOBankIntDisable(unsigned int baseAdd, unsigned int bankNumber)功能disables the interrupt generation capability for the bank of GPIO pins specified.参数baseAdd:The memory address of the GPIO instance being used.bankNumber:This is the bank for whose pins interrupt generation capability needs to be disabled.返回值none备注GPIOBankPinsWrite
函数名GPIOBankPinsWrite原函数void GPIOBankPinsWrite(unsigned int baseAdd, unsigned int bankNumber, unsigned int setPins, unsigned int clrPins)功能is used to collectively set and collectively clear the specified bits.参数baseAdd:The memory address of the GPIO instance being used.bankNumber:This is the bank for whose pins interrupt generation capability needs to be modified.setPins:The bit-mask of the pins whose values have to be set. This could be the bitwise OR of the following macros: GPIO_BANK_PIN_n where n >= 0 and n <= 15.clrPins:The bit-mask of the pins whose values have to be cleared. This could be the bitwise OR of the following macros: GPIO_BANK_PIN_n where n >= 0 and n <= 15.返回值none备注