palWriteGroup or palWritePort for PoRT data

Discussions and support about ChibiOS/RT, the free embedded RTOS.
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

Postby ep.hobbyiest » Sun Oct 09, 2016 8:55 am

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: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: palWriteGroup or palWritePort for PoRT data

Postby tfAteba » Sun Oct 09, 2016 10:46 am

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.
regards,

Theo.


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 5 guests