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.
Diff: sqmbed/src/timer.cpp
- Revision:
- 0:6f55c7651ccc
- Child:
- 1:540008bb92a2
diff -r 000000000000 -r 6f55c7651ccc sqmbed/src/timer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sqmbed/src/timer.cpp Tue Dec 16 12:54:53 2014 +0000 @@ -0,0 +1,60 @@ +/* + @License@ +*/ + +#include <sqmbed/timer.h> + +namespace SqMbed +{ + +Timer::Timer() +{ +} + +Timer::~Timer() +{ +} + +void Timer::start() +{ + m_timer.start(); +} + +void Timer::stop() +{ + m_timer.stop(); +} + +void Timer::reset() +{ + m_timer.reset(); +} + +float Timer::read() const +{ + return m_timer.read(); +} + +int Timer::read_ms() const +{ + return m_timer.read_ms(); +} + +int Timer::read_us() const +{ + return m_timer.read_us(); +} + +// static +void Timer::bind(HSQUIRRELVM vm) +{ + SqBind<Timer>::init(vm, _SC("Timer")); + sqbind_method(vm, "start", &Timer::start); + sqbind_method(vm, "stop", &Timer::stop); + sqbind_method(vm, "reset", &Timer::reset); + sqbind_method(vm, "read", &Timer::read); + sqbind_method(vm, "read_ms", &Timer::read_ms); + sqbind_method(vm, "read_us", &Timer::read_us); +} + +}