Can I write Driver function access gpio at constant rate in task handler function
If i write so, is there any problem for switching or yielding of the task
Depends on the “rate” and how precise the timing needs to be.
Toggling a GPIO at 100 KHz will be tough, Reading a button at 100 Hz is easy.
As to problems with switching to or yielding, that depends on the other tasks in the system (and the rate as described above). If the access rate is a multiple of the tick period, then it just becomes a question of balancing your task priorities.