SLAU846A June 2023 – October 2023 MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1
The GPIO peripheral has features and dedicated registers to allow for advanced bit manipulations without the need to execute a read-modify-write construct in software. These features are outlined below.
The DIN31_0 register is the data input register for a given GPIO port. Reading a bit in the DIN31_0 register corresponds to reading the signal voltage level on the associated device pin signal. The GPIO peripheral provides single-bit byte-read addresses for all bits of DIN. These registers are named DIN31_28, DIN27_24, … , DIN3_0 and are essentially alias registers for all of the bits in the DIN31_0 data input register. Reading from the DIN31_28 register grants you byte level access to DIN31:28 which allows you to perform direct read comparisons without masking.
In many cases it is useful to write specific values for device pin signals based on the user's system. Register DOUT31_0 is the physical data output register for a given GPIO port. Setting a bit in the DOUT31_0 register sets the corresponding device pin signal when the output is enabled through the DOE31_0 register. Conversely, clearing a bit in the DOUT31_0 register clears the corresponding device pin signal.
The GPIO peripheral also provides single-bit byte-write addresses for all bits of DOUT. These registers are named DOUT31_28, DOUT27_24, … , DOUT3_0 and are essentially alias registers for all of the bits in the DOUT31_0 data output register. Writing to the DOUT31_28 register grants you byte level access to DOUT31:28 which allows you to directly write to these individual bits without the need to use a read-modify-write construct.
Similar to the use-cases described above, it is also useful in an application to set, clear, or toggle a device pin or a collection of pins. The MSPM0 platform lets you execute these functions in one write cycle using the DOUTSET31_0, DOUTCLR31_0, and DOUTTGL31_0 registers. Setting a bit in these registers implements the corresponding function while writing a '0' has no effect. This feature allows you to directly set, clear, and toggle any bit in the DOUT31_0 register using a single command per GPIO port.
In the same way one can set and clear the data output bits, there are registers to do the same functionality with the data output enable register, DOE31_0. Writing a '1' to bits in the DOESET31_0 and DOECLR31_0 register implements the corresponding function while writing a '0' has no effect. This feature allows you to directly set or clear any bit in the DOE31_0 register using a single command per GPIO port.