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.

README.txt

Committer:
jhnwkmn
Date:
2014-12-16
Revision:
0:6f55c7651ccc

File content as of revision 0:6f55c7651ccc:

Squirrel for FRDM-K64F
======================
This is an *experimental* port of the Squirrel interpreter to the mbed 
platform, in particular FRDM-K64F. Experimental means that that the port
is of POC quality, so don't expect to be able to switch over to Squirrel
just yet.

That said, it can already be used for trying things out interractively
from a prompt.

For more information about the Squirrel language, please consult the
official site http://www.squirrel-lang.org/. There is also useful
Squirrel information at the Electric Imp site
(https://electricimp.com/docs/squirrel/learningsquirrel/). Squirrel
is the "native" language of Electric Imp.

In addition to the interpreter itself, a few core components of mbed
has also been made available:

    DigitalIn
    DigitalOut
    DigitalInOut
    PwmOut
    Ticker
    Timeout
    Timer
    
The provided functionality is a subset of the corresponding native
mbed components.

Examine the components in sqmbed/src to see what functionality is
available.


In addition, InterruptIn is also supported. However, interrupts are
*not* delivered as they occur, but they are queued and delivered when
it is safe to do so from the point of view of the Squirrel interpreter.
In practice this means that they are not delivered from interrupt
context and that there are no restrictions what can be done in the
handler.

Source structure
----------------
+sqbind-0_099   Utility library that makes binding easier.
+sqk64f         k64f-specific code (interrupt handling)
+sqmbed         Generic mbed extensions for Squirrel.
+SQUIRREL3      The Squirrel virtual machine.

PuTTY Configuration
-------------------
Default terminal settings, but for
    [X] Implicit CR in every LF

Local echo:
    (o) Force on
    
Local line editing:
    (o) Force on
    

Trying Out
==========
- Build in the web-ide.
- Flash the .bin file.
- Start Putty.
- Press reset on the board.

You should be greeted with:

    Squirrel 3.0.6 stable Copyright (C) 2003-2014 Alberto Demichelis (32 bits)
    
    sq>

Then try the usual Hello World.

    sq>print("Hello World\n");
    Hello, World
    
    sq>

Let's try turning the led on and off.

    sq>::led<-DigitalOut(LED1);

    sq>led.write(0);

    sq>led.write(1);

    sq>
    
Let's inform when button SW2 is pressed.

    sq>::i<-InterruptIn(SW2);

    sq>function buttonPressed() { print("Button pressed\n"); }

    sq>buttonPressed();
    Button pressed

    sq>i.rise(buttonPressed);

    sq>while (true) {}
    Button pressed
    Button pressed
    Button pressed

Note that in order for the interrupts to work, the interpreter needs to be
running. That it won't be, while waiting for input at the prompt ("sq>").

Contact
=======
Feel free to contact me in case you have questions: johan.wikman@iki.fi