Categories
Mastering Development

How does the following C operators combined

For EFR32FG14P231F256M32 i have the following combination of C operators. with the descrition shown bellow.I am having trouble matching the description to the code.
-> is a pointer. we have pointing directions on both sides?
|-is bit wise or
.Dout i think means taking the Dout member from th following P[gpioPortC ] cell
but regrading | (1 << 5); i am having problem understand.
What is the logical meaning of such C operator combinations in single line?
Thanks.

The following code configures pin 5 from Port C as a digital input with pull-up and filter. The MODE5 bitfield from GPIO_PC_MODEL
register must be set to 0b0011, and the correspondent bit in the GPIO_PC_DOUT register must also be set to 1 to determine the pull
direction. A pin can be configured either by using the functions available in the emlib or through a direct register write:

GPIO->P[gpioPortC ].DOUT = GPIO->P[gpioPortC ].DOUT | (1 << 5); //Input enabled with pull up and filter
GPIO->P[gpioPortC ].MODEL = (GPIO->P[gpioPortC ].MODEL & ~_GPIO_P_MODEL_MODE5_MASK) |
GPIO_P_MODEL_MODE5_INPUTPULLFILTER;

Leave a Reply

Your email address will not be published. Required fields are marked *