5. Our RPi-Spark sprite: RPiSparkModule class

In the previous section (4.1), we completed our first HelloWorld program with the shortest line of code by inheriting the RPiSparkModule class. In the code line you will find that you don't need to care about how to use the hardware of display, such as: configuring hardware pins of display, initializing display, data transfer to display etc.

You just need to focus to what is show on display and what pattern to draw, then draw on display through the canvas instance object.
Finally notice display to update to get the results you want.

We called each application as a Spark, which is a subclass that inherits from RPiSparkModule. We just to implement two RPiSparkModule member functions setup() and run() to complete a Spark application.

The RPiSparkModule class has handled some common event for us, let us focus to what we need RPi-Spark to do. The following are the event operations and object instances that RPiSparkModule provides for us:


 

Was this article helpful?

YES     |     NO

 

Enjoying the project? Spotted a mistake? Any opinions on the website? Let us know!