1.21.9.3 GPIO_PortWrite Function

C

void GPIO_PortWrite(GPIO_PORT port, uint32_t mask, uint32_t value);

Summary

Write the value on the masked I/O lines of the selected port.

Description

This function writes the data values driven on selected output lines of the selected port. Bit values in each position indicate corresponding pin levels.

  • 1 - Pin is driven to HIGH level.

  • 0 - Pin is driven to LOW level.

Precondition

The desired pins lines of the selected port must be setup as output(s)

Parameters

Param Description
port One of the IO ports from the enum GPIO_PORT
value Value which has to be written/driven on the I/O lines of the selected port for which mask bits are '1'. Values for the corresponding mask bit '0' will be ignored.
mask A 32 bit value in which positions of 0s and 1s decide which IO pins of the selected port will be written.
  • 1's Will write to corresponding IO pins.

  • 0's Will remain unchanged.

Returns

None.

Example

// Write binary value 0011 to the pins RC3, RC2, RC1 and RC0 respectively.
GPIO_PortWrite(GPIO_PORT_C, 0x0F, 0xF563D453);

Remarks

If the port has less than 32-bits, unimplemented pins will be ignored. Implemented pins are Right aligned in the 32-bit value.