Page 1 of 1

[INFO] Enhancements to the PAL driver

Posted: Mon Nov 02, 2015 11:27 am
by Giovanni
It is the oldest driver and also the one that received least changes over the years.

I just introduced the new concept of "line", A line is a combo of port and pin, this simplifies the API a lot, for example instead of writing:

palSetPad(GPIOA, GPIOA_LED_GREEN);

Now it is possible to write:

palSetLine(LINE_LED_GREEN);

The advantages are:
- Easier to use API.
- Identifiers not bound to specific ports, this makes code a lot more portable.

The new functions are: palWriteLine(), palReadLine(), palSetLine(), palClearLine(), palToggleLine(), palSetLineMode(). Those are all macros so there is no code size increase, the old API is still available.
I modified the GPIOv1 and GPIOv2 drivers. Platforms with not updated drivers will give an error when trying one of the new macros but will work unmodified otherwise.

The boards generator now generates macros for both "Pad" and "Line" functions, it now generates both GPIOA_LED_GREEN and LINE_LED_GREEN.

I only updated the F7 boards/demos, others will be done gradually.

Giovanni

Re: [INFO] Enhancements to the PAL driver

Posted: Mon Nov 02, 2015 8:31 pm
by Jacon
Great, and very much welcomed idea, Giovanni :D

Re: [INFO] Enhancements to the PAL driver

Posted: Mon Nov 02, 2015 8:34 pm
by Tectu
I like where this is going. Nice work!


~ Tectu

Re: [INFO] Enhancements to the PAL driver

Posted: Tue Nov 03, 2015 9:13 am
by Giovanni
Change to the boards generator, now it is possible to make aliases of pins (giving them multiple names) by simply separating identifiers with a space in the .chcfg.

It will be included in next ChibiStudio and also be available as installable plugin on the update site.

Giovanni

Re: [INFO] Enhancements to the PAL driver

Posted: Sat Nov 07, 2015 1:05 pm
by a.giacomolli
Hi

In the function palWriteLine, pin needs to be line.

Anderson

Re: [INFO] Enhancements to the PAL driver

Posted: Sat Nov 07, 2015 2:48 pm
by Giovanni
Hi,

Thanks, fixed.

Giovanni