VM – Library

The previous example used a lot of lines to outline the register mapping and I don’t want to be declaring all this for every app I create. Basically I just want to write something like this:

use System
use lib32io

Assign ch1.chMode = Mode.Servo
Assign ch2.chMode = Mode.DigitalIn
Assign ch3.chMode = Mode.DigitalIn

Event digitalIn[2]
            // ...
End

Event digitalIn[3]
            // ...
End

This example assumes that object “Channel” and C bindings are declared in lib32io that is part of the repository. This will work, but I need the assembler to be smart since lib32io will declare more content than we want to include on this module, so everything that is not used will be removed by the assembler to keep both module and object mapping at a minimum.

Notice that I now have introduced “library” to distinguish from “module”. Module creates a new application, library declare stuff that can be included in modules. The example above could also be written like this:

 

Leave a Reply