This piece of code was taken from AMIS30543- Arduino library,
void init(uint8_t slaveSelectPin) {
ssPin = slaveSelectPin;
digitalWrite(ssPin, HIGH);
pinMode(ssPin, OUTPUT);
}
Facts I know
- digitalWrite - makes the pin to the corresponding voltage level
- pinMode - makes the pin either input or output
- ssPin is active low pin usually.
So I was wondering before setting the pinDirection why the pin is made HIGH, Then immediately after that the pinDirection was declared as OUTPUT
Also I know , if a pin was made HIGH and on the next line if the direction of the same is set as INPUT will bring the internal pull up resistor in action .
So what am I missing here. More over in Arduino does the order of pinMode/digitalWrite matter.? if So what is the meaning of this particular lines of code Github link to the library