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 <sqmbed/timer.h>
jhnwkmn 0:6f55c7651ccc 6
jhnwkmn 0:6f55c7651ccc 7 namespace SqMbed
jhnwkmn 0:6f55c7651ccc 8 {
jhnwkmn 0:6f55c7651ccc 9
jhnwkmn 0:6f55c7651ccc 10 Timer::Timer()
jhnwkmn 0:6f55c7651ccc 11 {
jhnwkmn 0:6f55c7651ccc 12 }
jhnwkmn 0:6f55c7651ccc 13
jhnwkmn 0:6f55c7651ccc 14 Timer::~Timer()
jhnwkmn 0:6f55c7651ccc 15 {
jhnwkmn 0:6f55c7651ccc 16 }
jhnwkmn 0:6f55c7651ccc 17
jhnwkmn 0:6f55c7651ccc 18 void Timer::start()
jhnwkmn 0:6f55c7651ccc 19 {
jhnwkmn 0:6f55c7651ccc 20 m_timer.start();
jhnwkmn 0:6f55c7651ccc 21 }
jhnwkmn 0:6f55c7651ccc 22
jhnwkmn 0:6f55c7651ccc 23 void Timer::stop()
jhnwkmn 0:6f55c7651ccc 24 {
jhnwkmn 0:6f55c7651ccc 25 m_timer.stop();
jhnwkmn 0:6f55c7651ccc 26 }
jhnwkmn 0:6f55c7651ccc 27
jhnwkmn 0:6f55c7651ccc 28 void Timer::reset()
jhnwkmn 0:6f55c7651ccc 29 {
jhnwkmn 0:6f55c7651ccc 30 m_timer.reset();
jhnwkmn 0:6f55c7651ccc 31 }
jhnwkmn 0:6f55c7651ccc 32
jhnwkmn 0:6f55c7651ccc 33 float Timer::read() const
jhnwkmn 0:6f55c7651ccc 34 {
jhnwkmn 0:6f55c7651ccc 35 return m_timer.read();
jhnwkmn 0:6f55c7651ccc 36 }
jhnwkmn 0:6f55c7651ccc 37
jhnwkmn 0:6f55c7651ccc 38 int Timer::read_ms() const
jhnwkmn 0:6f55c7651ccc 39 {
jhnwkmn 0:6f55c7651ccc 40 return m_timer.read_ms();
jhnwkmn 0:6f55c7651ccc 41 }
jhnwkmn 0:6f55c7651ccc 42
jhnwkmn 0:6f55c7651ccc 43 int Timer::read_us() const
jhnwkmn 0:6f55c7651ccc 44 {
jhnwkmn 0:6f55c7651ccc 45 return m_timer.read_us();
jhnwkmn 0:6f55c7651ccc 46 }
jhnwkmn 0:6f55c7651ccc 47
jhnwkmn 0:6f55c7651ccc 48 // static
jhnwkmn 0:6f55c7651ccc 49 void Timer::bind(HSQUIRRELVM vm)
jhnwkmn 0:6f55c7651ccc 50 {
jhnwkmn 0:6f55c7651ccc 51 SqBind<Timer>::init(vm, _SC("Timer"));
jhnwkmn 0:6f55c7651ccc 52 sqbind_method(vm, "start", &Timer::start);
jhnwkmn 0:6f55c7651ccc 53 sqbind_method(vm, "stop", &Timer::stop);
jhnwkmn 0:6f55c7651ccc 54 sqbind_method(vm, "reset", &Timer::reset);
jhnwkmn 0:6f55c7651ccc 55 sqbind_method(vm, "read", &Timer::read);
jhnwkmn 0:6f55c7651ccc 56 sqbind_method(vm, "read_ms", &Timer::read_ms);
jhnwkmn 0:6f55c7651ccc 57 sqbind_method(vm, "read_us", &Timer::read_us);
jhnwkmn 0:6f55c7651ccc 58 }
jhnwkmn 0:6f55c7651ccc 59
jhnwkmn 0:6f55c7651ccc 60 }