nanoFORTH  v2.2
NanoForth Class Reference

#include <n4.h>

Public Member Functions

void setup (const char *code=0, Stream &io=Serial, U8 ucase=0)
 placeholder for extra setup More...
 
void exec ()
 nanoForth execute one line of command input More...
 

Static Public Member Functions

static void add_api (U16 i, void(*fp)())
 
static void yield ()
 nanoForth yield to user tasks More...
 
static void wait (U32 ms)
 pause NanoForth thread for ms microseconds, yield to user tasks More...
 
static void call_api (U16 id)
 call C API interface More...
 

Static Private Attributes

static FPTR fp [N4_API_SZ] = { NULL }
 C API function pointer slots. More...
 

Member Function Documentation

◆ setup()

void NanoForth::setup ( const char *  code = 0,
Stream &  io = Serial,
U8  ucase = 0 
)

placeholder for extra setup

n4 VM init proxy

  • create Virtual Machine
Parameters
codepreload Forth code
ioiostream which can be redirected to SoftwareSerial
ucasecase sensitiveness (default: sensitive)

◆ exec()

void NanoForth::exec ( )

nanoForth execute one line of command input

n4 execute one line of commands from input buffer

  • step through commands from input buffer
  • give some cycles to user defined tasks

◆ add_api()

void NanoForth::add_api ( U16  i,
void(*)()  fp 
)
static

add new (user defined) hardware task to linked-list

Parameters
iadd the user function to NanoForth task manager index of function pointer slots
fpuser function pointer to be added

◆ yield()

void NanoForth::yield ( )
static

nanoForth yield to user tasks

n4 yield, execute one round of user hardware tasks

Note:

  • 0 isr, n4: 1 blinker - 17us/cycle
  • service hardware interrupts

◆ wait()

void NanoForth::wait ( U32  ms)
static

pause NanoForth thread for ms microseconds, yield to user tasks

aka Arduino delay(), yield to hardware context while waiting

◆ call_api()

void NanoForth::call_api ( U16  id)
static

call C API interface

Field Documentation

◆ fp

FPTR NanoForth::fp = { NULL }
staticprivate

C API function pointer slots.


The documentation for this class was generated from the following files: