Communicate with SPI Display using Lightning providers
This sample demonstrates how to communicate with SPI bus controllers using the Micorosot.IoT.Providers.Lightning.SpiProvider
It’s based on the SPI Display sample shared on SPI Display sample. And shares the same setup steps and most of the code. The only difference is setting the Lightning provider as the default controllers provider.
Using Lightning Provider
Using the default GPIO and SPI controllers, the original code for initializing SPI and GPIO controllers used the following:
Now, to enable the use of the Lightning provider, the GPIO and SPI controllers initialization code needs to be modified to set the Lightning provider as the default.
In the initialization code below, if the Lightning driver is enabled on the target device, the Lightning provider will be used. Otherwise, the app falls back to using the default provider.
Building and deploying the sample
Enable Lightning on your Raspberry Pi2 or MBM device using the the steps outlined in the Lightning Setup Guide.
Ensure the correct version of the Windows SDK is installed on your development machine. The required Windows SDK can be installed from here.
Clone the source for the SPI Display sample for Lightning from Github to a local folder.