Whats the difference between hardware and software control of pins regarding GPIODirModeSet() ?
Also, since the direction can also be configured using GPIOPinTypeGPIO______, then why do we use GPIODirModeSet() ?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Whats the difference between hardware and software control of pins regarding GPIODirModeSet() ?
Also, since the direction can also be configured using GPIOPinTypeGPIO______, then why do we use GPIODirModeSet() ?
Hello Vikas,
GPIODirModeSet is called by GPIO Functions for setting Pins for different peripherals.
Hardware control is where a peripheral directly controls the pin
Software control is where the GPIO is driven 1 or 0 by the CPU Software.
Regards
Amit
But I think, GPIOPinTypeGPIOOutput() also does the same thing? (correct me if I am wrong)
Hello Vikas,
Yes, it also calls the same GPIODirModeSet but in this case it passes the 3rd parameter as GPIO_DIR_MODE_OUT in which case the AFSEL bit is cleared allowing the CPU to directly write/read the GPIO.
Regards
Amit