I saw the code below, when i downloaded a library for a DOGM lcd screen:
// Set SPI-Mode 3: CLK idle high, rising edge, MSB first
digitalWrite(p_clk, HIGH); //SCK = p_clk = Pin13 = PB5
pinMode(p_clk, OUTPUT);
The mcu uses SPI to send signals to the LCD. Why first give 5V to the pin(aka activate its pull-up), and then declare it as output? Isn't it the same if these two lines switched sides?
In the end, the pin will be output, giving 5V, and the pull-up resistor won't be activated.
I think this has something to do with the SPI library/ the way the SPI works, or something about tri-state function of the pins i do not know, like will the pull-up resistor still be activated after this code?.
Thanks