The Squirrel interpreter for FRDM-K64F, extended with a set of classes that provide access to the mbed functionality (currently DigitalIn, DigitalInOut, DigitalOut, InterruptIn, PwmOut, Ticker, Timeout, Timer).

Dependencies:   SQUIRREL3 mbed sqbind-0_99

The Squirrel interpreter for FRDM-K64F.

NOTE: Currently of POC quality.

See http://www.squirrel-lang.org/ for information about the Squirrel language.

Currently the following (a subset of their functionality) mbed classes are available from within Squirrel:

  • DigitalIn
  • DigitalOut
  • DigitalInOut
  • PwmOut
  • Ticker
  • Timeout
  • Timer

In addition, InterruptIn is supported, but interrupts are noted when they occur, but only delivered from the main loop of the interpreter.

See also README.txt in the root of the project.

sqmbed/src/mbedsq.cpp

Committer:
jhnwkmn
Date:
2014-12-16
Revision:
0:6f55c7651ccc
Child:
1:540008bb92a2

File content as of revision 0:6f55c7651ccc:

/*
  @License@
*/

#include <mbed.h>
#include <sqmbed/digitalin.h>
#include <sqmbed/digitalinout.h>
#include <sqmbed/digitalout.h>
#include <sqmbed/interruptin.h>
#include <sqmbed/pwmout.h>
#include <sqmbed/ticker.h>
#include <sqmbed/timeout.h>
#include <sqmbed/timer.h>

using namespace std;

namespace
{

void bindGlobals(HSQUIRRELVM vm)
{
    sqbind_function(vm, "wait", wait);
    sqbind_function(vm, "wait_ms", wait_ms);
    sqbind_function(vm, "wait_us", wait_us);
}

void bindMbed(HSQUIRRELVM vm)
{
    SqMbed::DigitalIn::bind(vm);
    SqMbed::DigitalInOut::bind(vm);
    SqMbed::DigitalOut::bind(vm);
    SqMbed::InterruptIn::bind(vm);
    SqMbed::PwmOut::bind(vm);
    SqMbed::Ticker::bind(vm);
    SqMbed::Timeout::bind(vm);
    SqMbed::Timer::bind(vm);
}

}

extern "C" void sq_bind_mbed(HSQUIRRELVM vm)
{
    bindGlobals(vm);
    bindMbed(vm);

    // Platform specific bindings.
    SqMbed::bindPlatform(vm);
}

extern "C" void mbed_execute_idle(HSQUIRRELVM vm)
{
    SqMbed::InterruptIn::flushInterrupts();
    SqMbed::Trigger::flushTriggers();
}