Skip to content
This repository was archived by the owner on Dec 24, 2017. It is now read-only.

Load Unload Cape

Simon Werner edited this page Apr 4, 2016 · 4 revisions

You can manually load/unload a cape by using following functions of OctalBoneScript.

loadCape(name)

  • provide name of cape you want to load in capemanager
  • this function executes synchronously
  • returns true on success

unloadCape(name)

  • provide name of cape you want to unload from capemanager
  • this function executes synchronously
  • returns true on success

If you want to find available capes, run ls /lib/firmware/ to list all available capes. You should supply the exact string before -00A0.dtbo as argument to above functions.

Example

b = require('octalbonescript');

b.loadCape('cape-univ-hdmi'); // this will load HDMI cape

b.unloadCape('cape-univ-hdmi'); // this will unload HDMI cape and free its pins to be used by something else.

Please note OBS loads cape-univ-hdmi and cape-universaln automatically during startup to make most of the pins available for use as GPIO.

These functions are only available on OctalBoneScript V1.1.x and above.

Don't auto-load capes

By default octalbonescript will load the cape-universaln, cape-univ-hdmi, and BB-ADC capes when you use require('octalbonescript'). This takes a little time (a few seconds) and may load capes you don't need or conflict with other capes you wish to load.

Adding AUTO_LOAD_CAPE=0 as an environment parameter will stop the auto loading of capes. However, you can still manually load and unload the capes you want. See the example below on how to start node without automatically loading capes.

AUTO_LOAD_CAPE=0 node yourscript.js