Java Utilities Package com.systronix.util |
Thread.interrupt() support for aJile targets |
CLDC 1.0 doesn't include Thread.interrupt(). No problem, since this is a special aJile
iinstruction for aJ-100/aJ-80, it's easily added. The package com.systronix.ajilehelpers
does just that. Look at the ThreadHelper class and read the javadocs since
you must also modify an aJile runtime file per the instructions in the
ThreadHelper class comments. Includes a working example of a PeriodicThread interrupting another
thread.
When you run it the output looks
like this:
Test of Thread interruption - 2006 Mar 21 bboyes
Starting thread which will sleep and wait to be interrupted...
Starting PianoRoll in PT constructor..
Starting PianoRoll...
PT1 constructor, period=2msec
Starting PT...
Main thread going to sleep for 20000 msec
MyThread starting at 20
MyThread will sleep for 10000 msec
!Interrupted @1016
MyThread now active at 1017
!Interrupted @3016
MyThread now active at 3017
!Interrupted @5016
|
StringTokenizer |
This is the Sun class added to the J2ME/CLDC runtime by placing it in this package.
Also included in the Utils JAR is a StringTokenizerTest.java example program. Running
it against the string "this is a test of the StringTokenizer class" produces
this output in the Charade console window::
vm.0 charadeIO active
vm.0 heap monitor active
vm.0 heap monitor active
[TEXTIO.0]->this
[TEXTIO.0]->is
[TEXTIO.0]->a
[TEXTIO.0]->test
[TEXTIO.0]->of
[TEXTIO.0]->the
[TEXTIO.0]->StringTokenizer
[TEXTIO.0]->class |
Uart |
The start of a general-purpose javaxcomm, blocking
read, UART class. Setups up all the hardware and gives you input
and output streams. Works on the PC and all true Java embedded
systems with javaxcomm support. Note: on the PC and
JStamp/JStik/SaJe, serial ports are COM1, COM2, etc. On TINI they
are serial0, serial1, etc. These may be case sensitive, too. This
will all be worked out by System properties when this class is
complete. Uart class now lets you configure
databits, stopbits and parity (on those platforms which support
them). |
UartThread |
Added 20070717 - as the name suggests, wraps a Uart instance in a Thread, with input and output Streams. Best when used with blocking reads. A read which is waiting for input just suspends that thread while other threads go about their business. |
FastSwitch |
Creates a hashtable of runnable objects. Can be used to associate buttons, sliders, etc on an LCD user interface with the
actions in the hashtable. Much better than embedding the actions in the code which parses the data coming from the LCD. See
the Javadocs and also the Amulet project for an example of use. |
SystemProperty |
The start of a class to retrieve System properties. For one thing, this lets you tell (at runtime) what your
hardware is, so that you can adapt any runtime code such as the Uart class. |
StopWatch |
Useful for timing between points in your program |
Blink |
Blink any GPIO pin on and off in a variety of ways.
2003Nov08 release
supports blinking any pin, even a memory-mapped I/O device. Also a realtime-safe drivePinUsec()
method. |
Util class, includes sleepMicroSec |
public static void sleepMicroSec(long howMany)
Simple method to sleep a number of microseconds, compared to the base Thread.sleep which
only has millisecond resolution. Be sure to read the javadocs before using this, as you will
need to adjust your JSI setting. You must use the aJile 3.16.09 or later runtime. |
SystronixUtils20070717
Thread.interrupt support
added |
UartThread class adds Uart instance with a Thread per UART. Recommended for use with TrackBot and aJile hosts such as JStamp or JStik. Note: CLDC1.1 has its own Thread.interrupt support. |
SystronixUtils2006Apr11
Thread.interrupt support
added |
includes patched microcode for use with ThreadHelper.Interrupt() useful with aJile 3.16.09 |
SystronixUtils_20060225.jar
Minor
improvements |
Replaced by newer version |
SystronixUtils_2005Dec23.jar
Fully configurable
UART constructor added |
Uart class now lets you configure databits, stopbits and parity (on those platforms which
support them). Not fully tested, so let us know if you see issues with Uart. |
SystronixUtils_2004Apr20.jar
StringTokenizer class added. |
Includes source code, javadocs, some examples |
SystronixUtils_2003Nov08.jar
Latest Build -- Blink API is changing.
EventHandler interface added in 08 Nov 2003 release
link fixed 2004 Jan 01 |
A whole new approach to the Blink class, using an interface. This provides more flexibility for blinking other pins than
just GPIO pins - you could blink a pin on the JSimm.DIO board for example. But notice that since Blink is now an interface,
this change breaks any current Blink code. Maybe we'll reconsider and make a backwards-compatible class, before we make these
new changes part of the main release.
drivePinUsec(long usec,boolean highlow) which is an excellent
class for help debugging periodic threads or other realtime code. This method is notable since it does not yield execution
(so it doesn't interfere with thread scheduling), and it has microsecond resolution (in reality, 25 usec is about the best
achievable resolution on JStamp). |
SystronixUtils_2003Nov06.jar
sleepMicroSec added in
06 Nov 2003 release
This is the current version. Always changing, but we will try to not change the current,
stable public API. You might wish to archive your current version before overwriting it in
case you want to go back to it. |
JAR file from which you can execute the Utils classes com.systronix.util.*
Contains java source, javadocs and the Ant XML files used to build them.
To use these utils, save this JAR file in an appropriate place such as a java_lib/util folder. Then add this JAR file location
to your system classpath. Then you can import com.systronix.util.Uart, etc and use them in your Java programs.
You can extract the javadocs into a subfolder and refer to them for instructions on using the SystronixUtils API. |