Built-in Primitives
Programming in high-level languages
Language specific libraries for AssemblyScript and Rust, give access to the built-in primitives. This guide has more information on how to get started with them.
The WARDuino virtual machine includes built-in primitives that provide access to hardware and IoT specific functionality to WebAssembly programs.
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.
Module | Arduino | ESP IDF | Zephyr |
---|---|---|---|
analog I/O | ✅ | ➖ | ➖ |
digital I/O | ✅ | ✅ | ✅ |
external interrupts | ✅ | ➖ | ➖ |
http | 👷 | ➖ | ➖ |
mqtt | 👷 | ➖ | ➖ |
neopixel | 👷 | ➖ | ➖ |
serial | ✅ | ➖ | 👷 |
spi | ✅ | ➖ | ➖ |
time | ✅ | 👷 | ➖ |
wifi | ✅ | ➖ | ➖ |
✅ = implemented | 👷 = partially implemented | ➖ = not implemented
Using Primitives
The primitives can be imported in WebAssembly from the env
module.
(import "env" "chip_delay" (func $delay (type $int->void)))
Custom Primitives
The WARDuino virtual machine is open-source, and developers are encouraged to extend the existing primitives with their own functionality.