Fast GPIO
The Lightfoot SDK works with a number of independant Board Support
Packages (BSPs). The aim of a BSP is to provide the same API to an
application, indepentant of the actual hardware the system is running
on. This hardware independance is provided by a set of high level APIs.
The high level APIs are designed to be shared by multiple tasks and are
multi-thread aware. This makes it easy to quickly write an application
for a different board, it does not give the best possible performance
as each time you need to read or write to a GPIO port, there are a
number of functions involved to gain exclusive access to the port,
perform the operation and release the port.
An alternative to this is to use the BSP to gain exclusive access to
the port and then directly access the registers. This makes your
application less portable, but gives a significant performance
improvement.
In order to do this, you need to use the SetLightfootRegister
and GetLightfootRegister
builtin functions from C. This technique is shown in the Onewire example.