Fork me on GitHub

Architecture-specific API

Mongoose OS does not replace the native SDK for any given platform. Instead, it adds to the native SDK capabilities. Therefore, for C/C++, all native SDK functions are available under Mongoose OS - just include the relevant header and call the function you want.

Also, Mongoose OS exports some of the native API to the JavaScript. You can easily expand the list of exported functions yourself, just add your own my_api.js file to your app or library and rebuild:

let MYAPI = {
  // Export native SDK function foo to JavaScript
  let foo: ffi('int foo(void)'),
  ...
};

JAVASCRIPT API Reference api_esp8266.js

load("api_esp8266.js");


Sys.deepSleep(microseconds)

Deep Sleep given number of microseconds. Return value: false on error, otherwise does not return.

JAVASCRIPT API Reference api_esp32.js

load("api_esp32.js");


ESP32.temp()

Read built-in temperature sensor. Return value: integer.

ESP32.hall()

Read built-in Hall sensor. Return value: integer.

Sys.deepSleep(microseconds)

Deep Sleep given number of microseconds. Return value: does not return.