palWriteGroup or palWritePort for PoRT data

Discussions and support about ChibiOS/RT, the free embedded RTOS.
Post Reply
ep.hobbyiest
Posts: 94
Joined: Sun Jun 26, 2016 5:22 pm
Has thanked: 4 times
Been thanked: 1 time

palWriteGroup or palWritePort for PoRT data

Post by ep.hobbyiest »

Hi,

I want to write some data on port. So, i got api' for that. But i am not sure which one to use.
i want to write data on GPIOC port. data is 16- bit.

Code: Select all

palWriteGroup (GPIOC,0xFF,0,data);
palWritePort(GPIOC,data) ;


Which one i can use.
User avatar
tfAteba
Posts: 551
Joined: Fri Oct 16, 2015 11:03 pm
Has thanked: 91 times
Been thanked: 50 times

Re: palWriteGroup or palWritePort for PoRT data

Post by tfAteba »

Hi ep.hobbyiest,

The both function allow to write you date to a Port but not in the same maner.

With PalWriteGroup, you can decide to on write a part of the port by playing with the offset parameter. If some bits don't change for example.
whereas with PalwritePort you write on all the bits of the port even those which didn't change.

For me, in your case, because of you offset of "0", you can use both API. But because you write all the bit of the port it is then better to use PalWritePort.
Post Reply