Built-in Actions
The WARDuino virtual machine includes built-in actions (sometimes we refer to these as primitives) that provide access to hardware and IoT specific functionality in WebAssembly programs.
WebAssembly Actions
The built-in actions are implemented seperately for each hardware platform. We group the built-in actions into modules, which are listed in the table below.
Module | Emulator | Arduino | ESP IDF | Zephyr | Open Bot Brain |
---|---|---|---|---|---|
analog I/O | ➖ | ✅ | ➖ | ➖ | ➖ |
digital I/O | ⏪ | ✅ | ✅ | ⏪ | ⏪ |
external interrupts | ✅ | ✅ | ➖ | ➖ | ➖ |
http | ➖ | 👷 | ➖ | ➖ | ➖ |
mqtt | ➖ | 👷 | ➖ | ➖ | ➖ |
neopixel | ➖ | 👷 | ➖ | ➖ | ➖ |
servo motors | ➖ | ➖ | ➖ | ➖ | ⏪ |
serial | ✅ | ✅ | ➖ | 👷 | 👷 |
spi | ➖ | ✅ | ➖ | ➖ | ➖ |
time | ✅ | ✅ | 👷 | ➖ | ➖ |
wifi | ➖ | ✅ | ➖ | ➖ | ➖ |
⏪ = implemented and reversible | ✅ = implemented | 👷 = partially implemented | ➖ = not implemented
The built-in primitives are divided conceptually into different modules, according to the functionality they provide. The primitives are hardware dependent and so have to be implemented for each hardware platform separately. The table below list all modules, and on which platforms they are supported.
Using Actions
The actions can be imported in WebAssembly from the env
module.
(import "env" "chip_delay" (func $delay (type $int->void)))
Custom Actions
The WARDuino virtual machine is open-source, and developers are encouraged to extend the existing primitives with their own functionality.