[INFO] Enhancements to the PAL driver
Posted: 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
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