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.

Committer:
jhnwkmn
Date:
Tue Dec 16 12:54:53 2014 +0000
Revision:
0:6f55c7651ccc
Child:
1:540008bb92a2
Added README.txt;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jhnwkmn 0:6f55c7651ccc 1 /*
jhnwkmn 0:6f55c7651ccc 2 @License@
jhnwkmn 0:6f55c7651ccc 3 */
jhnwkmn 0:6f55c7651ccc 4
jhnwkmn 0:6f55c7651ccc 5 #include <mbed.h>
jhnwkmn 0:6f55c7651ccc 6 #include <sqmbed/digitalin.h>
jhnwkmn 0:6f55c7651ccc 7 #include <sqmbed/digitalinout.h>
jhnwkmn 0:6f55c7651ccc 8 #include <sqmbed/digitalout.h>
jhnwkmn 0:6f55c7651ccc 9 #include <sqmbed/interruptin.h>
jhnwkmn 0:6f55c7651ccc 10 #include <sqmbed/pwmout.h>
jhnwkmn 0:6f55c7651ccc 11 #include <sqmbed/ticker.h>
jhnwkmn 0:6f55c7651ccc 12 #include <sqmbed/timeout.h>
jhnwkmn 0:6f55c7651ccc 13 #include <sqmbed/timer.h>
jhnwkmn 0:6f55c7651ccc 14
jhnwkmn 0:6f55c7651ccc 15 using namespace std;
jhnwkmn 0:6f55c7651ccc 16
jhnwkmn 0:6f55c7651ccc 17 namespace
jhnwkmn 0:6f55c7651ccc 18 {
jhnwkmn 0:6f55c7651ccc 19
jhnwkmn 0:6f55c7651ccc 20 void bindGlobals(HSQUIRRELVM vm)
jhnwkmn 0:6f55c7651ccc 21 {
jhnwkmn 0:6f55c7651ccc 22 sqbind_function(vm, "wait", wait);
jhnwkmn 0:6f55c7651ccc 23 sqbind_function(vm, "wait_ms", wait_ms);
jhnwkmn 0:6f55c7651ccc 24 sqbind_function(vm, "wait_us", wait_us);
jhnwkmn 0:6f55c7651ccc 25 }
jhnwkmn 0:6f55c7651ccc 26
jhnwkmn 0:6f55c7651ccc 27 void bindMbed(HSQUIRRELVM vm)
jhnwkmn 0:6f55c7651ccc 28 {
jhnwkmn 0:6f55c7651ccc 29 SqMbed::DigitalIn::bind(vm);
jhnwkmn 0:6f55c7651ccc 30 SqMbed::DigitalInOut::bind(vm);
jhnwkmn 0:6f55c7651ccc 31 SqMbed::DigitalOut::bind(vm);
jhnwkmn 0:6f55c7651ccc 32 SqMbed::InterruptIn::bind(vm);
jhnwkmn 0:6f55c7651ccc 33 SqMbed::PwmOut::bind(vm);
jhnwkmn 0:6f55c7651ccc 34 SqMbed::Ticker::bind(vm);
jhnwkmn 0:6f55c7651ccc 35 SqMbed::Timeout::bind(vm);
jhnwkmn 0:6f55c7651ccc 36 SqMbed::Timer::bind(vm);
jhnwkmn 0:6f55c7651ccc 37 }
jhnwkmn 0:6f55c7651ccc 38
jhnwkmn 0:6f55c7651ccc 39 }
jhnwkmn 0:6f55c7651ccc 40
jhnwkmn 0:6f55c7651ccc 41 extern "C" void sq_bind_mbed(HSQUIRRELVM vm)
jhnwkmn 0:6f55c7651ccc 42 {
jhnwkmn 0:6f55c7651ccc 43 bindGlobals(vm);
jhnwkmn 0:6f55c7651ccc 44 bindMbed(vm);
jhnwkmn 0:6f55c7651ccc 45
jhnwkmn 0:6f55c7651ccc 46 // Platform specific bindings.
jhnwkmn 0:6f55c7651ccc 47 SqMbed::bindPlatform(vm);
jhnwkmn 0:6f55c7651ccc 48 }
jhnwkmn 0:6f55c7651ccc 49
jhnwkmn 0:6f55c7651ccc 50 extern "C" void mbed_execute_idle(HSQUIRRELVM vm)
jhnwkmn 0:6f55c7651ccc 51 {
jhnwkmn 0:6f55c7651ccc 52 SqMbed::InterruptIn::flushInterrupts();
jhnwkmn 0:6f55c7651ccc 53 SqMbed::Trigger::flushTriggers();
jhnwkmn 0:6f55c7651ccc 54 }