[INFO] Enhancements to the PAL driver

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

[INFO] Enhancements to the PAL driver

Postby Giovanni » Mon Nov 02, 2015 11:27 am

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

Jacon
Posts: 141
Joined: Wed Dec 08, 2010 7:52 am
Has thanked: 48 times
Been thanked: 5 times

Re: [INFO] Enhancements to the PAL driver

Postby Jacon » Mon Nov 02, 2015 8:31 pm

Great, and very much welcomed idea, Giovanni :D

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: [INFO] Enhancements to the PAL driver

Postby Tectu » Mon Nov 02, 2015 8:34 pm

I like where this is going. Nice work!


~ Tectu

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: [INFO] Enhancements to the PAL driver

Postby Giovanni » Tue Nov 03, 2015 9:13 am

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

a.giacomolli
Posts: 3
Joined: Wed Aug 29, 2012 7:21 pm

Re: [INFO] Enhancements to the PAL driver

Postby a.giacomolli » Sat Nov 07, 2015 1:05 pm

Hi

In the function palWriteLine, pin needs to be line.

Anderson

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: [INFO] Enhancements to the PAL driver

Postby Giovanni » Sat Nov 07, 2015 2:48 pm

Hi,

Thanks, fixed.

Giovanni


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 46 guests